pidgin/gtksmiley-manager.c

Wed, 02 Apr 2014 18:50:03 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Wed, 02 Apr 2014 18:50:03 +0200
changeset 35726
ac781ed58d2d
parent 35725
301fdb5e342e
child 35727
9025074cda55
permissions
-rw-r--r--

Smiley manager: more cleanup

22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1 /*
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
2 * pidgin
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
6 * source distribution.
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
7 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
12 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
17 *
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
35718
83486b5d34ab Drop PidginSmiley, rename gtksmiley to gtksmiley-manager
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35714
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
21 */
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
22
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
23 #include "internal.h"
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
24 #include "pidgin.h"
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
25
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
26 #include "debug.h"
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
27 #include "http.h"
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
28 #include "notify.h"
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
29 #include "smiley.h"
35723
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
30 #include "smiley-custom.h"
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
31 #include "smiley-list.h"
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
32
35718
83486b5d34ab Drop PidginSmiley, rename gtksmiley to gtksmiley-manager
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35714
diff changeset
33 #include "gtksmiley-manager.h"
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
34 #include "gtkutils.h"
35321
3fc5097c876d Migrate gtksmiley.[ch] to GtkWebViewSmiley (it was just a coincidence, that it didn't crashed before)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34449
diff changeset
35 #include "gtkwebview.h"
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
36 #include "pidginstock.h"
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
37
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
38 #include "gtk3compat.h"
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
39
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
40 #if 0
35718
83486b5d34ab Drop PidginSmiley, rename gtksmiley to gtksmiley-manager
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35714
diff changeset
41 typedef struct _PidginSmiley PidginSmiley;
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
42 struct _PidginSmiley
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
43 {
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
44 PurpleSmiley *smiley;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
45 GtkWidget *parent;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46 GtkWidget *smile;
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
47 GtkWidget *smiley_image;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
48 gchar *filename;
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
49 GdkPixbuf *custom_pixbuf;
32604
8d0a34f26244 Clean the API documentation in preparation for 3.0.0 by removing all the old @since tags.
Andrew Victor <andrew.victor@mxit.com>
parents: 32596
diff changeset
50 gpointer data;
8d0a34f26244 Clean the API documentation in preparation for 3.0.0 by removing all the old @since tags.
Andrew Victor <andrew.victor@mxit.com>
parents: 32596
diff changeset
51 gsize datasize;
8d0a34f26244 Clean the API documentation in preparation for 3.0.0 by removing all the old @since tags.
Andrew Victor <andrew.victor@mxit.com>
parents: 32596
diff changeset
52 gint entry_len;
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
53 };
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
54 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
55
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
56 typedef struct
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
57 {
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
58 PurpleSmiley *smiley;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
59
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
60 gchar *filename;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
61
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
62 GtkDialog *window;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
63 GtkImage *thumbnail;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
64 GtkEntry *shortcut;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
65 } SmileyEditDialog;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
66
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
67 typedef struct
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
68 {
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
69 GtkDialog *window;
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
70 GtkListStore *model;
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
71 GtkTreeView *tree;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
72
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
73 PurpleHttpConnection *running_request;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
74 } SmileyManager;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
75
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
76 enum
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
77 {
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
78 SMILEY_LIST_MODEL_ICON,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
79 SMILEY_LIST_MODEL_SHORTCUT,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
80 SMILEY_LIST_MODEL_PURPLESMILEY,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
81 SMILEY_LIST_MODEL_N_COL
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
82 };
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
83
35726
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
84 enum
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
85 {
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
86 PIDGIN_RESPONSE_MODIFY
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
87 };
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
88
35726
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
89 static SmileyManager *smiley_manager = NULL;
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
90
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
91 static void
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
92 edit_dialog_destroy(GtkWidget *window, gpointer _edit_dialog)
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
93 {
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
94 SmileyEditDialog *edit_dialog = _edit_dialog;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
95
35726
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
96 if (edit_dialog->smiley) {
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
97 g_object_set_data(G_OBJECT(edit_dialog->smiley),
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
98 "pidgin-smiley-manager-edit-dialog", NULL);
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
99 g_object_unref(edit_dialog->smiley);
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
100 }
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
101
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
102 g_free(edit_dialog->filename);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
103 g_free(edit_dialog);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
104 }
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
105
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
106 static void
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
107 edit_dialog_update_thumb(SmileyEditDialog *edit_dialog)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
108 {
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
109 GdkPixbuf *pixbuf = NULL;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
110
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
111 if (edit_dialog->filename) {
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
112 pixbuf = pidgin_pixbuf_new_from_file_at_scale(
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
113 edit_dialog->filename, 64, 64, TRUE);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
114 if (!pixbuf) {
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
115 g_free(edit_dialog->filename);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
116 edit_dialog->filename = NULL;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
117 }
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
118 }
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
119 if (!pixbuf) {
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
120 GtkIconSize icon_size =
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
121 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
122 pixbuf = gtk_widget_render_icon(GTK_WIDGET(edit_dialog->window),
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
123 PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, icon_size,
35726
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
124 "PidginSmileyManager");
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
125 }
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
126 g_return_if_fail(pixbuf != NULL);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
127
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
128 gtk_image_set_from_pixbuf(GTK_IMAGE(edit_dialog->thumbnail), pixbuf);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
129
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
130 g_object_unref(G_OBJECT(pixbuf));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
131 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
132
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
133 static void
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
134 edit_dialog_update_buttons(SmileyEditDialog *edit_dialog)
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
135 {
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
136 gboolean shortcut_ok, image_ok;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
137
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
138 shortcut_ok = (gtk_entry_get_text_length(edit_dialog->shortcut) > 0);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
139 image_ok = (edit_dialog->filename != NULL);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
140
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
141 gtk_dialog_set_response_sensitive(edit_dialog->window,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
142 GTK_RESPONSE_ACCEPT, shortcut_ok && image_ok);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
143 }
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
144
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
145 #if 0
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
146 static void do_add(GtkWidget *widget, PidginSmiley *s)
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
147 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
148 const gchar *entry;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
149 PurpleSmiley *emoticon;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
150
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
151 entry = gtk_entry_get_text(GTK_ENTRY(s->smile));
24155
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
152
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
153 emoticon = purple_smileys_find_by_shortcut(entry);
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
154 if (emoticon && emoticon != s->smiley) {
25878
d6ef15a065c6 Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents: 25877
diff changeset
155 gchar *msg;
d6ef15a065c6 Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents: 25877
diff changeset
156 msg = g_strdup_printf(_("A custom smiley for '%s' already exists. "
d6ef15a065c6 Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents: 25877
diff changeset
157 "Please use a different shortcut."), entry);
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
158 purple_notify_error(s, _("Custom Smiley"),
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34287
diff changeset
159 _("Duplicate Shortcut"), msg, NULL);
25878
d6ef15a065c6 Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents: 25877
diff changeset
160 g_free(msg);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
161 return;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
162 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
163
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
164 if (s->smiley) {
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
165 if (s->filename) {
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
166 gchar *data = NULL;
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
167 size_t len;
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
168 GError *err = NULL;
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
169
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
170 if (!g_file_get_contents(s->filename, &data, &len, &err)) {
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
171 purple_debug_error("gtksmiley", "Error reading %s: %s\n",
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
172 s->filename, err->message);
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
173 g_error_free(err);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
174
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
175 return;
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
176 }
23321
0dd2eca2a054 Always store custom smileys with hashed filenames. Closes #5913.
Marcus Lundblad <malu@pidgin.im>
parents: 23304
diff changeset
177 purple_smiley_set_data(s->smiley, (guchar*)data, len);
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
178 }
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
179 purple_smiley_set_shortcut(s->smiley, entry);
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
180 } else {
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
181 purple_debug_info("gtksmiley", "adding a new smiley\n");
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
182
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
183 if (s->filename == NULL) {
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
184 gchar *buffer = NULL;
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
185 gsize size = 0;
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
186 gchar *filename;
24847
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
187 const gchar *dirname = purple_smileys_get_storing_dir();
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
188
24847
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
189 /* since this may be called before purple_smiley_new_* has ever been
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
190 called, we create the storing dir, if it doesn't exist yet, to be
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
191 able to save the pixbuf before adding the smiley */
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
192 if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) {
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
193 purple_debug_info("gtksmiley", "Creating smileys directory.\n");
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
194
24847
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
195 if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) {
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
196 purple_debug_error("gtksmiley",
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
197 "Unable to create directory %s: %s\n",
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
198 dirname, g_strerror(errno));
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
199 }
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
200 }
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
201
27259
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
202 if (s->data && s->datasize) {
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
203 /* Cached data & size in memory */
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
204 buffer = s->data;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
205 size = s->datasize;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
206 }
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
207 else {
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
208 /* Get the smiley from the custom pixbuf */
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
209 gdk_pixbuf_save_to_buffer(s->custom_pixbuf, &buffer, &size,
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
210 "png", NULL, "compression", "9", NULL, NULL);
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
211 }
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
212 filename = purple_util_get_image_filename(buffer, size);
24847
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
213 s->filename = g_build_filename(dirname, filename, NULL);
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
214 purple_util_write_data_to_file_absolute(s->filename, buffer, size);
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
215 g_free(filename);
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
216 g_free(buffer);
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
217 }
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
218 emoticon = purple_smiley_new_from_file(entry, s->filename);
23949
9ec519c1b341 at least don't crash when we can't read whatever we are reading
Ka-Hing Cheung <khc@pidgin.im>
parents: 23375
diff changeset
219 if (emoticon)
9ec519c1b341 at least don't crash when we can't read whatever we are reading
Ka-Hing Cheung <khc@pidgin.im>
parents: 23375
diff changeset
220 pidgin_smiley_add_to_list(emoticon);
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
221 }
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
222
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
223 if (smiley_manager != NULL)
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
224 refresh_list();
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
225
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
226 gtk_widget_destroy(s->parent);
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
227 }
35698
302a7cb4c1ab Initial generic PurpleSmiley implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35500
diff changeset
228 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
229
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
230 static void
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
231 pidgin_smiley_edit_response(GtkDialog *window, gint response_id,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
232 gpointer _edit_dialog)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
233 {
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
234 SmileyEditDialog *edit_dialog = _edit_dialog;
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
235
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
236 switch (response_id) {
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
237 #if 0
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
238 case GTK_RESPONSE_ACCEPT:
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
239 do_add(widget, s);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
240 break;
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
241 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
242 case GTK_RESPONSE_DELETE_EVENT:
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
243 case GTK_RESPONSE_CANCEL:
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
244 gtk_widget_destroy(GTK_WIDGET(edit_dialog->window));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
245 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
246 default:
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
247 g_warn_if_reached();
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
248 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
249 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
250
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
251 static void
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
252 image_choosen(const char *filename, gpointer _edit_dialog)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
253 {
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
254 SmileyEditDialog *edit_dialog = _edit_dialog;
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
255
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
256 if (!filename)
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
257 return;
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
258
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
259 g_free(edit_dialog->filename);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
260 edit_dialog->filename = g_strdup(filename);
27498
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
261
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
262 edit_dialog_update_thumb(edit_dialog);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
263 edit_dialog_update_buttons(edit_dialog);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
264
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
265 gtk_widget_grab_focus(GTK_WIDGET(edit_dialog->shortcut));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
266 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
267
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
268 static void
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
269 open_image_selector(GtkWidget *widget, gpointer _edit_dialog)
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
270 {
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
271 GtkWidget *file_chooser;
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
272 file_chooser = pidgin_buddy_icon_chooser_new(
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
273 GTK_WINDOW(gtk_widget_get_toplevel(widget)),
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
274 image_choosen, _edit_dialog);
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
275 gtk_window_set_title(GTK_WINDOW(file_chooser), _("Custom Smiley"));
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
276 gtk_window_set_role(GTK_WINDOW(file_chooser),
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
277 "file-selector-custom-smiley");
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
278 gtk_widget_show_all(file_chooser);
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
279 }
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
280
27498
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
281 static void
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
282 smiley_shortcut_changed(GtkEditable *shortcut, gpointer _edit_dialog)
27498
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
283 {
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
284 SmileyEditDialog *edit_dialog = _edit_dialog;
27498
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
285
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
286 edit_dialog_update_buttons(edit_dialog);
27498
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
287 }
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
288
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
289 static void
35725
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
290 pidgin_smiley_edit(SmileyManager *manager, PurpleSmiley *smiley)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
291 {
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
292 SmileyEditDialog *edit_dialog;
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
293 GtkWidget *vbox, *hbox;
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
294 GtkLabel *label;
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
295 GtkButton *filech;
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
296
35726
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
297 if (smiley) {
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
298 edit_dialog = g_object_get_data(G_OBJECT(smiley),
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
299 "pidgin-smiley-manager-edit-dialog");
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
300 if (edit_dialog) {
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
301 gtk_window_present(GTK_WINDOW(edit_dialog->window));
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
302 return;
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
303 }
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
304 }
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
305
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
306 edit_dialog = g_new0(SmileyEditDialog, 1);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
307
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
308 edit_dialog->window = GTK_DIALOG(gtk_dialog_new_with_buttons(
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
309 smiley ? _("Edit Smiley") : _("Add Smiley"),
35725
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
310 GTK_WINDOW(manager->window), GTK_DIALOG_DESTROY_WITH_PARENT,
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
311 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
312 smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
313 NULL));
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
314 gtk_dialog_set_default_response(
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
315 edit_dialog->window, GTK_RESPONSE_ACCEPT);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
316
35726
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
317 if (smiley) {
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
318 edit_dialog->smiley = smiley;
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
319 g_object_set_data(G_OBJECT(smiley),
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
320 "pidgin-smiley-manager-edit-dialog", edit_dialog);
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
321 g_object_ref(smiley);
ac781ed58d2d Smiley manager: more cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35725
diff changeset
322 }
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
323
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
324 #if !GTK_CHECK_VERSION(3,0,0)
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
325 gtk_container_set_border_width(
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
326 GTK_CONTAINER(edit_dialog->window), PIDGIN_HIG_BORDER);
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
327 #endif
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
328
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
329 /* The vbox */
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
330 #if GTK_CHECK_VERSION(3,0,0)
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
331 vbox = gtk_grid_new();
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
332 gtk_grid_set_row_spacing(GTK_GRID(vbox), PIDGIN_HIG_BORDER);
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
333 #else
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
334 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
335 #endif
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
336 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
337 edit_dialog->window)), vbox);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
338 gtk_widget_show(vbox);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
339
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
340 /* The hbox */
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
341 #if GTK_CHECK_VERSION(3,0,0)
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
342 hbox = gtk_grid_new();
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
343 gtk_grid_set_column_spacing(GTK_GRID(hbox), PIDGIN_HIG_BORDER);
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
344 gtk_grid_attach(GTK_GRID(vbox), hbox, 0, 0, 1, 1);
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
345 #else
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
346 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
347 gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)), hbox);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
348 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
349
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
350 label = GTK_LABEL(gtk_label_new_with_mnemonic(_("_Image:")));
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
351 #if GTK_CHECK_VERSION(3,0,0)
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
352 gtk_grid_attach(GTK_GRID(hbox), GTK_WIDGET(label), 0, 0, 1, 1);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
353 #else
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
354 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
355 #endif
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
356 gtk_widget_show(GTK_WIDGET(label));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
357
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
358 filech = GTK_BUTTON(gtk_button_new());
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
359 #if GTK_CHECK_VERSION(3,0,0)
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
360 gtk_grid_attach_next_to(GTK_GRID(hbox), GTK_WIDGET(filech), NULL,
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
361 GTK_POS_RIGHT, 1, 1);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
362 #else
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
363 gtk_box_pack_end(GTK_BOX(hbox), GTK_WIDGET(filech), FALSE, FALSE, 0);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
364 #endif
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
365 pidgin_set_accessible_label(GTK_WIDGET(filech), label);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
366
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
367 edit_dialog->thumbnail = GTK_IMAGE(gtk_image_new());
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
368 gtk_container_add(GTK_CONTAINER(filech),
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
369 GTK_WIDGET(edit_dialog->thumbnail));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
370
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
371 gtk_widget_show_all(hbox);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
372
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
373 /* info */
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
374 #if GTK_CHECK_VERSION(3,0,0)
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
375 hbox = gtk_grid_new();
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
376 gtk_grid_set_column_spacing(GTK_GRID(hbox), PIDGIN_HIG_BORDER);
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
377
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
378 gtk_grid_attach_next_to(GTK_GRID(vbox), hbox, NULL,
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
379 GTK_POS_BOTTOM, 1, 1);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
380 #else
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
381 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
382 gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)),hbox);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
383 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
384
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
385 /* Shortcut text */
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
386 label = GTK_LABEL(gtk_label_new_with_mnemonic(_("S_hortcut text:")));
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
387 #if GTK_CHECK_VERSION(3,0,0)
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
388 gtk_grid_attach(GTK_GRID(hbox), GTK_WIDGET(label), 0, 0, 1, 1);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
389 #else
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
390 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0);
33412
4fd6fe073c8f Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents: 33170
diff changeset
391 #endif
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
392 gtk_widget_show(GTK_WIDGET(label));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
393
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
394 edit_dialog->shortcut = GTK_ENTRY(gtk_entry_new());
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
395 gtk_entry_set_activates_default(edit_dialog->shortcut, TRUE);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
396 pidgin_set_accessible_label(GTK_WIDGET(edit_dialog->shortcut), label);
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
397
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
398 #if GTK_CHECK_VERSION(3,0,0)
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
399 gtk_grid_attach_next_to(GTK_GRID(hbox), GTK_WIDGET(edit_dialog->shortcut), NULL, GTK_POS_RIGHT, 1, 1);
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
400 #else
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
401 gtk_box_pack_end(GTK_BOX(hbox), GTK_WIDGET(edit_dialog->shortcut), FALSE, FALSE, 0);
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
402 #endif
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
403
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
404 gtk_widget_show(GTK_WIDGET(edit_dialog->shortcut));
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
405 gtk_widget_show(hbox);
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
406 gtk_widget_show(GTK_WIDGET(edit_dialog->window));
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
407
27498
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
408 if (smiley) {
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
409 edit_dialog->filename =
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
410 g_strdup(purple_smiley_get_path(smiley));
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
411 gtk_entry_set_text(edit_dialog->shortcut,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
412 purple_smiley_get_shortcut(smiley));
27498
67b5d40e47c8 Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27259
diff changeset
413 }
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
414
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
415 edit_dialog_update_thumb(edit_dialog);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
416 edit_dialog_update_buttons(edit_dialog);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
417
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
418 g_signal_connect(edit_dialog->window, "response",
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
419 G_CALLBACK(pidgin_smiley_edit_response), edit_dialog);
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
420 g_signal_connect(filech, "clicked",
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
421 G_CALLBACK(open_image_selector), edit_dialog);
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
422 g_signal_connect(edit_dialog->shortcut, "changed",
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
423 G_CALLBACK(smiley_shortcut_changed), edit_dialog);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
424
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
425 g_signal_connect(edit_dialog->window, "destroy",
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
426 G_CALLBACK(edit_dialog_destroy), edit_dialog);
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
427 g_signal_connect(edit_dialog->window, "destroy",
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
428 G_CALLBACK(purple_notify_close_with_handle), edit_dialog);
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
429 }
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
430
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
431 #if 0
35718
83486b5d34ab Drop PidginSmiley, rename gtksmiley to gtksmiley-manager
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35714
diff changeset
432 static void
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
433 pidgin_smiley_editor_set_shortcut(PidginSmiley *editor, const gchar *shortcut)
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
434 {
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
435 gtk_entry_set_text(GTK_ENTRY(editor->smile), shortcut ? shortcut : "");
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
436 }
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
437 #endif
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
438
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
439 #if 0
35718
83486b5d34ab Drop PidginSmiley, rename gtksmiley to gtksmiley-manager
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35714
diff changeset
440 static void
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
441 pidgin_smiley_editor_set_image(PidginSmiley *editor, GdkPixbuf *image)
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
442 {
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
443 if (editor->custom_pixbuf)
26828
ca76e7ad0d4b Oops, I must have been tired. I only replaced the first occurrence of these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26820
diff changeset
444 g_object_unref(G_OBJECT(editor->custom_pixbuf));
26820
76f90ca8f6f2 Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25879
diff changeset
445 editor->custom_pixbuf = image ? g_object_ref(G_OBJECT(image)) : NULL;
27500
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
446 if (image) {
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
447 gtk_image_set_from_pixbuf(GTK_IMAGE(editor->smiley_image), image);
27500
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
448 if (editor->entry_len > 0)
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
449 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor->parent),
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
450 GTK_RESPONSE_ACCEPT, TRUE);
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
451 }
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
452 else
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
453 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor->parent),
bb929b192edc Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27499
diff changeset
454 GTK_RESPONSE_ACCEPT, FALSE);
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
455
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
456 edit_dialog_update_buttons(...);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
457 }
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
458 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
459
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
460 #if 0
35718
83486b5d34ab Drop PidginSmiley, rename gtksmiley to gtksmiley-manager
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35714
diff changeset
461 static void
29313
8603abcce6bf Using gpointer * is redundant.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28516
diff changeset
462 pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer data, gsize datasize)
27259
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
463 {
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
464 editor->data = data;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
465 editor->datasize = datasize;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
466 }
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
467 #endif
27259
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
468
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
469 /******************************************************************************
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
470 * Delete smiley
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
471 *****************************************************************************/
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
472 #if 0
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
473 static void delete_foreach(GtkTreeModel *model, GtkTreePath *path,
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
474 GtkTreeIter *iter, gpointer data)
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
475 {
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
476 PurpleSmiley *smiley = NULL;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
477
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
478 gtk_tree_model_get(model, iter,
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
479 SMILEY, &smiley,
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
480 -1);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
481
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
482 if(smiley != NULL) {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
483 g_object_unref(G_OBJECT(smiley));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
484 pidgin_smiley_del_from_list(smiley);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
485 purple_smiley_delete(smiley);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
486 }
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
487 }
35698
302a7cb4c1ab Initial generic PurpleSmiley implementation
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35500
diff changeset
488 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
489
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
490 #if 0
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
491 static void append_to_list(GtkTreeModel *model, GtkTreePath *path,
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
492 GtkTreeIter *iter, gpointer data)
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
493 {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
494 GList **list = data;
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
495 *list = g_list_prepend(*list, gtk_tree_path_copy(path));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
496 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
497
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
498 static void smiley_delete(SmileyManager *dialog)
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
499 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
500 GtkTreeSelection *selection;
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
501 GList *list = NULL;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
502
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
503 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview));
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
504 gtk_tree_selection_selected_foreach(selection, delete_foreach, dialog);
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
505 gtk_tree_selection_selected_foreach(selection, append_to_list, &list);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
506
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
507 while (list) {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
508 GtkTreeIter iter;
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
509 if (gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, list->data))
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
510 gtk_list_store_remove(GTK_LIST_STORE(dialog->model), &iter);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
511 gtk_tree_path_free(list->data);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
512 list = g_list_delete_link(list, list);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
513 }
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
514 }
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
515 #endif
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
516
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
517 #if 0
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
518 static void
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
519 smiley_got_url(PurpleHttpConnection *http_conn, PurpleHttpResponse *response,
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
520 gpointer _dialog)
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
521 {
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
522 SmileyManager *dialog = _dialog;
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
523 PidginSmiley *ps;
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
524 GdkPixbuf *image;
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
525 const gchar *smileydata;
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
526 size_t len;
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
527
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
528 g_assert(http_conn == smiley_manager->running_request);
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
529 smiley_manager->running_request = NULL;
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
530
34287
6cd0c77b1f6a HTTP: successful is spelled with one l
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34233
diff changeset
531 if (!purple_http_response_is_successful(response))
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
532 return;
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
533
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
534 smileydata = purple_http_response_get_data(response, &len);
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
535 image = pidgin_pixbuf_from_data((const guchar *)smileydata, len);
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31321
diff changeset
536 if (!image)
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
537 return;
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
538
35725
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
539 ps = pidgin_smiley_edit(manager, NULL);
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
540 pidgin_smiley_editor_set_image(ps, image);
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
541 pidgin_smiley_editor_set_data(ps, g_memdup(smileydata, len), len);
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
542 }
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
543 #endif
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
544
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
545 #if 0
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
546 static void
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
547 smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
548 GtkSelectionData *sd, guint info, guint t, gpointer user_data)
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
549 {
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
550 SmileyManager *dialog = user_data;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30706
diff changeset
551 gchar *name = g_strchomp((gchar *) gtk_selection_data_get_data(sd));
33158
ad941796372e Remove some added trailing spaces.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33141
diff changeset
552
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30706
diff changeset
553 if ((gtk_selection_data_get_length(sd) >= 0)
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30706
diff changeset
554 && (gtk_selection_data_get_format(sd) == 8)) {
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
555 /* Well, it looks like the drag event was cool.
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
556 * Let's do something with it */
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
557
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
558 if (!g_ascii_strncasecmp(name, "file://", 7)) {
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
559 GError *converr = NULL;
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
560 gchar *tmp;
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
561 PidginSmiley *ps;
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
562 /* It looks like we're dealing with a local file. Let's
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
563 * just try and read it */
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
564 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
565 purple_debug_error("smiley dnd", "%s\n",
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
566 (converr ? converr->message :
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
567 "g_filename_from_uri error"));
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
568 return;
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
569 }
35725
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
570 ps = pidgin_smiley_edit(manager, NULL);
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
571 image_choosen(tmp, ps);
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
572 if (gtk_image_get_pixbuf(GTK_IMAGE(ps->smiley_image)) == NULL)
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
573 gtk_dialog_response(GTK_DIALOG(ps->parent), GTK_RESPONSE_CANCEL);
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
574 g_free(tmp);
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
575 } else if (!g_ascii_strncasecmp(name, "http://", 7) ||
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
576 !g_ascii_strncasecmp(name, "https://", 8))
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
577 {
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
578 /* Oo, a web drag and drop. This is where things
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
579 * will start to get interesting */
34225
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
580 purple_http_conn_cancel(smiley_manager->
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
581 running_request);
3bba206f27f6 HTTP: migrate purple_util_fetch_url to new API for Pidgin UI
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33424
diff changeset
582 smiley_manager->running_request = purple_http_get(NULL,
34233
8bdcc4f84a5e HTTP: introduce purple_http_get_printf, make purple_http_get consistent with it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34225
diff changeset
583 smiley_got_url, dialog, name);
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
584 }
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
585
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
586 gtk_drag_finish(dc, TRUE, FALSE, t);
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
587 }
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
588
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
589 gtk_drag_finish(dc, FALSE, FALSE, t);
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
590 }
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
591 #endif
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
592
35723
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
593 static void
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
594 smiley_list_selected(GtkTreeSelection *sel, gpointer _manager)
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
595 {
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
596 SmileyManager *manager = _manager;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
597 gboolean sens;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
598
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
599 sens = (gtk_tree_selection_count_selected_rows(sel) > 0);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
600
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
601 gtk_dialog_set_response_sensitive(manager->window,
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
602 GTK_RESPONSE_NO, sens);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
603 gtk_dialog_set_response_sensitive(manager->window,
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
604 PIDGIN_RESPONSE_MODIFY, sens);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
605 }
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
606
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
607 static void
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
608 smiley_list_activated(GtkTreeView *tree, GtkTreePath *path,
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
609 GtkTreeViewColumn *col, gpointer _manager)
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
610 {
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
611 SmileyManager *manager = _manager;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
612 GtkTreeIter iter;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
613 PurpleSmiley *smiley = NULL;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
614
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
615 if (!gtk_tree_model_get_iter(
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
616 GTK_TREE_MODEL(manager->model), &iter, path))
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
617 {
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
618 return;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
619 }
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
620
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
621 gtk_tree_model_get(GTK_TREE_MODEL(manager->model), &iter,
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
622 SMILEY_LIST_MODEL_PURPLESMILEY, &smiley, -1);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
623 g_return_if_fail(PURPLE_IS_SMILEY(smiley));
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
624
35725
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
625 pidgin_smiley_edit(manager, smiley);
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
626 }
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
627
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
628 static void
35723
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
629 pidgin_smiley_manager_list_add(SmileyManager *manager, PurpleSmiley *smiley)
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
630 {
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
631 GdkPixbuf *smiley_image;
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
632 GtkTreeIter iter;
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
633
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
634 /* TODO: maybe some cache? */
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
635 smiley_image = pidgin_pixbuf_new_from_file_at_scale(
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
636 purple_smiley_get_path(smiley), 22, 22, TRUE);
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
637
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
638 gtk_list_store_append(manager->model, &iter);
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
639 gtk_list_store_set(manager->model, &iter,
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
640 SMILEY_LIST_MODEL_ICON, smiley_image,
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
641 SMILEY_LIST_MODEL_SHORTCUT, purple_smiley_get_shortcut(smiley),
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
642 SMILEY_LIST_MODEL_PURPLESMILEY, smiley,
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
643 -1);
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
644
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
645 if (smiley_image)
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
646 g_object_unref(smiley_image);
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
647 }
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
648
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
649 static void
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
650 pidgin_smiley_manager_list_fill(SmileyManager *manager)
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
651 {
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
652 GList *custom_smileys, *it;
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
653 gtk_list_store_clear(manager->model);
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
654
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
655 custom_smileys = purple_smiley_list_get_unique(
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
656 purple_smiley_custom_get_list());
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
657
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
658 for (it = custom_smileys; it; it = g_list_next(it)) {
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
659 PurpleSmiley *smiley = it->data;
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
660
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
661 pidgin_smiley_manager_list_add(manager, smiley);
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
662 }
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
663 g_list_free(custom_smileys);
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
664 }
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
665
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
666 static GtkWidget *
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
667 pidgin_smiley_manager_list_create(SmileyManager *manager)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
668 {
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
669 GtkTreeView *tree;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
670 GtkTreeSelection *sel;
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
671 GtkCellRenderer *cellrend;
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
672 GtkTreeViewColumn *column;
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
673 #if 0
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
674 GtkTargetEntry targets[3] = {
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
675 {"text/plain", 0, 0},
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
676 {"text/uri-list", 0, 1},
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
677 {"STRING", 0, 2}
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
678 };
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
679 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
680
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
681 manager->model = gtk_list_store_new(SMILEY_LIST_MODEL_N_COL,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
682 GDK_TYPE_PIXBUF, /* icon */
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
683 G_TYPE_STRING, /* shortcut */
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
684 G_TYPE_OBJECT /* PurpleSmiley */
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
685 );
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
686
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
687 manager->tree = tree = GTK_TREE_VIEW(gtk_tree_view_new_with_model(
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
688 GTK_TREE_MODEL(manager->model)));
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
689
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
690 gtk_tree_view_set_rules_hint(tree, TRUE);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
691 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(manager->model),
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
692 SMILEY_LIST_MODEL_SHORTCUT, GTK_SORT_ASCENDING);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
693
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
694 g_object_unref(manager->model);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
695
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
696 sel = gtk_tree_view_get_selection(tree);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
697 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
698
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
699 g_signal_connect(sel, "changed",
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
700 G_CALLBACK(smiley_list_selected), manager);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
701 g_signal_connect(tree, "row-activated",
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
702 G_CALLBACK(smiley_list_activated), manager);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
703
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
704 #if 0
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
705 gtk_drag_dest_set(GTK_WIDGET(tree), GTK_DEST_DEFAULT_MOTION |
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
706 GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
707 targets, G_N_ELEMENTS(targets),
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
708 GDK_ACTION_COPY | GDK_ACTION_MOVE);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
709 g_signal_connect(tree, "drag_data_received",
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
710 G_CALLBACK(smiley_dnd_recv), manager);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
711 #endif
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
712
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
713 gtk_widget_show(GTK_WIDGET(tree));
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
714
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
715 /* setting up columns */
29315
bc075251b3fd Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29314
diff changeset
716
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
717 column = gtk_tree_view_column_new();
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
718 gtk_tree_view_column_set_title(column, _("Smiley"));
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
719 gtk_tree_view_column_set_resizable(column, TRUE);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
720 gtk_tree_view_append_column(tree, column);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
721 cellrend = gtk_cell_renderer_pixbuf_new();
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
722 gtk_tree_view_column_pack_start(column, cellrend, FALSE);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
723 gtk_tree_view_column_add_attribute(column, cellrend,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
724 "pixbuf", SMILEY_LIST_MODEL_ICON);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
725
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
726 column = gtk_tree_view_column_new();
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
727 gtk_tree_view_column_set_title(column, _("Shortcut Text"));
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
728 gtk_tree_view_column_set_resizable(column, TRUE);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
729 gtk_tree_view_append_column(tree, column);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
730 cellrend = gtk_cell_renderer_text_new();
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
731 gtk_tree_view_column_pack_start(column, cellrend, TRUE);
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
732 gtk_tree_view_column_add_attribute(column, cellrend,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
733 "text", SMILEY_LIST_MODEL_SHORTCUT);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
734
35723
63d3826975d9 Smiley manager: fill the list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35722
diff changeset
735 pidgin_smiley_manager_list_fill(manager);
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
736
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
737 return pidgin_make_scrollable(GTK_WIDGET(tree), GTK_POLICY_AUTOMATIC,
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
738 GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
739 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
740
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
741 static void
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
742 smiley_manager_select_cb(GtkWidget *widget, gint resp, SmileyManager *manager)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
743 {
23020
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
744 GtkTreeSelection *selection = NULL;
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
745 GList *selected_rows, *selected_smileys = NULL, *it;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
746 GtkTreeModel *model = GTK_TREE_MODEL(manager->model);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
747
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
748 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(manager->tree));
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
749 selected_rows = gtk_tree_selection_get_selected_rows(selection, NULL);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
750 for (it = selected_rows; it; it = g_list_next(it)) {
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
751 GtkTreePath *path = it->data;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
752 GtkTreeIter iter;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
753 PurpleSmiley *smiley = NULL;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
754
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
755 if (!gtk_tree_model_get_iter(model, &iter, path))
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
756 continue;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
757
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
758 gtk_tree_model_get(model, &iter,
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
759 SMILEY_LIST_MODEL_PURPLESMILEY, &smiley, -1);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
760 if (!smiley)
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
761 continue;
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
762
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
763 selected_smileys = g_list_prepend(selected_smileys, smiley);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
764 }
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
765 g_list_free_full(selected_rows, (GDestroyNotify)gtk_tree_path_free);
23020
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
766
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
767 switch (resp) {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
768 case GTK_RESPONSE_YES:
35725
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
769 pidgin_smiley_edit(manager, NULL);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
770 break;
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
771 #if 0
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
772 case GTK_RESPONSE_NO:
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
773 smiley_delete(manager);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
774 break;
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
775 #endif
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
776 case GTK_RESPONSE_DELETE_EVENT:
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
777 case GTK_RESPONSE_CLOSE:
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
778 gtk_widget_destroy(GTK_WIDGET(manager->window));
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
779 purple_http_conn_cancel(manager->running_request);
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
780 g_free(manager);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
781 smiley_manager = NULL;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
782 break;
25390
02100938b030 Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <deryni@pidgin.im>
parents: 24847
diff changeset
783 case PIDGIN_RESPONSE_MODIFY:
35725
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
784 for (it = selected_smileys; it; it = g_list_next(it))
301fdb5e342e Cleanup pidgin_smiley_edit calls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35724
diff changeset
785 pidgin_smiley_edit(manager, it->data);
23020
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
786 break;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
787 default:
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
788 g_warn_if_reached();
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
789 }
35724
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
790
baf1255d0a3b Smiley manager: edit dialog
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35723
diff changeset
791 g_list_free(selected_smileys);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
792 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
793
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
794 void
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
795 pidgin_smiley_manager_show(void)
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
796 {
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
797 SmileyManager *manager;
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
798 GtkDialog *win;
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
799 GtkWidget *sw, *vbox;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
800
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
801 if (smiley_manager) {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
802 gtk_window_present(GTK_WINDOW(smiley_manager->window));
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
803 return;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
804 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
805
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
806 manager = g_new0(SmileyManager, 1);
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
807 smiley_manager = manager;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
808
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
809 manager->window = win = GTK_DIALOG(gtk_dialog_new_with_buttons(
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
810 _("Custom Smiley Manager"), NULL,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
811 GTK_DIALOG_DESTROY_WITH_PARENT,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
812 PIDGIN_STOCK_ADD, GTK_RESPONSE_YES,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
813 PIDGIN_STOCK_MODIFY, PIDGIN_RESPONSE_MODIFY,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
814 GTK_STOCK_DELETE, GTK_RESPONSE_NO,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
815 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
816 NULL));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
817
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
818 gtk_window_set_default_size(GTK_WINDOW(win), 50, 400);
23017
82f6abec236d Some little usability changes in the custom smiley dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23013
diff changeset
819 gtk_window_set_role(GTK_WINDOW(win), "custom_smiley_manager");
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
820 #if !GTK_CHECK_VERSION(3,0,0)
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
821 gtk_container_set_border_width(GTK_CONTAINER(win),PIDGIN_HIG_BORDER);
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33158
diff changeset
822 #endif
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
823 gtk_dialog_set_response_sensitive(win, GTK_RESPONSE_NO, FALSE);
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
824 gtk_dialog_set_response_sensitive(win, PIDGIN_RESPONSE_MODIFY, FALSE);
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
825
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
826 g_signal_connect(win, "response",
35720
863f87bfc06e Smiley manager: cleanup
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35719
diff changeset
827 G_CALLBACK(smiley_manager_select_cb), manager);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
828
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
829 /* The vbox */
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
830 vbox = gtk_dialog_get_content_area(win);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
831
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
832 /* get the scrolled window with all stuff */
35722
1177d6b4c769 Smiley manager: (empty) smiley list
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35720
diff changeset
833 sw = pidgin_smiley_manager_list_create(manager);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
834 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
835 gtk_widget_show(sw);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
836
35719
6bf3252bf6db Smiley manager: edit window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35718
diff changeset
837 gtk_widget_show(GTK_WIDGET(win));
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
838 }

mercurial