pidgin/gtksmiley.c

Sun, 07 Jun 2009 00:16:05 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Sun, 07 Jun 2009 00:16:05 +0000
changeset 27277
8a2ecbdd70e4
parent 27259
50ab3ce89cdb
child 27498
67b5d40e47c8
permissions
-rw-r--r--

Various roster cleanups. Refs #7008.

I haven't tested it, but this may resolve the grouping/case problem (strcmp => purple_utf8_strcasecmp)

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"
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
30
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
31 #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
32 #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
33 #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
34
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
35 #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
36 #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
37 #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
38 #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
39
25390
02100938b030 Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <deryni@pidgin.im>
parents: 24847
diff changeset
40 #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
41
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
42 struct _PidginSmiley
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
43 {
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
44 PurpleSmiley *smiley;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
45 GtkWidget *parent;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46 GtkWidget *smile;
22898
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
47 GtkWidget *smiley_image;
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
48 gchar *filename;
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
49 GdkPixbuf *custom_pixbuf;
27259
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
50 gpointer data; /** @since 2.6.0 */
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
51 gsize datasize; /** @since 2.6.0 */
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 };
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
53
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
54 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
55 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
56 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
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 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
59 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
60 } SmileyManager;
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 enum
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
63 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
64 ICON,
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
65 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
66 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
67 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
68 };
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
69
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
70 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
71 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
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 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
74 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
75 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
76 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
77 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
78 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
79 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
80 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
81 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
82
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
83 /******************************************************************************
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
84 * 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
85 *****************************************************************************/
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
86 /* 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
87 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
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 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
90
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
91 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
92 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
93
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
94 static void
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
95 shortcut_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley)
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
96 {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
97 g_free(gtksmiley->smile);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
98 gtksmiley->smile = g_strdup(purple_smiley_get_shortcut(smiley));
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
99 }
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
100
23375
7381f18647da Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23321
diff changeset
101 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
102 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
103 {
7381f18647da Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23321
diff changeset
104 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
105
7381f18647da Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23321
diff changeset
106 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
107
7381f18647da Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23321
diff changeset
108 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
109 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
110 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
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
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
113 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
114 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
115 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
116 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
117 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
118
22449
4fea5a505737 Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22447
diff changeset
119 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
120
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
121 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
122
22655
718f1149a81c Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22452
diff changeset
123 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
124 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
125 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
126
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
127 /* 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
128 g_signal_connect(G_OBJECT(smiley), "notify::shortcut",
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
129 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
130
23375
7381f18647da Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23321
diff changeset
131 /* 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
132 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
133 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
134
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
135 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
136 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
137
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
138 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
139 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
140 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
141 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
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 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
144 return;
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 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
147
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
148 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
149 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
150
22449
4fea5a505737 Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22447
diff changeset
151 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
152 continue;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
153
22655
718f1149a81c Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22452
diff changeset
154 gtk_imhtml_smiley_destroy(gtksmiley);
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
155 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
156 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
157 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
158 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
159
22447
ad500e991f0d Make sure deleting one smiley doesn't accidentally delete a few others.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22443
diff changeset
160 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
161 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
162 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
163
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
164 void pidgin_smiley_add_to_list(PurpleSmiley *smiley)
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
165 {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
166 GtkIMHtmlSmiley *gtksmiley;
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
167
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
168 gtksmiley = smiley_purple_to_gtkimhtml(smiley);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
169 add_gtkimhtml_to_list(gtksmiley);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
170 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
171 }
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
172
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
173 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
174 {
22450
422684486996 Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22449
diff changeset
175 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
176 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
177
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
178 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
179 return;
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 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
182
22450
422684486996 Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22449
diff changeset
183 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
184 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
185
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
186 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
187 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
188 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
189
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
190 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
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 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
193 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
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 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
196
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
197 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
198 return;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
199
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
200 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
201 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
202 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
203 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
204
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
205 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
206 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
207
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
208 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
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 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
211 }
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 * 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
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
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
217 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
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 * 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
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 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
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 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
226 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
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 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
229 if (!entry || !*entry) {
25879
c062ffc658b8 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 25878
diff changeset
230 /*
c062ffc658b8 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 25878
diff changeset
231 * TODO: We should enable/disable the add button based on
c062ffc658b8 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 25878
diff changeset
232 * whether the user has entered all required data. That
c062ffc658b8 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 25878
diff changeset
233 * would eliminate the need for this check and provide a
c062ffc658b8 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 25878
diff changeset
234 * better user experience.
c062ffc658b8 Add a comment
Mark Doliner <markdoliner@pidgin.im>
parents: 25878
diff changeset
235 */
24155
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
236 purple_notify_error(s->parent, _("Custom Smiley"),
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
237 _("More Data needed"),
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
238 _("Please provide a shortcut to associate with the smiley."));
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
239 return;
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
240 }
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
241
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
242 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
243 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
244 gchar *msg;
d6ef15a065c6 Use the shortcut in the error message to give people more context
Mark Doliner <markdoliner@pidgin.im>
parents: 25877
diff changeset
245 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
246 "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
247 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
248 _("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
249 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
250 return;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
251 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
252
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
253 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
254 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
255 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
256 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
257 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
258
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 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
260 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
261 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
262 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
263
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
264 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
265 }
23321
0dd2eca2a054 Always store custom smileys with hashed filenames. Closes #5913.
Marcus Lundblad <malu@pidgin.im>
parents: 23304
diff changeset
266 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
267 }
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
268 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
269 } else {
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
270 if ((s->filename == NULL && s->custom_pixbuf == NULL)
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
271 || *entry == 0) {
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
272 purple_notify_error(s->parent, _("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
273 _("More Data needed"),
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
274 s->filename ? _("Please provide a shortcut to associate with the 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
275 : _("Please select an image for the 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
276 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
277 }
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
278
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
279 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
280
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
281 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
282 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
283 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
284 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
285 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
286
24847
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
287 /* 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
288 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
289 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
290 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
291 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
292
24847
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
293 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
294 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
295 "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
296 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
297 }
6f803850c88b When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <malu@pidgin.im>
parents: 24254
diff changeset
298 }
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
299
27259
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
300 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
301 /* 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
302 buffer = s->data;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
303 size = s->datasize;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
304 }
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
305 else {
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
306 /* 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
307 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
308 "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
309 }
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
310 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
311 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
312 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
313 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
314 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
315 }
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
316 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
317 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
318 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
319 }
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
320
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
321 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
322 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
323
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
324 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
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 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
328 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
329 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
330 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
331 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
332 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
333 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
334 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
335 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
336 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
337 default:
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
338 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
339 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
340 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
341 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
342
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
343 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
344 {
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
345 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
346 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
347
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 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
349 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
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 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
352 s->filename = g_strdup(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
353 pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, 64, 64, FALSE, 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
354 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
355 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
356 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
357 gtk_widget_grab_focus(s->smile);
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
358 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
359
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
360 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
361 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
362 {
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
363 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
364 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
365 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
366 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
367 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
368 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
369 }
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
370
23304
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
371 PidginSmiley *
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
372 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
373 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
374 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
375 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
376 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
377 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
378 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
379 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
380 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
381
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
382 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
383 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
384
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
385 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
386 widget ? GTK_WINDOW(widget) : 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
387 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
24155
0747d1bba8a7 Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24102
diff changeset
388 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
389 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
390 NULL);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
391 s->parent = window;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
392
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
393 gtk_container_set_border_width(GTK_CONTAINER(window), 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
394
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
395 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
396
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
397 /* The vbox */
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
398 vbox = gtk_vbox_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
399 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), vbox);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
400 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
401
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
402 /* The hbox */
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
403 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
404 gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)), hbox);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
405
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
406 label = gtk_label_new_with_mnemonic(_("_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
407 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
408 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
409
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
410 filech = gtk_button_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
411 gtk_box_pack_end(GTK_BOX(hbox), filech, FALSE, FALSE, 0);
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
412 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
413
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
414 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
415 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
416 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
417 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
418 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
419 } 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
420 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
421 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
422 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
423 }
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
424
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
425 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
426 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
427 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
428 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
429
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
430 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
431
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
432 /* info */
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
433 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
434 gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)),hbox);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
435
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
436 /* Shortcut text */
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
437 label = gtk_label_new_with_mnemonic(_("S_hortcut 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
438 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
439 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
440
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
441 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
442 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
443 pidgin_set_accessible_label(s->smile, label);
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
444 if (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
445 gtk_entry_set_text(GTK_ENTRY(s->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
446
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
447 g_signal_connect(s->smile, "activate", G_CALLBACK(do_add), s);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
448
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
449 gtk_box_pack_end(GTK_BOX(hbox), s->smile, FALSE, FALSE, 0);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
450 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
451
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
452 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
453
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
454 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
455 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
456 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
457
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
458 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
459 }
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
460
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
461 void
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
462 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
463 {
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
464 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
465 }
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
466
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
467 void
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
468 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
469 {
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
470 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
471 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
472 editor->custom_pixbuf = image ? g_object_ref(G_OBJECT(image)) : 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
473 if (image)
3aba02105818 Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23020
diff changeset
474 gtk_image_set_from_pixbuf(GTK_IMAGE(editor->smiley_image), 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
475 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
476
27259
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
477 void
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
478 pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer *data, gsize datasize)
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
479 {
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
480 editor->data = data;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
481 editor->datasize = datasize;
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
482 }
50ab3ce89cdb Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents: 26828
diff changeset
483
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
484 /******************************************************************************
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
485 * Delete smiley
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
486 *****************************************************************************/
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
487 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
488 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
489 {
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
490 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
491 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
492
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
493 dialog = (SmileyManager*)data;
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 gtk_tree_model_get(model, iter,
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
496 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
497 -1);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
498
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
499 if(smiley != NULL) {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
500 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
501 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
502 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
503 }
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
504 }
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
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
506 static void append_to_list(GtkTreeModel *model, GtkTreePath *path,
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
507 GtkTreeIter *iter, gpointer data)
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
508 {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
509 GList **list = data;
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
510 *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
511 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
512
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
513 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
514 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
515 GtkTreeSelection *selection;
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
516 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
517
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
518 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
519 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
520 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
521
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
522 while (list) {
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
523 GtkTreeIter iter;
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
524 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
525 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
526 gtk_tree_path_free(list->data);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
527 list = g_list_delete_link(list, list);
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
528 }
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
529 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
530 /******************************************************************************
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
531 * 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
532 *****************************************************************************/
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
533 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
534 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
535 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
536 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
537
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
538 /* Icon */
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
539 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
540 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
541 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
542 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
543
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
544 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
545 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
546 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
547
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25390
diff changeset
548 /* 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
549 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
550 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
551 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
552 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
553
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
554 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
555 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
556 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
557 }
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 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
560 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
561 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
562 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
563 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
564
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
565 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
566 return;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
567
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
568 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
569
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
570 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
571 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
572 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
573
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
574 if (smiley_image != NULL)
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
575 sized_smiley = gdk_pixbuf_scale_simple(smiley_image,
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
576 22, 22, GDK_INTERP_HYPER);
23009
0bac25fdc9aa Unref some gdkpixbufs to plug some memory leaks. References #1187.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22899
diff changeset
577 g_object_unref(G_OBJECT(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
578 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
579
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 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
582
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
583 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
584 ICON, sized_smiley,
22449
4fea5a505737 Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22447
diff changeset
585 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
586 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
587 -1);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
588
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
589 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
590 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
591 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
592
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
593 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
594 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
595 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
596 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
597
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
598 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
599
22450
422684486996 Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22449
diff changeset
600 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
601 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
602 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
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 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
605 }
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
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
608 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
609 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
610 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
611
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
612 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
613
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_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
615 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
616
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
617 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
618 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
619 }
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
620
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
621 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
622 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
623 {
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
624 PurpleSmiley *smiley = 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
625 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), iter, SMILEY, &smiley, -1);
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
626 pidgin_smiley_edit(gtk_widget_get_toplevel(GTK_WIDGET(dialog->treeview)), smiley);
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
627 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
628 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
629
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
630 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
631 {
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
632 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
633 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
634
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
635 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
636 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
637 }
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
638
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
639 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
640 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
641 {
9ff3135a6478 Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23017
diff changeset
642 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
643 }
206c1f2a1fd7 Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22655
diff changeset
644
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
645 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
646 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
647 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
648 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
649 GtkTreeSelection *sel;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
650
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
651 sw = gtk_scrolled_window_new(NULL, NULL);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
652 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
653 GTK_POLICY_AUTOMATIC,
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
654 GTK_POLICY_AUTOMATIC);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
655 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
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
656 GTK_SHADOW_IN);
22443
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_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
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 /* 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
660 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
661 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
662 G_TYPE_STRING, /* SHORTCUT */
23013
18f4fad1f9af Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23009
diff changeset
663 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
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
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
666 /* 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
667 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
668 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
669 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
670 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
671 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
672
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
673 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
674 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
675 gtk_container_add(GTK_CONTAINER(sw), treeview);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
676
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
677 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
678 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
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 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
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 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
683 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
684
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
685 return sw;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
686 }
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 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
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 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
691 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
692
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
693 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
694 {
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 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
696
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
697 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
698 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
699 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
700 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
701 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
702 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
703 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
704 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
705 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
706 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
707 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
708 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
709 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
710 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
711 /* 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
712 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
713 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
714 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
715 default:
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
716 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
717 break;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
718 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
719 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
720
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
721 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
722 {
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
723 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
724 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
725 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
726 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
727
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
728 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
729 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
730 return;
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
731 }
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
732
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
733 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
734 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
735
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
736 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
737 _("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
738 NULL,
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
739 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
740 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
741 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
742 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
743 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
744 NULL);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
745
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
746 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
747 gtk_window_set_role(GTK_WINDOW(win), "custom_smiley_manager");
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
748 gtk_container_set_border_width(GTK_CONTAINER(win),PIDGIN_HIG_BORDER);
23017
82f6abec236d Some little usability changes in the custom smiley dialog.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23013
diff changeset
749 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
750 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
751 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
752
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
753 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
754 dialog);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
755
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
756 /* The vbox */
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
757 vbox = gtk_vbox_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
758 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(win)->vbox), vbox);
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
759 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
760
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
761 /* 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
762 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
763 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
764 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
765
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge Villaseño (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
766 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
767 }

mercurial