Tue, 07 May 2013 05:04:46 -0400
Rewrite debug window filter in JS.
Note, this does cause a couple regressions, but they are probably not
that big a deal. First, the JS regular expression syntax is slightly
different. Second, the JS regex API lacks a way to reliably determine
the location of matched groups, so we can't highlight just the groups
and must highlight the entire expression.
I suspect that none of our users ever had to use any fancy regex in the
debug window, and that most of our developers didn't even know it could
be done. So I doubt these regressions will cause much pain.
|
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 | * @file gtksmiley.c GTK+ Smiley Manager API |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3 | * @ingroup pidgin |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
4 | */ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
5 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
6 | /* |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
7 | * pidgin |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
8 | * |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
9 | * 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
|
10 | * 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
|
11 | * 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
|
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 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
|
14 | * 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
|
15 | * 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
|
16 | * (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
|
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 | * 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
|
19 | * 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
|
20 | * 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
|
21 | * 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
|
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 | * 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
|
24 | * along with this program; if not, write to the Free Software |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
26 | */ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | |
|
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 "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
|
29 | #include "pidgin.h" |
|
33424
9919d10ee405
Make old http-related code obsolete
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33412
diff
changeset
|
30 | #include "obsolete.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
|
31 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | #include "debug.h" |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
33 | #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
|
34 | #include "smiley.h" |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
36 | #include "gtkimhtml.h" |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
37 | #include "gtksmiley.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
|
38 | #include "gtkutils.h" |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
39 | #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
|
40 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33158
diff
changeset
|
41 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33158
diff
changeset
|
42 | |
|
25390
02100938b030
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <deryni@pidgin.im>
parents:
24847
diff
changeset
|
43 | #define PIDGIN_RESPONSE_MODIFY 1000 |
|
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
|
44 | |
|
23304
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
45 | 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
|
46 | { |
|
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 | 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
|
48 | 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
|
49 | 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
|
50 | 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
|
51 | 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
|
52 | 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
|
53 | 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
|
54 | 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
|
55 | 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
|
56 | }; |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
57 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
58 | 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
|
59 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
60 | GtkWidget *window; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
61 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
62 | GtkWidget *treeview; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
63 | GtkListStore *model; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
64 | } SmileyManager; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
65 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
66 | enum |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
67 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
68 | ICON, |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
69 | SHORTCUT, |
|
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
|
70 | 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
|
71 | N_COL |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
72 | }; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
73 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
74 | static SmileyManager *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
|
75 | static GSList *gtk_smileys = NULL; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
76 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
77 | static void |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
78 | pidgin_smiley_destroy(PidginSmiley *smiley) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
79 | { |
|
29314
236d031667ae
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29313
diff
changeset
|
80 | if (smiley->smiley) |
|
236d031667ae
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29313
diff
changeset
|
81 | g_object_set_data(G_OBJECT(smiley->smiley), "edit-dialog", 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
|
82 | gtk_widget_destroy(smiley->parent); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
83 | g_free(smiley->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
|
84 | if (smiley->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
|
85 | g_object_unref(G_OBJECT(smiley->custom_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
|
86 | g_free(smiley); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
87 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
88 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
89 | /****************************************************************************** |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
90 | * GtkIMHtmlSmileys stuff |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
91 | *****************************************************************************/ |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
92 | /* Perhaps these should be in gtkimhtml.c instead. -- sadrul */ |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
93 | static void add_gtkimhtml_to_list(GtkIMHtmlSmiley *gtksmiley) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
94 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
95 | gtk_smileys = g_slist_prepend(gtk_smileys, gtksmiley); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
96 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
97 | purple_debug_info("gtksmiley", "adding %s to gtk_smileys\n", gtksmiley->smile); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
98 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
99 | |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
100 | static void |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
101 | shortcut_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley) |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
102 | { |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
103 | g_free(gtksmiley->smile); |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
104 | gtksmiley->smile = g_strdup(purple_smiley_get_shortcut(smiley)); |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
105 | } |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
106 | |
|
23375
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
107 | static void |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
108 | image_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley) |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
109 | { |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
110 | const char *file; |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
111 | |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
112 | g_free(gtksmiley->file); |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
113 | |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
114 | file = purple_imgstore_get_filename(purple_smiley_get_stored_image(smiley)); |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
115 | gtksmiley->file = g_build_filename(purple_smileys_get_storing_dir(), file, NULL); |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
116 | gtk_imhtml_smiley_reload(gtksmiley); |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
117 | } |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
118 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
119 | static GtkIMHtmlSmiley *smiley_purple_to_gtkimhtml(PurpleSmiley *smiley) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
120 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
121 | GtkIMHtmlSmiley *gtksmiley; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
122 | gchar *filename; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
123 | const gchar *file; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
124 | |
|
22449
4fea5a505737
Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22447
diff
changeset
|
125 | file = purple_imgstore_get_filename(purple_smiley_get_stored_image(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
|
126 | |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
127 | filename = g_build_filename(purple_smileys_get_storing_dir(), file, 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
|
128 | |
|
22655
718f1149a81c
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22452
diff
changeset
|
129 | gtksmiley = gtk_imhtml_smiley_create(filename, purple_smiley_get_shortcut(smiley), |
|
718f1149a81c
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22452
diff
changeset
|
130 | FALSE, GTK_IMHTML_SMILEY_CUSTOM); |
|
718f1149a81c
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22452
diff
changeset
|
131 | g_free(filename); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
132 | |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
133 | /* Make sure the shortcut for the GtkIMHtmlSmiley is updated with the PurpleSmiley */ |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
134 | g_signal_connect(G_OBJECT(smiley), "notify::shortcut", |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
135 | G_CALLBACK(shortcut_changed_cb), gtksmiley); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
136 | |
|
23375
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
137 | /* And update the pixbuf too when the image is changed */ |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
138 | g_signal_connect(G_OBJECT(smiley), "notify::image", |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
139 | G_CALLBACK(image_changed_cb), gtksmiley); |
|
7381f18647da
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23321
diff
changeset
|
140 | |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
141 | return gtksmiley; |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
142 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
143 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
144 | void pidgin_smiley_del_from_list(PurpleSmiley *smiley) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
145 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
146 | GSList *list = NULL; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
147 | GtkIMHtmlSmiley *gtksmiley; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
148 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
149 | if (gtk_smileys == NULL) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
150 | return; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
151 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
152 | list = gtk_smileys; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | for (; list; list = list->next) { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
155 | gtksmiley = (GtkIMHtmlSmiley*)list->data; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
156 | |
|
22449
4fea5a505737
Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22447
diff
changeset
|
157 | if (strcmp(gtksmiley->smile, purple_smiley_get_shortcut(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
|
158 | continue; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
159 | |
|
22655
718f1149a81c
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22452
diff
changeset
|
160 | gtk_imhtml_smiley_destroy(gtksmiley); |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
161 | g_signal_handlers_disconnect_matched(G_OBJECT(smiley), G_SIGNAL_MATCH_DATA, |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
162 | 0, 0, NULL, NULL, gtksmiley); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
163 | break; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
165 | |
|
22447
ad500e991f0d
Make sure deleting one smiley doesn't accidentally delete a few others.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22443
diff
changeset
|
166 | if (list) |
|
ad500e991f0d
Make sure deleting one smiley doesn't accidentally delete a few others.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22443
diff
changeset
|
167 | gtk_smileys = g_slist_delete_link(gtk_smileys, list); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
168 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
169 | |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
170 | void pidgin_smiley_add_to_list(PurpleSmiley *smiley) |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
171 | { |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
172 | GtkIMHtmlSmiley *gtksmiley; |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
173 | |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
174 | gtksmiley = smiley_purple_to_gtkimhtml(smiley); |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
175 | add_gtkimhtml_to_list(gtksmiley); |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
176 | g_signal_connect(G_OBJECT(smiley), "destroy", G_CALLBACK(pidgin_smiley_del_from_list), NULL); |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
177 | } |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
178 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
179 | void pidgin_smileys_init(void) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
180 | { |
|
22450
422684486996
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22449
diff
changeset
|
181 | GList *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
|
182 | PurpleSmiley *smiley; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
183 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
184 | if (gtk_smileys != NULL) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
185 | return; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
186 | |
|
22450
422684486996
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22449
diff
changeset
|
187 | smileys = purple_smileys_get_all(); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
188 | |
|
22450
422684486996
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22449
diff
changeset
|
189 | for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { |
|
422684486996
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22449
diff
changeset
|
190 | smiley = (PurpleSmiley*)smileys->data; |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
191 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
192 | pidgin_smiley_add_to_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
|
193 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
194 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
195 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
196 | void pidgin_smileys_uninit(void) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
197 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
198 | GSList *list; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
199 | GtkIMHtmlSmiley *gtksmiley; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
200 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
201 | list = gtk_smileys; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
202 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
203 | if (list == NULL) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
204 | return; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
205 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
206 | for (; list; list = g_slist_delete_link(list, list)) { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
207 | gtksmiley = (GtkIMHtmlSmiley*)list->data; |
|
22655
718f1149a81c
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22452
diff
changeset
|
208 | gtk_imhtml_smiley_destroy(gtksmiley); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
209 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
210 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
211 | gtk_smileys = NULL; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
212 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
213 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
214 | GSList *pidgin_smileys_get_all(void) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
215 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
216 | return gtk_smileys; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
217 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
218 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
219 | /****************************************************************************** |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
220 | * Manager stuff |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
221 | *****************************************************************************/ |
|
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 | static void refresh_list(void); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
224 | |
|
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 | * The Add dialog |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
227 | ******************************************************************************/ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
228 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
229 | 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
|
230 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
231 | 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
|
232 | 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
|
233 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
234 | 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
|
235 | |
|
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
|
236 | 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
|
237 | 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
|
238 | gchar *msg; |
|
d6ef15a065c6
Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents:
25877
diff
changeset
|
239 | 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
|
240 | "Please use a different shortcut."), entry); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
241 | purple_notify_error(s->parent, _("Custom Smiley"), |
|
25878
d6ef15a065c6
Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents:
25877
diff
changeset
|
242 | _("Duplicate Shortcut"), msg); |
|
d6ef15a065c6
Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents:
25877
diff
changeset
|
243 | 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
|
244 | return; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
245 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
246 | |
|
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
|
247 | 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
|
248 | 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
|
249 | 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
|
250 | 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
|
251 | 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
|
252 | |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
253 | 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
|
254 | 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
|
255 | 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
|
256 | 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
|
257 | |
|
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
|
258 | 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
|
259 | } |
|
23321
0dd2eca2a054
Always store custom smileys with hashed filenames. Closes #5913.
Marcus Lundblad <malu@pidgin.im>
parents:
23304
diff
changeset
|
260 | 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
|
261 | } |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
262 | 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
|
263 | } 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
|
264 | 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
|
265 | |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
266 | 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
|
267 | 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
|
268 | 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
|
269 | 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
|
270 | 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
|
271 | |
|
24847
6f803850c88b
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
272 | /* 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
|
273 | 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
|
274 | 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
|
275 | 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
|
276 | 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
|
277 | |
|
24847
6f803850c88b
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
278 | 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
|
279 | 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
|
280 | "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
|
281 | 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
|
282 | } |
|
6f803850c88b
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents:
24254
diff
changeset
|
283 | } |
|
25876
6dafeb78324a
Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents:
25390
diff
changeset
|
284 | |
|
27259
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
285 | 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
|
286 | /* 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
|
287 | buffer = s->data; |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
288 | size = s->datasize; |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
289 | } |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
290 | else { |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
291 | /* 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
|
292 | 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
|
293 | "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
|
294 | } |
|
23304
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
295 | 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
|
296 | 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
|
297 | 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
|
298 | 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
|
299 | 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
|
300 | } |
|
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
|
301 | 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
|
302 | 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
|
303 | 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
|
304 | } |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
305 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
306 | 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
|
307 | 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
|
308 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
309 | gtk_widget_destroy(s->parent); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
310 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
311 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
312 | static void do_add_select_cb(GtkWidget *widget, gint resp, 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
|
313 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
314 | 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
|
315 | 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
|
316 | 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
|
317 | break; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
318 | 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
|
319 | case GTK_RESPONSE_CANCEL: |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
320 | gtk_widget_destroy(s->parent); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
321 | break; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
322 | default: |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
323 | purple_debug_error("gtksmiley", "no valid response\n"); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
324 | break; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
325 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
326 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
327 | |
|
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
|
328 | static void do_add_file_cb(const char *filename, gpointer data) |
|
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 | { |
|
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
|
330 | PidginSmiley *s = data; |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
331 | GdkPixbuf *pixbuf; |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
332 | |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
333 | 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
|
334 | 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
|
335 | |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
336 | g_free(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
|
337 | s->filename = g_strdup(filename); |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
338 | pixbuf = pidgin_pixbuf_new_from_file_at_scale(filename, 64, 64, FALSE); |
|
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
|
339 | gtk_image_set_from_pixbuf(GTK_IMAGE(s->smiley_image), pixbuf); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
340 | if (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
|
341 | g_object_unref(G_OBJECT(pixbuf)); |
|
23017
82f6abec236d
Some little usability changes in the custom smiley dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23013
diff
changeset
|
342 | gtk_widget_grab_focus(s->smile); |
|
27498
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
343 | |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
344 | if (s->entry_len > 0) |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
345 | gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, TRUE); |
|
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 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
347 | |
|
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
|
348 | static void |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
349 | open_image_selector(GtkWidget *widget, PidginSmiley *psmiley) |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
350 | { |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
351 | GtkWidget *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
|
352 | file_chooser = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(widget)), |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
353 | do_add_file_cb, psmiley); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
354 | gtk_window_set_title(GTK_WINDOW(file_chooser), _("Custom 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
|
355 | gtk_window_set_role(GTK_WINDOW(file_chooser), "file-selector-custom-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
|
356 | 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
|
357 | } |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
358 | |
|
27498
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
359 | static void |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
360 | smiley_name_insert_cb(GtkEditable *editable, |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
361 | gchar *new_text, |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
362 | gint new_text_length, |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
363 | gint *position, |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
364 | gpointer user_data) |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
365 | { |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
366 | PidginSmiley *s = user_data; |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
367 | if (new_text_length != -1) |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
368 | s->entry_len += new_text_length; |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
369 | else |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
370 | s->entry_len += strlen(new_text); |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
371 | |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
372 | if (s->filename != NULL || s->custom_pixbuf != NULL || s->smiley != NULL) |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
373 | gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, TRUE); |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
374 | } |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
375 | |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
376 | static void |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
377 | smiley_name_delete_cb(GtkEditable *editable, |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
378 | gint start_pos, |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
379 | gint end_pos, |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
380 | gpointer user_data) |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
381 | { |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
382 | PidginSmiley *s = user_data; |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
383 | s->entry_len -= end_pos - start_pos; |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
384 | |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
385 | if (s->entry_len <= 0) |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
386 | gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, FALSE); |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
387 | } |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
388 | |
|
23304
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
389 | PidginSmiley * |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
390 | pidgin_smiley_edit(GtkWidget *widget, 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
|
391 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
392 | GtkWidget *vbox; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
393 | GtkWidget *hbox; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
394 | GtkWidget *label; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
395 | GtkWidget *filech; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
396 | GtkWidget *window; |
|
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
|
397 | GdkPixbuf *pixbuf = 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
|
398 | PurpleStoredImage *stored_img; |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
399 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
400 | PidginSmiley *s = g_new0(PidginSmiley, 1); |
|
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
|
401 | s->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
|
402 | |
|
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
|
403 | window = gtk_dialog_new_with_buttons(smiley ? _("Edit Smiley") : _("Add Smiley"), |
|
23304
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
404 | widget ? GTK_WINDOW(widget) : NULL, |
|
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
|
405 | GTK_DIALOG_DESTROY_WITH_PARENT, |
|
24155
0747d1bba8a7
Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24102
diff
changeset
|
406 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
|
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
|
407 | smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, 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
|
408 | NULL); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
409 | s->parent = window; |
|
29314
236d031667ae
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29313
diff
changeset
|
410 | if (smiley) |
|
236d031667ae
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29313
diff
changeset
|
411 | g_object_set_data(G_OBJECT(smiley), "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
|
412 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33158
diff
changeset
|
413 | #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
|
414 | gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33158
diff
changeset
|
415 | #endif |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33158
diff
changeset
|
416 | |
|
27499
bf9a6c614f3c
Set the correct default response in the smiley edit window so it gets the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27498
diff
changeset
|
417 | gtk_dialog_set_default_response(GTK_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
|
418 | g_signal_connect(window, "response", G_CALLBACK(do_add_select_cb), s); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
419 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
420 | /* The vbox */ |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
421 | #if GTK_CHECK_VERSION(3,0,0) |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
422 | vbox = gtk_grid_new(); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
423 | 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
|
424 | #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
|
425 | 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
|
426 | #endif |
|
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
|
427 | gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(window))), |
|
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
|
428 | 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
|
429 | 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
|
430 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
431 | /* The hbox */ |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
432 | #if GTK_CHECK_VERSION(3,0,0) |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
433 | hbox = gtk_grid_new(); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
434 | 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
|
435 | 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
|
436 | #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
|
437 | 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
|
438 | 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
|
439 | #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
|
440 | |
|
25876
6dafeb78324a
Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents:
25390
diff
changeset
|
441 | 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
|
442 | #if GTK_CHECK_VERSION(3,0,0) |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
443 | gtk_grid_attach(GTK_GRID(hbox), label, 0, 0, 1, 1); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
444 | #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
|
445 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
446 | #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
|
447 | gtk_widget_show(label); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
448 | |
|
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
|
449 | filech = gtk_button_new(); |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
450 | #if GTK_CHECK_VERSION(3,0,0) |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
451 | gtk_grid_attach_next_to(GTK_GRID(hbox), filech, NULL, GTK_POS_RIGHT, 1, 1); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
452 | #else |
|
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
|
453 | gtk_box_pack_end(GTK_BOX(hbox), filech, FALSE, FALSE, 0); |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
454 | #endif |
|
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
|
455 | pidgin_set_accessible_label(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
|
456 | |
|
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
|
457 | s->smiley_image = gtk_image_new(); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
458 | gtk_container_add(GTK_CONTAINER(filech), s->smiley_image); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
459 | if (smiley && (stored_img = purple_smiley_get_stored_image(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
|
460 | pixbuf = pidgin_pixbuf_from_imgstore(stored_img); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
461 | purple_imgstore_unref(stored_img); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
462 | } 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
|
463 | GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
464 | pixbuf = gtk_widget_render_icon(window, PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
465 | icon_size, "PidginSmiley"); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
466 | } |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
467 | |
|
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
|
468 | gtk_image_set_from_pixbuf(GTK_IMAGE(s->smiley_image), pixbuf); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
469 | if (pixbuf != 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
|
470 | g_object_unref(G_OBJECT(pixbuf)); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
471 | g_signal_connect(G_OBJECT(filech), "clicked", G_CALLBACK(open_image_selector), s); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
472 | |
|
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
|
473 | 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
|
474 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
475 | /* info */ |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
476 | #if GTK_CHECK_VERSION(3,0,0) |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
477 | hbox = gtk_grid_new(); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
478 | 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
|
479 | |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
480 | gtk_grid_attach_next_to(GTK_GRID(vbox), hbox, NULL, GTK_POS_BOTTOM, 1, 1); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
481 | #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
|
482 | 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
|
483 | 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
|
484 | #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
|
485 | |
|
25876
6dafeb78324a
Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents:
25390
diff
changeset
|
486 | /* Shortcut text */ |
|
6dafeb78324a
Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents:
25390
diff
changeset
|
487 | 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
|
488 | #if GTK_CHECK_VERSION(3,0,0) |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
489 | gtk_grid_attach(GTK_GRID(hbox), label, 0, 0, 1, 1); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
490 | #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
|
491 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
492 | #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
|
493 | gtk_widget_show(label); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
494 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
495 | s->smile = gtk_entry_new(); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
496 | gtk_entry_set_activates_default(GTK_ENTRY(s->smile), TRUE); |
|
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
|
497 | pidgin_set_accessible_label(s->smile, label); |
|
27498
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
498 | if (smiley) { |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
499 | const char *shortcut = purple_smiley_get_shortcut(smiley); |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
500 | gtk_entry_set_text(GTK_ENTRY(s->smile), shortcut); |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
501 | s->entry_len = strlen(shortcut); |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
502 | } |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
503 | else |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
504 | gtk_dialog_set_response_sensitive(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT, FALSE); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
505 | |
|
27498
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
506 | /* gtk_entry_get_text_length is 2.14+, so we'll just keep track ourselves */ |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
507 | g_signal_connect(G_OBJECT(s->smile), "insert-text", G_CALLBACK(smiley_name_insert_cb), s); |
|
67b5d40e47c8
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27259
diff
changeset
|
508 | g_signal_connect(G_OBJECT(s->smile), "delete-text", G_CALLBACK(smiley_name_delete_cb), s); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
509 | |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
510 | #if GTK_CHECK_VERSION(3,0,0) |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
511 | gtk_grid_attach_next_to(GTK_GRID(hbox), s->smile, NULL, GTK_POS_RIGHT, 1, 1); |
|
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
512 | #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
|
513 | gtk_box_pack_end(GTK_BOX(hbox), s->smile, FALSE, FALSE, 0); |
|
33412
4fd6fe073c8f
Migrate some bits to GTK3 API.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
514 | #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
|
515 | gtk_widget_show(s->smile); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
516 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
517 | gtk_widget_show(hbox); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
518 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
519 | gtk_widget_show(GTK_WIDGET(window)); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
520 | g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(pidgin_smiley_destroy), s); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
521 | g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(purple_notify_close_with_handle), s); |
|
23304
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
522 | |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
523 | return s; |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
524 | } |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
525 | |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
526 | void |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
527 | 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
|
528 | { |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
529 | 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
|
530 | } |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
531 | |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
532 | void |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
533 | 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
|
534 | { |
|
3aba02105818
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23020
diff
changeset
|
535 | 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
|
536 | 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
|
537 | 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
|
538 | 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
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | 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
|
543 | } |
|
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
|
544 | 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
|
545 | 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
|
546 | GTK_RESPONSE_ACCEPT, FALSE); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
547 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
548 | |
|
27259
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
549 | void |
|
29313
8603abcce6bf
Using gpointer * is redundant.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28516
diff
changeset
|
550 | 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
|
551 | { |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
552 | editor->data = data; |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
553 | editor->datasize = datasize; |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
554 | } |
|
50ab3ce89cdb
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26828
diff
changeset
|
555 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
556 | /****************************************************************************** |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
557 | * 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
|
558 | *****************************************************************************/ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
559 | 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
|
560 | 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
|
561 | { |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
562 | 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
|
563 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
564 | gtk_tree_model_get(model, iter, |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
565 | 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
|
566 | -1); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
567 | |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
568 | if(smiley != NULL) { |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
569 | 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
|
570 | 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
|
571 | 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
|
572 | } |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
573 | } |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
574 | |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
575 | static void append_to_list(GtkTreeModel *model, GtkTreePath *path, |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
576 | GtkTreeIter *iter, gpointer data) |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
577 | { |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
578 | GList **list = data; |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
579 | *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
|
580 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
581 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
582 | 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
|
583 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
584 | GtkTreeSelection *selection; |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
585 | 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
|
586 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
587 | 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
|
588 | 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
|
589 | 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
|
590 | |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
591 | while (list) { |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
592 | GtkTreeIter iter; |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
593 | 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
|
594 | 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
|
595 | gtk_tree_path_free(list->data); |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
596 | list = g_list_delete_link(list, list); |
|
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
597 | } |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
598 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
599 | /****************************************************************************** |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
600 | * The 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
|
601 | *****************************************************************************/ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
602 | static void add_columns(GtkWidget *treeview, 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
|
603 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
604 | GtkCellRenderer *rend; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
605 | GtkTreeViewColumn *column; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
606 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
607 | /* Icon */ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
608 | column = gtk_tree_view_column_new(); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
609 | gtk_tree_view_column_set_title(column, _("Smiley")); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
610 | gtk_tree_view_column_set_resizable(column, TRUE); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
611 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
612 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
613 | rend = gtk_cell_renderer_pixbuf_new(); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
614 | gtk_tree_view_column_pack_start(column, rend, FALSE); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
615 | gtk_tree_view_column_add_attribute(column, rend, "pixbuf", ICON); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
616 | |
|
25876
6dafeb78324a
Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents:
25390
diff
changeset
|
617 | /* Shortcut Text */ |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
618 | column = gtk_tree_view_column_new(); |
|
25876
6dafeb78324a
Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents:
25390
diff
changeset
|
619 | gtk_tree_view_column_set_title(column, _("Shortcut Text")); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
620 | gtk_tree_view_column_set_resizable(column, TRUE); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
621 | gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
622 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
623 | rend = gtk_cell_renderer_text_new(); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
624 | gtk_tree_view_column_pack_start(column, rend, TRUE); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
625 | gtk_tree_view_column_add_attribute(column, rend, "text", SHORTCUT); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
626 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
627 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
628 | static void store_smiley_add(PurpleSmiley *smiley) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
629 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
630 | GtkTreeIter iter; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
631 | PurpleStoredImage *img; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
632 | GdkPixbuf *sized_smiley = NULL; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
633 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
634 | 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
|
635 | return; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
636 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
637 | img = purple_smiley_get_stored_image(smiley); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
638 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
639 | if (img != NULL) { |
|
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
|
640 | GdkPixbuf *smiley_image = pidgin_pixbuf_from_imgstore(img); |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
641 | purple_imgstore_unref(img); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
642 | |
|
28516
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
643 | if (smiley_image != NULL) { |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
644 | if (gdk_pixbuf_get_width(smiley_image) > 22 || |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
645 | gdk_pixbuf_get_height(smiley_image) > 22) { |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
646 | sized_smiley = gdk_pixbuf_scale_simple(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
|
647 | 22, 22, GDK_INTERP_HYPER); |
|
28516
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
648 | g_object_unref(G_OBJECT(smiley_image)); |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
649 | } else { |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
650 | /* don't scale up smaller smileys, avoid blurryness */ |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
651 | sized_smiley = smiley_image; |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
652 | } |
|
6dd11f55d0ff
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <malu@pidgin.im>
parents:
27565
diff
changeset
|
653 | } |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
654 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
655 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
656 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
657 | gtk_list_store_append(smiley_manager->model, &iter); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
658 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
659 | gtk_list_store_set(smiley_manager->model, &iter, |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
660 | ICON, sized_smiley, |
|
22449
4fea5a505737
Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22447
diff
changeset
|
661 | SHORTCUT, purple_smiley_get_shortcut(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
|
662 | 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
|
663 | -1); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
664 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
665 | if (sized_smiley != NULL) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
666 | g_object_unref(G_OBJECT(sized_smiley)); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
667 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
668 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
669 | static void populate_smiley_list(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
|
670 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
671 | GList *list; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
672 | 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
|
673 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
674 | gtk_list_store_clear(dialog->model); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
675 | |
|
22450
422684486996
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22449
diff
changeset
|
676 | for(list = purple_smileys_get_all(); list != NULL; |
|
422684486996
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22449
diff
changeset
|
677 | list = g_list_delete_link(list, list)) { |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
678 | emoticon = (PurpleSmiley*)list->data; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
679 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
680 | store_smiley_add(emoticon); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
681 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
682 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
683 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
684 | static void smile_selected_cb(GtkTreeSelection *sel, 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
|
685 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
686 | gint selected; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
687 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
688 | selected = gtk_tree_selection_count_selected_rows(sel); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
689 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
690 | gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog->window), |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
691 | GTK_RESPONSE_NO, selected > 0); |
|
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
|
692 | |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
693 | gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog->window), |
|
25390
02100938b030
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <deryni@pidgin.im>
parents:
24847
diff
changeset
|
694 | PIDGIN_RESPONSE_MODIFY, selected > 0); |
|
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
|
695 | } |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
696 | |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
697 | static void |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
698 | smiley_edit_iter(SmileyManager *dialog, GtkTreeIter *iter) |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
699 | { |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
700 | PurpleSmiley *smiley = NULL; |
|
27565
7c84e6100256
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27500
diff
changeset
|
701 | GtkWidget *window = NULL; |
|
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
|
702 | gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), iter, SMILEY, &smiley, -1); |
|
27565
7c84e6100256
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27500
diff
changeset
|
703 | if ((window = g_object_get_data(G_OBJECT(smiley), "edit-dialog")) != NULL) |
|
7c84e6100256
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27500
diff
changeset
|
704 | gtk_window_present(GTK_WINDOW(window)); |
|
7c84e6100256
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27500
diff
changeset
|
705 | else |
|
7c84e6100256
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27500
diff
changeset
|
706 | pidgin_smiley_edit(gtk_widget_get_toplevel(GTK_WIDGET(dialog->treeview)), smiley); |
|
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
|
707 | 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
|
708 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
709 | |
|
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
|
710 | static void smiley_edit_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
711 | { |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
712 | GtkTreeIter iter; |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
713 | SmileyManager *dialog = data; |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
714 | |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
715 | gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path); |
|
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
|
716 | smiley_edit_iter(dialog, &iter); |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
717 | } |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
718 | |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
719 | static void |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
720 | edit_selected_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
721 | { |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
722 | smiley_edit_iter(data, iter); |
|
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
|
723 | } |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
724 | |
|
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
|
725 | 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
|
726 | smiley_got_url(PurpleUtilFetchUrlData *url_data, 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
|
727 | const gchar *smileydata, size_t len, const gchar *error_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
|
728 | { |
|
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
|
729 | SmileyManager *dialog = 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
|
730 | FILE *f; |
|
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
|
731 | gchar *path; |
|
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
|
732 | size_t wc; |
|
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
|
733 | 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
|
734 | GdkPixbuf *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
|
735 | |
|
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
|
736 | if ((error_message != NULL) || (len == 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
|
737 | 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
|
738 | } |
|
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
|
739 | |
|
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
|
740 | f = purple_mkstemp(&path, TRUE); |
|
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
|
741 | wc = fwrite(smileydata, len, 1, f); |
|
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
|
742 | if (wc != 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
|
743 | purple_debug_warning("smiley_got_url", "Unable to write smiley data.\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
|
744 | fclose(f); |
|
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
|
745 | g_unlink(path); |
|
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
|
746 | g_free(path); |
|
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
|
747 | 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
|
748 | } |
|
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
|
749 | fclose(f); |
|
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
|
750 | |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
751 | image = pidgin_pixbuf_new_from_file(path); |
|
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
|
752 | g_unlink(path); |
|
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
|
753 | g_free(path); |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
754 | 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
|
755 | 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
|
756 | |
|
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
|
757 | ps = pidgin_smiley_edit(dialog->window, 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
|
758 | 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
|
759 | 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
|
760 | } |
|
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
|
761 | |
|
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
|
762 | 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
|
763 | 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
|
764 | 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
|
765 | { |
|
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
|
766 | 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
|
767 | 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
|
768 | |
|
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
|
769 | 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
|
770 | && (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
|
771 | /* 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
|
772 | * 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
|
773 | |
|
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
|
774 | 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
|
775 | 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
|
776 | 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
|
777 | 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
|
778 | /* 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
|
779 | * 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
|
780 | 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
|
781 | 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
|
782 | (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
|
783 | "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
|
784 | 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
|
785 | } |
|
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
|
786 | ps = pidgin_smiley_edit(dialog->window, 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
|
787 | do_add_file_cb(tmp, 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
|
788 | 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
|
789 | 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
|
790 | g_free(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
|
791 | } else if (!g_ascii_strncasecmp(name, "http://", 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
|
792 | /* 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
|
793 | * will start to get interesting */ |
|
32596
927575c2af4e
* purple_util_fetch_url_request_len() renamed to purple_util_fetch_url_request().
Andrew Victor <andrew.victor@mxit.com>
parents:
31889
diff
changeset
|
794 | purple_util_fetch_url(name, TRUE, NULL, FALSE, -1, smiley_got_url, 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
|
795 | } else if (!g_ascii_strncasecmp(name, "https://", 8)) { |
|
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
|
796 | /* purple_util_fetch_url() doesn't support HTTPS */ |
|
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
|
797 | char *tmp = g_strdup(name + 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
|
798 | tmp[0] = 'h'; |
|
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
|
799 | tmp[1] = '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
|
800 | tmp[2] = '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
|
801 | tmp[3] = 'p'; |
|
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
|
802 | |
|
32596
927575c2af4e
* purple_util_fetch_url_request_len() renamed to purple_util_fetch_url_request().
Andrew Victor <andrew.victor@mxit.com>
parents:
31889
diff
changeset
|
803 | purple_util_fetch_url(tmp, TRUE, NULL, FALSE, -1, smiley_got_url, 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
|
804 | g_free(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
|
805 | } |
|
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
|
806 | |
|
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
|
807 | 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
|
808 | } |
|
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
|
809 | |
|
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
|
810 | 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
|
811 | } |
|
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
|
812 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
813 | static GtkWidget *smiley_list_create(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
|
814 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
815 | GtkWidget *treeview; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
816 | GtkTreeSelection *sel; |
|
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
|
817 | GtkTargetEntry te[3] = { |
|
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
|
818 | {"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
|
819 | {"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
|
820 | {"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
|
821 | }; |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
822 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
823 | /* Create the list model */ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
824 | dialog->model = gtk_list_store_new(N_COL, |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
825 | GDK_TYPE_PIXBUF, /* ICON */ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
826 | G_TYPE_STRING, /* SHORTCUT */ |
|
23013
18f4fad1f9af
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23009
diff
changeset
|
827 | G_TYPE_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
|
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 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
830 | /* the actual treeview */ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
831 | treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
832 | dialog->treeview = treeview; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
833 | gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
|
22899
df30ef921ee6
Fix a small leak. And sort the smileys alphabetically, as suggested by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22898
diff
changeset
|
834 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->model), SHORTCUT, GTK_SORT_ASCENDING); |
|
df30ef921ee6
Fix a small leak. And sort the smileys alphabetically, as suggested by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22898
diff
changeset
|
835 | g_object_unref(G_OBJECT(dialog->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
|
836 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
837 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
838 | 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
|
839 | |
|
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
|
840 | g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(smile_selected_cb), dialog); |
|
206c1f2a1fd7
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22655
diff
changeset
|
841 | g_signal_connect(G_OBJECT(treeview), "row_activated", G_CALLBACK(smiley_edit_cb), 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
|
842 | |
|
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
|
843 | gtk_drag_dest_set(treeview, |
|
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
|
844 | GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, |
|
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
|
845 | te, G_N_ELEMENTS(te), GDK_ACTION_COPY | GDK_ACTION_MOVE); |
|
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
|
846 | g_signal_connect(G_OBJECT(treeview), "drag_data_received", G_CALLBACK(smiley_dnd_recv), dialog); |
|
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
|
847 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
848 | gtk_widget_show(treeview); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
849 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
850 | add_columns(treeview, dialog); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
851 | populate_smiley_list(dialog); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
852 | |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30706
diff
changeset
|
853 | return pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, 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
|
854 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
855 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
856 | static void 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
|
857 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
858 | populate_smiley_list(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
|
859 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
860 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
861 | static void smiley_manager_select_cb(GtkWidget *widget, gint resp, 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
|
862 | { |
|
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
|
863 | GtkTreeSelection *selection = NULL; |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
864 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
865 | 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
|
866 | case GTK_RESPONSE_YES: |
|
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
|
867 | pidgin_smiley_edit(dialog->window, 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
|
868 | break; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
869 | case GTK_RESPONSE_NO: |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
870 | smiley_delete(dialog); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
871 | break; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
872 | 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
|
873 | case GTK_RESPONSE_CLOSE: |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
874 | gtk_widget_destroy(dialog->window); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
875 | g_free(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
|
876 | 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
|
877 | 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
|
878 | case PIDGIN_RESPONSE_MODIFY: |
|
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
|
879 | /* Find smiley of selection... */ |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
880 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
881 | gtk_tree_selection_selected_foreach(selection, edit_selected_cb, dialog); |
|
9ff3135a6478
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23017
diff
changeset
|
882 | 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
|
883 | default: |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
884 | purple_debug_info("gtksmiley", "No valid selection\n"); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
885 | break; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
886 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
887 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
888 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
889 | void pidgin_smiley_manager_show(void) |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
890 | { |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
891 | 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
|
892 | GtkWidget *win; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
893 | GtkWidget *sw; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
894 | GtkWidget *vbox; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
895 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
896 | 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
|
897 | 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
|
898 | return; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
899 | } |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
900 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
901 | dialog = g_new0(SmileyManager, 1); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
902 | smiley_manager = dialog; |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
903 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
904 | dialog->window = win = gtk_dialog_new_with_buttons( |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
905 | _("Custom 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
|
906 | NULL, |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
907 | GTK_DIALOG_DESTROY_WITH_PARENT, |
|
25877
b517280d5c11
Use PIDGIN_STOCK_ADD instead of GTK_STOCK_ADD so that the add button
Mark Doliner <markdoliner@pidgin.im>
parents:
25876
diff
changeset
|
908 | PIDGIN_STOCK_ADD, GTK_RESPONSE_YES, |
|
25390
02100938b030
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <deryni@pidgin.im>
parents:
24847
diff
changeset
|
909 | PIDGIN_STOCK_MODIFY, PIDGIN_RESPONSE_MODIFY, |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
910 | GTK_STOCK_DELETE, GTK_RESPONSE_NO, |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
911 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
912 | NULL); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
913 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
914 | 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
|
915 | 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
|
916 | #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
|
917 | 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
|
918 | #endif |
|
23017
82f6abec236d
Some little usability changes in the custom smiley dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23013
diff
changeset
|
919 | gtk_dialog_set_response_sensitive(GTK_DIALOG(win), GTK_RESPONSE_NO, FALSE); |
|
25390
02100938b030
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <deryni@pidgin.im>
parents:
24847
diff
changeset
|
920 | gtk_dialog_set_response_sensitive(GTK_DIALOG(win), |
|
02100938b030
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <deryni@pidgin.im>
parents:
24847
diff
changeset
|
921 | 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
|
922 | |
|
22443
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
923 | g_signal_connect(win, "response", G_CALLBACK(smiley_manager_select_cb), |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
924 | dialog); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
925 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
926 | /* The vbox */ |
|
33137
54bb150d745a
Remove the extra vbox in the smiley list, which doesn't seem to do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33120
diff
changeset
|
927 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(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
|
928 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
929 | /* get the scrolled window with all stuff */ |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
930 | sw = smiley_list_create(dialog); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
931 | 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
|
932 | 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
|
933 | |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
934 | gtk_widget_show(win); |
|
7b8772af6bb7
Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
935 | } |
|
33137
54bb150d745a
Remove the extra vbox in the smiley list, which doesn't seem to do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33120
diff
changeset
|
936 |