Mercurial > pidgin.yaz
annotate pidgin/gtksmiley.c @ 31359:1b67c62c1051
Fix a bug where if we used fetch url with include_headers=FALSE and
then read() happens to read in the headers, the trailing \r\n\r\n and
then one byte of the body (but no more) then we accidentally dropped
the one byte off the start of the body.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 10 Nov 2010 23:41:53 +0000 |
parents | 351d07aefb09 |
children | 917c597beb97 |
rev | line source |
---|---|
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /** |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 * @file gtksmiley.c GTK+ Smiley Manager API |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 * @ingroup pidgin |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 /* |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 * pidgin |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 * |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 * Pidgin is the legal property of its developers, whose names are too numerous |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 * to list here. Please refer to the COPYRIGHT file distributed with this |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 * source distribution. |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 * |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 * This program is free software; you can redistribute it and/or modify |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 * it under the terms of the GNU General Public License as published by |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 * the Free Software Foundation; either version 2 of the License, or |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 * (at your option) any later version. |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 * |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 * This program is distributed in the hope that it will be useful, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 * GNU General Public License for more details. |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 * |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 * You should have received a copy of the GNU General Public License |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 * along with this program; if not, write to the Free Software |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 #include "internal.h" |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #include "pidgin.h" |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include "debug.h" |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 #include "notify.h" |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 #include "smiley.h" |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 #include "gtkimhtml.h" |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 #include "gtksmiley.h" |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
37 #include "gtkutils.h" |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
38 #include "pidginstock.h" |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
24919
fe5179d40a51
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <pidgin@unreliablesource.net>
parents:
24529
diff
changeset
|
40 #define PIDGIN_RESPONSE_MODIFY 1000 |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
41 |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
42 struct _PidginSmiley |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 { |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
44 PurpleSmiley *smiley; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 GtkWidget *parent; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 GtkWidget *smile; |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
47 GtkWidget *smiley_image; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 gchar *filename; |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
49 GdkPixbuf *custom_pixbuf; |
27120
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
50 gpointer data; /** @since 2.6.0 */ |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
51 gsize datasize; /** @since 2.6.0 */ |
27314
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
52 gint entry_len; /** @since 2.6.0 */ |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
53 }; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 typedef struct |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 GtkWidget *window; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 GtkWidget *treeview; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 GtkListStore *model; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 } SmileyManager; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 enum |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 ICON, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 SHORTCUT, |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
67 SMILEY, |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 N_COL |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 }; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 static SmileyManager *smiley_manager = NULL; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 static GSList *gtk_smileys = NULL; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 static void |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 pidgin_smiley_destroy(PidginSmiley *smiley) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 { |
29382
b066ad9bbcc3
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29381
diff
changeset
|
77 if (smiley->smiley) |
b066ad9bbcc3
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29381
diff
changeset
|
78 g_object_set_data(G_OBJECT(smiley->smiley), "edit-dialog", NULL); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 gtk_widget_destroy(smiley->parent); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 g_free(smiley->filename); |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
81 if (smiley->custom_pixbuf) |
26705
a3f7ade9e45b
Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25406
diff
changeset
|
82 g_object_unref(G_OBJECT(smiley->custom_pixbuf)); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 g_free(smiley); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 /****************************************************************************** |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 * GtkIMHtmlSmileys stuff |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 *****************************************************************************/ |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
89 /* Perhaps these should be in gtkimhtml.c instead. -- sadrul */ |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 static void add_gtkimhtml_to_list(GtkIMHtmlSmiley *gtksmiley) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 gtk_smileys = g_slist_prepend(gtk_smileys, gtksmiley); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 purple_debug_info("gtksmiley", "adding %s to gtk_smileys\n", gtksmiley->smile); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
97 static void |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
98 shortcut_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley) |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
99 { |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
100 g_free(gtksmiley->smile); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
101 gtksmiley->smile = g_strdup(purple_smiley_get_shortcut(smiley)); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
102 } |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
103 |
23235
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
104 static void |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
105 image_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley) |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
106 { |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
107 const char *file; |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
108 |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
109 g_free(gtksmiley->file); |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
110 |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
111 file = purple_imgstore_get_filename(purple_smiley_get_stored_image(smiley)); |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
112 gtksmiley->file = g_build_filename(purple_smileys_get_storing_dir(), file, NULL); |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
113 gtk_imhtml_smiley_reload(gtksmiley); |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
114 } |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
115 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 static GtkIMHtmlSmiley *smiley_purple_to_gtkimhtml(PurpleSmiley *smiley) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 GtkIMHtmlSmiley *gtksmiley; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 gchar *filename; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 const gchar *file; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 |
22880
2ab289f312d0
Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22878
diff
changeset
|
122 file = purple_imgstore_get_filename(purple_smiley_get_stored_image(smiley)); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
124 filename = g_build_filename(purple_smileys_get_storing_dir(), file, NULL); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 |
22889
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22883
diff
changeset
|
126 gtksmiley = gtk_imhtml_smiley_create(filename, purple_smiley_get_shortcut(smiley), |
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22883
diff
changeset
|
127 FALSE, GTK_IMHTML_SMILEY_CUSTOM); |
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22883
diff
changeset
|
128 g_free(filename); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
130 /* Make sure the shortcut for the GtkIMHtmlSmiley is updated with the PurpleSmiley */ |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
131 g_signal_connect(G_OBJECT(smiley), "notify::shortcut", |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
132 G_CALLBACK(shortcut_changed_cb), gtksmiley); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 |
23235
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
134 /* And update the pixbuf too when the image is changed */ |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
135 g_signal_connect(G_OBJECT(smiley), "notify::image", |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
136 G_CALLBACK(image_changed_cb), gtksmiley); |
bfbd2b038135
Update the smiley in the smiley dialog if the imagefile is changed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23185
diff
changeset
|
137 |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
138 return gtksmiley; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 void pidgin_smiley_del_from_list(PurpleSmiley *smiley) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 GSList *list = NULL; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 GtkIMHtmlSmiley *gtksmiley; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 if (gtk_smileys == NULL) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 return; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 list = gtk_smileys; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 for (; list; list = list->next) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 gtksmiley = (GtkIMHtmlSmiley*)list->data; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 |
22880
2ab289f312d0
Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22878
diff
changeset
|
154 if (strcmp(gtksmiley->smile, purple_smiley_get_shortcut(smiley))) |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 continue; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 |
22889
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22883
diff
changeset
|
157 gtk_imhtml_smiley_destroy(gtksmiley); |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
158 g_signal_handlers_disconnect_matched(G_OBJECT(smiley), G_SIGNAL_MATCH_DATA, |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
159 0, 0, NULL, NULL, gtksmiley); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 break; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 |
22878
db31bbdf355b
Make sure deleting one smiley doesn't accidentally delete a few others.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22874
diff
changeset
|
163 if (list) |
db31bbdf355b
Make sure deleting one smiley doesn't accidentally delete a few others.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22874
diff
changeset
|
164 gtk_smileys = g_slist_delete_link(gtk_smileys, list); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
167 void pidgin_smiley_add_to_list(PurpleSmiley *smiley) |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
168 { |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
169 GtkIMHtmlSmiley *gtksmiley; |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
170 |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
171 gtksmiley = smiley_purple_to_gtkimhtml(smiley); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
172 add_gtkimhtml_to_list(gtksmiley); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
173 g_signal_connect(G_OBJECT(smiley), "destroy", G_CALLBACK(pidgin_smiley_del_from_list), NULL); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
174 } |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
175 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 void pidgin_smileys_init(void) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 { |
22881
d1bcb54920f8
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22880
diff
changeset
|
178 GList *smileys; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 PurpleSmiley *smiley; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 if (gtk_smileys != NULL) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 return; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 |
22881
d1bcb54920f8
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22880
diff
changeset
|
184 smileys = purple_smileys_get_all(); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 |
22881
d1bcb54920f8
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22880
diff
changeset
|
186 for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { |
d1bcb54920f8
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22880
diff
changeset
|
187 smiley = (PurpleSmiley*)smileys->data; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 pidgin_smiley_add_to_list(smiley); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 void pidgin_smileys_uninit(void) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 GSList *list; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 GtkIMHtmlSmiley *gtksmiley; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 list = gtk_smileys; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 if (list == NULL) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 return; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 for (; list; list = g_slist_delete_link(list, list)) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 gtksmiley = (GtkIMHtmlSmiley*)list->data; |
22889
019052a807a3
Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22883
diff
changeset
|
205 gtk_imhtml_smiley_destroy(gtksmiley); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 gtk_smileys = NULL; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 GSList *pidgin_smileys_get_all(void) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 return gtk_smileys; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 /****************************************************************************** |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 * Manager stuff |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
218 *****************************************************************************/ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 static void refresh_list(void); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 /****************************************************************************** |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 * The Add dialog |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 ******************************************************************************/ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 static void do_add(GtkWidget *widget, PidginSmiley *s) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 const gchar *entry; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 PurpleSmiley *emoticon; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 entry = gtk_entry_get_text(GTK_ENTRY(s->smile)); |
23889
64a4069e504e
Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23832
diff
changeset
|
232 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
233 emoticon = purple_smileys_find_by_shortcut(entry); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
234 if (emoticon && emoticon != s->smiley) { |
25405
97ae9f8b63ab
Use the shortcut in the error message to give people more context
Mark Doliner <mark@kingant.net>
parents:
25404
diff
changeset
|
235 gchar *msg; |
97ae9f8b63ab
Use the shortcut in the error message to give people more context
Mark Doliner <mark@kingant.net>
parents:
25404
diff
changeset
|
236 msg = g_strdup_printf(_("A custom smiley for '%s' already exists. " |
97ae9f8b63ab
Use the shortcut in the error message to give people more context
Mark Doliner <mark@kingant.net>
parents:
25404
diff
changeset
|
237 "Please use a different shortcut."), entry); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
238 purple_notify_error(s->parent, _("Custom Smiley"), |
25405
97ae9f8b63ab
Use the shortcut in the error message to give people more context
Mark Doliner <mark@kingant.net>
parents:
25404
diff
changeset
|
239 _("Duplicate Shortcut"), msg); |
97ae9f8b63ab
Use the shortcut in the error message to give people more context
Mark Doliner <mark@kingant.net>
parents:
25404
diff
changeset
|
240 g_free(msg); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 return; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
242 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
243 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
244 if (s->smiley) { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
245 if (s->filename) { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
246 gchar *data = NULL; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
247 size_t len; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
248 GError *err = NULL; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
249 |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
250 if (!g_file_get_contents(s->filename, &data, &len, &err)) { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
251 purple_debug_error("gtksmiley", "Error reading %s: %s\n", |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
252 s->filename, err->message); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
253 g_error_free(err); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
254 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
255 return; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
256 } |
23185
013ec6fabd3f
Always store custom smileys with hashed filenames. Closes #5913.
Marcus Lundblad <ml@update.uu.se>
parents:
23163
diff
changeset
|
257 purple_smiley_set_data(s->smiley, (guchar*)data, len); |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
258 } |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
259 purple_smiley_set_shortcut(s->smiley, entry); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
260 } else { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
261 purple_debug_info("gtksmiley", "adding a new smiley\n"); |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
262 |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
263 if (s->filename == NULL) { |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
264 gchar *buffer = NULL; |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
265 gsize size = 0; |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
266 gchar *filename; |
24529
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
267 const gchar *dirname = purple_smileys_get_storing_dir(); |
25403
f62c5b302b91
Try to improve the wording in our custom smiley manager
Mark Doliner <mark@kingant.net>
parents:
24919
diff
changeset
|
268 |
24529
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
269 /* since this may be called before purple_smiley_new_* has ever been |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
270 called, we create the storing dir, if it doesn't exist yet, to be |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
271 able to save the pixbuf before adding the smiley */ |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
272 if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) { |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
273 purple_debug_info("gtksmiley", "Creating smileys directory.\n"); |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
274 |
24529
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
275 if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) { |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
276 purple_debug_error("gtksmiley", |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
277 "Unable to create directory %s: %s\n", |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
278 dirname, g_strerror(errno)); |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
279 } |
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
280 } |
25403
f62c5b302b91
Try to improve the wording in our custom smiley manager
Mark Doliner <mark@kingant.net>
parents:
24919
diff
changeset
|
281 |
27120
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
282 if (s->data && s->datasize) { |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
283 /* Cached data & size in memory */ |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
284 buffer = s->data; |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
285 size = s->datasize; |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
286 } |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
287 else { |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
288 /* Get the smiley from the custom pixbuf */ |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
289 gdk_pixbuf_save_to_buffer(s->custom_pixbuf, &buffer, &size, |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
290 "png", NULL, "compression", "9", NULL, NULL); |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
291 } |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
292 filename = purple_util_get_image_filename(buffer, size); |
24529
c31be282935d
When adding custom smiley without a previous filename (which is the case when
Marcus Lundblad <ml@update.uu.se>
parents:
23988
diff
changeset
|
293 s->filename = g_build_filename(dirname, filename, NULL); |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
294 purple_util_write_data_to_file_absolute(s->filename, buffer, size); |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
295 g_free(filename); |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
296 g_free(buffer); |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
297 } |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
298 emoticon = purple_smiley_new_from_file(entry, s->filename); |
23682
21e591b55339
at least don't crash when we can't read whatever we are reading
Ka-Hing Cheung <khc@hxbc.us>
parents:
23235
diff
changeset
|
299 if (emoticon) |
21e591b55339
at least don't crash when we can't read whatever we are reading
Ka-Hing Cheung <khc@hxbc.us>
parents:
23235
diff
changeset
|
300 pidgin_smiley_add_to_list(emoticon); |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
301 } |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 if (smiley_manager != NULL) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 refresh_list(); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 gtk_widget_destroy(s->parent); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 static void do_add_select_cb(GtkWidget *widget, gint resp, PidginSmiley *s) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 switch (resp) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
312 case GTK_RESPONSE_ACCEPT: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 do_add(widget, s); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 break; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 case GTK_RESPONSE_DELETE_EVENT: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 case GTK_RESPONSE_CANCEL: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
317 gtk_widget_destroy(s->parent); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
318 break; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 default: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 purple_debug_error("gtksmiley", "no valid response\n"); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 break; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
325 static void do_add_file_cb(const char *filename, gpointer data) |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 { |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
327 PidginSmiley *s = data; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
328 GdkPixbuf *pixbuf; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
329 |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
330 if (!filename) |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
331 return; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
332 |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
333 g_free(s->filename); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
334 s->filename = g_strdup(filename); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
335 pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, 64, 64, FALSE, NULL); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
336 gtk_image_set_from_pixbuf(GTK_IMAGE(s->smiley_image), pixbuf); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
337 if (pixbuf) |
26712
38a5df43d525
Oops, I must have been tired. I only replaced the first occurrence of these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26705
diff
changeset
|
338 g_object_unref(G_OBJECT(pixbuf)); |
23140
b37b9e53a31b
Some little usability changes in the custom smiley dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23136
diff
changeset
|
339 gtk_widget_grab_focus(s->smile); |
27314
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
340 |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
341 if (s->entry_len > 0) |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
342 gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, TRUE); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
345 static void |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
346 open_image_selector(GtkWidget *widget, PidginSmiley *psmiley) |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
347 { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
348 GtkWidget *file_chooser; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
349 file_chooser = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(widget)), |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
350 do_add_file_cb, psmiley); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
351 gtk_window_set_title(GTK_WINDOW(file_chooser), _("Custom Smiley")); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
352 gtk_window_set_role(GTK_WINDOW(file_chooser), "file-selector-custom-smiley"); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
353 gtk_widget_show_all(file_chooser); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
354 } |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
355 |
27314
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
356 static void |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
357 smiley_name_insert_cb(GtkEditable *editable, |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
358 gchar *new_text, |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
359 gint new_text_length, |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
360 gint *position, |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
361 gpointer user_data) |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
362 { |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
363 PidginSmiley *s = user_data; |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
364 if (new_text_length != -1) |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
365 s->entry_len += new_text_length; |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
366 else |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
367 s->entry_len += strlen(new_text); |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
368 |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
369 if (s->filename != NULL || s->custom_pixbuf != NULL || s->smiley != NULL) |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
370 gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, TRUE); |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
371 } |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
372 |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
373 static void |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
374 smiley_name_delete_cb(GtkEditable *editable, |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
375 gint start_pos, |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
376 gint end_pos, |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
377 gpointer user_data) |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
378 { |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
379 PidginSmiley *s = user_data; |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
380 s->entry_len -= end_pos - start_pos; |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
381 |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
382 if (s->entry_len <= 0) |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
383 gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, FALSE); |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
384 } |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
385 |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
386 PidginSmiley * |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
387 pidgin_smiley_edit(GtkWidget *widget, PurpleSmiley *smiley) |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
389 GtkWidget *vbox; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 GtkWidget *hbox; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
391 GtkWidget *label; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 GtkWidget *filech; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 GtkWidget *window; |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
394 GdkPixbuf *pixbuf = NULL; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
395 PurpleStoredImage *stored_img; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 PidginSmiley *s = g_new0(PidginSmiley, 1); |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
398 s->smiley = smiley; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
400 window = gtk_dialog_new_with_buttons(smiley ? _("Edit Smiley") : _("Add Smiley"), |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
401 widget ? GTK_WINDOW(widget) : NULL, |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, |
23889
64a4069e504e
Do not allow setting empty shortcut for a custom smiley.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23832
diff
changeset
|
403 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
404 smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 NULL); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 s->parent = window; |
29382
b066ad9bbcc3
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29381
diff
changeset
|
407 if (smiley) |
b066ad9bbcc3
Don't try to save the edit dialog pointer to a NULL PurpleSmiley (aka, when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29381
diff
changeset
|
408 g_object_set_data(G_OBJECT(smiley), "edit-dialog", window); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
409 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
411 |
27315
0af18d18de0d
Set the correct default response in the smiley edit window so it gets the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
412 gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 g_signal_connect(window, "response", G_CALLBACK(do_add_select_cb), s); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 /* The vbox */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
416 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
417 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), vbox); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
418 gtk_widget_show(vbox); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
419 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
420 /* The hbox */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
421 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
422 gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)), hbox); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
423 |
25403
f62c5b302b91
Try to improve the wording in our custom smiley manager
Mark Doliner <mark@kingant.net>
parents:
24919
diff
changeset
|
424 label = gtk_label_new_with_mnemonic(_("_Image:")); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
425 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
426 gtk_widget_show(label); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
427 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
428 filech = gtk_button_new(); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
429 gtk_box_pack_end(GTK_BOX(hbox), filech, FALSE, FALSE, 0); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
430 pidgin_set_accessible_label(filech, label); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
431 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
432 s->smiley_image = gtk_image_new(); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
433 gtk_container_add(GTK_CONTAINER(filech), s->smiley_image); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
434 if (smiley && (stored_img = purple_smiley_get_stored_image(smiley))) { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
435 pixbuf = pidgin_pixbuf_from_imgstore(stored_img); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
436 purple_imgstore_unref(stored_img); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
437 } else { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
438 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
439 pixbuf = gtk_widget_render_icon(window, PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
440 icon_size, "PidginSmiley"); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
441 } |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
442 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
443 gtk_image_set_from_pixbuf(GTK_IMAGE(s->smiley_image), pixbuf); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
444 if (pixbuf != NULL) |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
445 g_object_unref(G_OBJECT(pixbuf)); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
446 g_signal_connect(G_OBJECT(filech), "clicked", G_CALLBACK(open_image_selector), s); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
447 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
448 gtk_widget_show_all(hbox); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
449 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
450 /* info */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
451 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
452 gtk_container_add(GTK_CONTAINER(GTK_VBOX(vbox)),hbox); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
453 |
25403
f62c5b302b91
Try to improve the wording in our custom smiley manager
Mark Doliner <mark@kingant.net>
parents:
24919
diff
changeset
|
454 /* Shortcut text */ |
f62c5b302b91
Try to improve the wording in our custom smiley manager
Mark Doliner <mark@kingant.net>
parents:
24919
diff
changeset
|
455 label = gtk_label_new_with_mnemonic(_("S_hortcut text:")); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
456 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
457 gtk_widget_show(label); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
458 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
459 s->smile = gtk_entry_new(); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
460 gtk_entry_set_activates_default(GTK_ENTRY(s->smile), TRUE); |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
461 pidgin_set_accessible_label(s->smile, label); |
27314
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
462 if (smiley) { |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
463 const char *shortcut = purple_smiley_get_shortcut(smiley); |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
464 gtk_entry_set_text(GTK_ENTRY(s->smile), shortcut); |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
465 s->entry_len = strlen(shortcut); |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
466 } |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
467 else |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
468 gtk_dialog_set_response_sensitive(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT, FALSE); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
469 |
27314
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
470 /* gtk_entry_get_text_length is 2.14+, so we'll just keep track ourselves */ |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
471 g_signal_connect(G_OBJECT(s->smile), "insert-text", G_CALLBACK(smiley_name_insert_cb), s); |
5dcee348bc22
Automatically enable and disable the Add/Save button in the PidginSmiley
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27120
diff
changeset
|
472 g_signal_connect(G_OBJECT(s->smile), "delete-text", G_CALLBACK(smiley_name_delete_cb), s); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
473 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
474 gtk_box_pack_end(GTK_BOX(hbox), s->smile, FALSE, FALSE, 0); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
475 gtk_widget_show(s->smile); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
476 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
477 gtk_widget_show(hbox); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
478 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
479 gtk_widget_show(GTK_WIDGET(window)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
480 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(pidgin_smiley_destroy), s); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
481 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(purple_notify_close_with_handle), s); |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
482 |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
483 return s; |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
484 } |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
485 |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
486 void |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
487 pidgin_smiley_editor_set_shortcut(PidginSmiley *editor, const gchar *shortcut) |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
488 { |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
489 gtk_entry_set_text(GTK_ENTRY(editor->smile), shortcut ? shortcut : ""); |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
490 } |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
491 |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
492 void |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
493 pidgin_smiley_editor_set_image(PidginSmiley *editor, GdkPixbuf *image) |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
494 { |
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
495 if (editor->custom_pixbuf) |
26712
38a5df43d525
Oops, I must have been tired. I only replaced the first occurrence of these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26705
diff
changeset
|
496 g_object_unref(G_OBJECT(editor->custom_pixbuf)); |
26705
a3f7ade9e45b
Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25406
diff
changeset
|
497 editor->custom_pixbuf = image ? g_object_ref(G_OBJECT(image)) : NULL; |
27316
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
498 if (image) { |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
499 gtk_image_set_from_pixbuf(GTK_IMAGE(editor->smiley_image), image); |
27316
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
500 if (editor->entry_len > 0) |
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
501 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor->parent), |
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
502 GTK_RESPONSE_ACCEPT, TRUE); |
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
503 } |
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
504 else |
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
505 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor->parent), |
13d0a8097a94
Fix the Add button sensitivity for the add smiley window when using the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27315
diff
changeset
|
506 GTK_RESPONSE_ACCEPT, FALSE); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
507 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 |
27120
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
509 void |
29381
b1df98334930
Using gpointer * is redundant.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28604
diff
changeset
|
510 pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer data, gsize datasize) |
27120
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
511 { |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
512 editor->data = data; |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
513 editor->datasize = datasize; |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
514 } |
804141095de5
Allow adding received animated custom smileys to locale custom smiley
Andrea Piccinelli <frasten@gmail.com>
parents:
26712
diff
changeset
|
515 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
516 /****************************************************************************** |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
517 * Delete smiley |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 *****************************************************************************/ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
519 static void delete_foreach(GtkTreeModel *model, GtkTreePath *path, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
520 GtkTreeIter *iter, gpointer data) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
521 { |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
522 PurpleSmiley *smiley = NULL; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 gtk_tree_model_get(model, iter, |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
525 SMILEY, &smiley, |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 -1); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
528 if(smiley != NULL) { |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
529 g_object_unref(G_OBJECT(smiley)); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 pidgin_smiley_del_from_list(smiley); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 purple_smiley_delete(smiley); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 } |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
533 } |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
535 static void append_to_list(GtkTreeModel *model, GtkTreePath *path, |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
536 GtkTreeIter *iter, gpointer data) |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
537 { |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
538 GList **list = data; |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
539 *list = g_list_prepend(*list, gtk_tree_path_copy(path)); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
540 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
541 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
542 static void smiley_delete(SmileyManager *dialog) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
543 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
544 GtkTreeSelection *selection; |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
545 GList *list = NULL; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
546 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
547 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
548 gtk_tree_selection_selected_foreach(selection, delete_foreach, dialog); |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
549 gtk_tree_selection_selected_foreach(selection, append_to_list, &list); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
550 |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
551 while (list) { |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
552 GtkTreeIter iter; |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
553 if (gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, list->data)) |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
554 gtk_list_store_remove(GTK_LIST_STORE(dialog->model), &iter); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
555 gtk_tree_path_free(list->data); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
556 list = g_list_delete_link(list, list); |
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
557 } |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
558 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
559 /****************************************************************************** |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
560 * The Smiley Manager |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
561 *****************************************************************************/ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
562 static void add_columns(GtkWidget *treeview, SmileyManager *dialog) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
563 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
564 GtkCellRenderer *rend; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
565 GtkTreeViewColumn *column; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
566 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
567 /* Icon */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
568 column = gtk_tree_view_column_new(); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
569 gtk_tree_view_column_set_title(column, _("Smiley")); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
570 gtk_tree_view_column_set_resizable(column, TRUE); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
571 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
572 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
573 rend = gtk_cell_renderer_pixbuf_new(); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
574 gtk_tree_view_column_pack_start(column, rend, FALSE); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
575 gtk_tree_view_column_add_attribute(column, rend, "pixbuf", ICON); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
576 |
25403
f62c5b302b91
Try to improve the wording in our custom smiley manager
Mark Doliner <mark@kingant.net>
parents:
24919
diff
changeset
|
577 /* Shortcut Text */ |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
578 column = gtk_tree_view_column_new(); |
25403
f62c5b302b91
Try to improve the wording in our custom smiley manager
Mark Doliner <mark@kingant.net>
parents:
24919
diff
changeset
|
579 gtk_tree_view_column_set_title(column, _("Shortcut Text")); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
580 gtk_tree_view_column_set_resizable(column, TRUE); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
581 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
582 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
583 rend = gtk_cell_renderer_text_new(); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
584 gtk_tree_view_column_pack_start(column, rend, TRUE); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
585 gtk_tree_view_column_add_attribute(column, rend, "text", SHORTCUT); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
586 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
587 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
588 static void store_smiley_add(PurpleSmiley *smiley) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
589 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
590 GtkTreeIter iter; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
591 PurpleStoredImage *img; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
592 GdkPixbuf *sized_smiley = NULL; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
593 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
594 if (smiley_manager == NULL) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
595 return; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
596 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
597 img = purple_smiley_get_stored_image(smiley); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
598 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
599 if (img != NULL) { |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
600 GdkPixbuf *smiley_image = pidgin_pixbuf_from_imgstore(img); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
601 purple_imgstore_unref(img); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
602 |
28604
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
603 if (smiley_image != NULL) { |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
604 if (gdk_pixbuf_get_width(smiley_image) > 22 || |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
605 gdk_pixbuf_get_height(smiley_image) > 22) { |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
606 sized_smiley = gdk_pixbuf_scale_simple(smiley_image, |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
607 22, 22, GDK_INTERP_HYPER); |
28604
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
608 g_object_unref(G_OBJECT(smiley_image)); |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
609 } else { |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
610 /* don't scale up smaller smileys, avoid blurryness */ |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
611 sized_smiley = smiley_image; |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
612 } |
a6cfb7bf8c88
Only scale down larger smileys (more than 22 px width or height) in the
Marcus Lundblad <ml@update.uu.se>
parents:
27370
diff
changeset
|
613 } |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
614 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
615 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
616 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
617 gtk_list_store_append(smiley_manager->model, &iter); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
618 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
619 gtk_list_store_set(smiley_manager->model, &iter, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
620 ICON, sized_smiley, |
22880
2ab289f312d0
Hide PurpleSmiley internals.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22878
diff
changeset
|
621 SHORTCUT, purple_smiley_get_shortcut(smiley), |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
622 SMILEY, smiley, |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
623 -1); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
624 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
625 if (sized_smiley != NULL) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
626 g_object_unref(G_OBJECT(sized_smiley)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
627 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
628 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
629 static void populate_smiley_list(SmileyManager *dialog) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
630 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
631 GList *list; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
632 PurpleSmiley *emoticon; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
633 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
634 gtk_list_store_clear(dialog->model); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 |
22881
d1bcb54920f8
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22880
diff
changeset
|
636 for(list = purple_smileys_get_all(); list != NULL; |
d1bcb54920f8
Fix a leak, and correct the docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22880
diff
changeset
|
637 list = g_list_delete_link(list, list)) { |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 emoticon = (PurpleSmiley*)list->data; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
639 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
640 store_smiley_add(emoticon); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
641 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
642 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
643 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 static void smile_selected_cb(GtkTreeSelection *sel, SmileyManager *dialog) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 gint selected; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 selected = gtk_tree_selection_count_selected_rows(sel); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
650 gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog->window), |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
651 GTK_RESPONSE_NO, selected > 0); |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
652 |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
653 gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog->window), |
24919
fe5179d40a51
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <pidgin@unreliablesource.net>
parents:
24529
diff
changeset
|
654 PIDGIN_RESPONSE_MODIFY, selected > 0); |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
655 } |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
656 |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
657 static void |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
658 smiley_edit_iter(SmileyManager *dialog, GtkTreeIter *iter) |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
659 { |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
660 PurpleSmiley *smiley = NULL; |
27370
9aea1eb8aa66
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27316
diff
changeset
|
661 GtkWidget *window = NULL; |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
662 gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), iter, SMILEY, &smiley, -1); |
27370
9aea1eb8aa66
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27316
diff
changeset
|
663 if ((window = g_object_get_data(G_OBJECT(smiley), "edit-dialog")) != NULL) |
9aea1eb8aa66
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27316
diff
changeset
|
664 gtk_window_present(GTK_WINDOW(window)); |
9aea1eb8aa66
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27316
diff
changeset
|
665 else |
9aea1eb8aa66
Make the custom smiley edit windows single-instance. That is, if you click
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27316
diff
changeset
|
666 pidgin_smiley_edit(gtk_widget_get_toplevel(GTK_WIDGET(dialog->treeview)), smiley); |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
667 g_object_unref(G_OBJECT(smiley)); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
668 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
669 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
670 static void smiley_edit_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
671 { |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
672 GtkTreeIter iter; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
673 SmileyManager *dialog = data; |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
674 |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
675 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path); |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
676 smiley_edit_iter(dialog, &iter); |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
677 } |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
678 |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
679 static void |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
680 edit_selected_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
681 { |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
682 smiley_edit_iter(data, iter); |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
683 } |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
684 |
29383
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
685 static void |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
686 smiley_got_url(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
687 const gchar *smileydata, size_t len, const gchar *error_message) |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
688 { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
689 SmileyManager *dialog = user_data; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
690 FILE *f; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
691 gchar *path; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
692 size_t wc; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
693 GError *err = NULL; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
694 PidginSmiley *ps; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
695 GdkPixbuf *image; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
696 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
697 if ((error_message != NULL) || (len == 0)) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
698 return; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
699 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
700 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
701 f = purple_mkstemp(&path, TRUE); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
702 wc = fwrite(smileydata, len, 1, f); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
703 if (wc != 1) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
704 purple_debug_warning("smiley_got_url", "Unable to write smiley data.\n"); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
705 fclose(f); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
706 g_unlink(path); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
707 g_free(path); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
708 return; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
709 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
710 fclose(f); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
711 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
712 image = gdk_pixbuf_new_from_file(path, &err); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
713 g_unlink(path); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
714 g_free(path); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
715 if (err) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
716 g_error_free(err); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
717 return; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
718 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
719 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
720 ps = pidgin_smiley_edit(dialog->window, NULL); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
721 pidgin_smiley_editor_set_image(ps, image); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
722 pidgin_smiley_editor_set_data(ps, g_memdup(smileydata, len), len); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
723 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
724 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
725 static void |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
726 smiley_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
727 GtkSelectionData *sd, guint info, guint t, gpointer user_data) |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
728 { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
729 SmileyManager *dialog = user_data; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
730 gchar *name = g_strchomp((gchar *)sd->data); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
731 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
732 if ((sd->length >= 0) && (sd->format == 8)) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
733 /* Well, it looks like the drag event was cool. |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
734 * Let's do something with it */ |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
735 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
736 if (!g_ascii_strncasecmp(name, "file://", 7)) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
737 GError *converr = NULL; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
738 gchar *tmp; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
739 PidginSmiley *ps; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
740 /* It looks like we're dealing with a local file. Let's |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
741 * just try and read it */ |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
742 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
743 purple_debug_error("smiley dnd", "%s\n", |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
744 (converr ? converr->message : |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
745 "g_filename_from_uri error")); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
746 return; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
747 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
748 ps = pidgin_smiley_edit(dialog->window, NULL); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
749 do_add_file_cb(tmp, ps); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
750 if (gtk_image_get_pixbuf(GTK_IMAGE(ps->smiley_image)) == NULL) |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
751 gtk_dialog_response(GTK_DIALOG(ps->parent), GTK_RESPONSE_CANCEL); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
752 g_free(tmp); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
753 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
754 /* Oo, a web drag and drop. This is where things |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
755 * will start to get interesting */ |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
756 purple_util_fetch_url(name, TRUE, NULL, FALSE, smiley_got_url, dialog); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
757 } else if (!g_ascii_strncasecmp(name, "https://", 8)) { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
758 /* purple_util_fetch_url() doesn't support HTTPS */ |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
759 char *tmp = g_strdup(name + 1); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
760 tmp[0] = 'h'; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
761 tmp[1] = 't'; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
762 tmp[2] = 't'; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
763 tmp[3] = 'p'; |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
764 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
765 purple_util_fetch_url(tmp, TRUE, NULL, FALSE, smiley_got_url, dialog); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
766 g_free(tmp); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
767 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
768 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
769 gtk_drag_finish(dc, TRUE, FALSE, t); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
770 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
771 |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
772 gtk_drag_finish(dc, FALSE, FALSE, t); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
773 } |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
774 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
775 static GtkWidget *smiley_list_create(SmileyManager *dialog) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
776 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
777 GtkWidget *sw; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
778 GtkWidget *treeview; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
779 GtkTreeSelection *sel; |
29383
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
780 GtkTargetEntry te[3] = { |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
781 {"text/plain", 0, 0}, |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
782 {"text/uri-list", 0, 1}, |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
783 {"STRING", 0, 2} |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
784 }; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
785 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
786 sw = gtk_scrolled_window_new(NULL, NULL); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
787 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
788 GTK_POLICY_AUTOMATIC, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
789 GTK_POLICY_AUTOMATIC); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
790 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
791 GTK_SHADOW_IN); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
792 gtk_widget_show(sw); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
793 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
794 /* Create the list model */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
795 dialog->model = gtk_list_store_new(N_COL, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
796 GDK_TYPE_PIXBUF, /* ICON */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
797 G_TYPE_STRING, /* SHORTCUT */ |
23136
6c4f47b9d201
Make PurpleSmiley a GObject.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23132
diff
changeset
|
798 G_TYPE_OBJECT /* SMILEY */ |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
799 ); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
800 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
801 /* the actual treeview */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
802 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
803 dialog->treeview = treeview; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
804 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
23130
a3b4a9061552
Fix a small leak. And sort the smileys alphabetically, as suggested by
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23129
diff
changeset
|
805 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->model), SHORTCUT, GTK_SORT_ASCENDING); |
a3b4a9061552
Fix a small leak. And sort the smileys alphabetically, as suggested by
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23129
diff
changeset
|
806 g_object_unref(G_OBJECT(dialog->model)); |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
807 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
808 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
809 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
810 gtk_container_add(GTK_CONTAINER(sw), treeview); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
811 |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
812 g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(smile_selected_cb), dialog); |
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
813 g_signal_connect(G_OBJECT(treeview), "row_activated", G_CALLBACK(smiley_edit_cb), dialog); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
814 |
29383
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
815 gtk_drag_dest_set(treeview, |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
816 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
817 te, G_N_ELEMENTS(te), GDK_ACTION_COPY | GDK_ACTION_MOVE); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
818 g_signal_connect(G_OBJECT(treeview), "drag_data_received", G_CALLBACK(smiley_dnd_recv), dialog); |
9af18bfb16aa
Add support for dropping an image on the Custom Smiley window to add that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29382
diff
changeset
|
819 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
820 gtk_widget_show(treeview); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
821 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
822 add_columns(treeview, dialog); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
823 populate_smiley_list(dialog); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
824 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
825 return sw; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
826 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
827 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
828 static void refresh_list() |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
829 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
830 populate_smiley_list(smiley_manager); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
831 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
832 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
833 static void smiley_manager_select_cb(GtkWidget *widget, gint resp, SmileyManager *dialog) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
834 { |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
835 GtkTreeSelection *selection = NULL; |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
836 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
837 switch (resp) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
838 case GTK_RESPONSE_YES: |
23129
b70b4108799e
Patch from Masca to use the buddy-icon selector to select a custom
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22889
diff
changeset
|
839 pidgin_smiley_edit(dialog->window, NULL); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
840 break; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
841 case GTK_RESPONSE_NO: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
842 smiley_delete(dialog); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
843 break; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
844 case GTK_RESPONSE_DELETE_EVENT: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
845 case GTK_RESPONSE_CLOSE: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
846 gtk_widget_destroy(dialog->window); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
847 g_free(smiley_manager); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
848 smiley_manager = NULL; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
849 break; |
24919
fe5179d40a51
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <pidgin@unreliablesource.net>
parents:
24529
diff
changeset
|
850 case PIDGIN_RESPONSE_MODIFY: |
23143
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
851 /* Find smiley of selection... */ |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
852 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
853 gtk_tree_selection_selected_foreach(selection, edit_selected_cb, dialog); |
d0ee799828d1
Modified patch from malu to add an 'Edit' button in the smiley manager
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23140
diff
changeset
|
854 break; |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
855 default: |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
856 purple_debug_info("gtksmiley", "No valid selection\n"); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
857 break; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
858 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
859 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
860 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
861 void pidgin_smiley_manager_show(void) |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
862 { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
863 SmileyManager *dialog; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
864 GtkWidget *win; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
865 GtkWidget *sw; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
866 GtkWidget *vbox; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
867 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
868 if (smiley_manager) { |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
869 gtk_window_present(GTK_WINDOW(smiley_manager->window)); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
870 return; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
871 } |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
872 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
873 dialog = g_new0(SmileyManager, 1); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
874 smiley_manager = dialog; |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
875 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
876 dialog->window = win = gtk_dialog_new_with_buttons( |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
877 _("Custom Smiley Manager"), |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
878 NULL, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
879 GTK_DIALOG_DESTROY_WITH_PARENT, |
25404
5206fc64f226
Use PIDGIN_STOCK_ADD instead of GTK_STOCK_ADD so that the add button
Mark Doliner <mark@kingant.net>
parents:
25403
diff
changeset
|
880 PIDGIN_STOCK_ADD, GTK_RESPONSE_YES, |
24919
fe5179d40a51
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <pidgin@unreliablesource.net>
parents:
24529
diff
changeset
|
881 PIDGIN_STOCK_MODIFY, PIDGIN_RESPONSE_MODIFY, |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
882 GTK_STOCK_DELETE, GTK_RESPONSE_NO, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
883 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
884 NULL); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
885 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
886 gtk_window_set_default_size(GTK_WINDOW(win), 50, 400); |
23140
b37b9e53a31b
Some little usability changes in the custom smiley dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23136
diff
changeset
|
887 gtk_window_set_role(GTK_WINDOW(win), "custom_smiley_manager"); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
888 gtk_container_set_border_width(GTK_CONTAINER(win),PIDGIN_HIG_BORDER); |
23140
b37b9e53a31b
Some little usability changes in the custom smiley dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23136
diff
changeset
|
889 gtk_dialog_set_response_sensitive(GTK_DIALOG(win), GTK_RESPONSE_NO, FALSE); |
24919
fe5179d40a51
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <pidgin@unreliablesource.net>
parents:
24529
diff
changeset
|
890 gtk_dialog_set_response_sensitive(GTK_DIALOG(win), |
fe5179d40a51
Make dialogs that double as add and save dialogs indicate the current action
Etan Reisner <pidgin@unreliablesource.net>
parents:
24529
diff
changeset
|
891 PIDGIN_RESPONSE_MODIFY, FALSE); |
23163
99ef50c8da91
Modified patch from malu to "Add context menu alternative to add received
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23143
diff
changeset
|
892 |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
893 g_signal_connect(win, "response", G_CALLBACK(smiley_manager_select_cb), |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
894 dialog); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
895 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
896 /* The vbox */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
897 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
898 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(win)->vbox), vbox); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
899 gtk_widget_show(vbox); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
900 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
901 /* get the scrolled window with all stuff */ |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
902 sw = smiley_list_create(dialog); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
903 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
904 gtk_widget_show(sw); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
905 |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
906 gtk_widget_show(win); |
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
907 } |