Thu, 25 Aug 2022 20:28:29 -0500
Port the AccountChooser to GTK4
Testing Done:
Open the new im dialog and verified the account chooser worked as expected.
Reviewed at https://reviews.imfreedom.org/r/1645/
|
20330
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 10418 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 10418 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 6 | * | |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19570
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 10418 | 20 | */ |
| 21 | ||
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
22 | #include <glib/gi18n-lib.h> |
|
39225
a3f3275250a4
Move GtkSavedStatus to Talkatu
Gary Kramlich <grim@reaperworld.com>
parents:
38583
diff
changeset
|
23 | |
|
41416
253e831b0a1e
Remove the manager, editor, and substatus editor from gtksavedstatuses
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
24 | #include <gtk/gtk.h> |
|
18273
e61c53184c52
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18261
diff
changeset
|
25 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
26 | #include <purple.h> |
| 10418 | 27 | |
| 28 | #include "gtksavedstatuses.h" | |
|
41095
c2471cdf5a4e
Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41087
diff
changeset
|
29 | #include "pidginiconname.h" |
| 10418 | 30 | |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
31 | enum { |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
32 | SS_MENU_ENTRY_TYPE_PRIMITIVE, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
33 | SS_MENU_ENTRY_TYPE_SAVEDSTATUS |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
34 | }; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
35 | |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
36 | enum { |
|
35455
216a37403c5b
Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
37 | /* _SSMenuEntryType */ |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
38 | SS_MENU_TYPE_COLUMN, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
39 | |
|
35455
216a37403c5b
Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
40 | /* |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
41 | * This is a GdkPixbuf (the other columns are strings). |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
42 | * This column is visible. |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
43 | */ |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
44 | SS_MENU_ICON_COLUMN, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
45 | |
|
35455
216a37403c5b
Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
46 | /* The text displayed on the status box. This column is visible. */ |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
47 | SS_MENU_TEXT_COLUMN, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
48 | |
|
35455
216a37403c5b
Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
49 | /* |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
50 | * This value depends on SS_MENU_TYPE_COLUMN. For _SAVEDSTATUS types, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
51 | * this is the creation time. For _PRIMITIVE types, |
| 15884 | 52 | * this is the PurpleStatusPrimitive. |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
53 | */ |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
54 | SS_MENU_DATA_COLUMN, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
55 | |
|
35455
216a37403c5b
Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
56 | /* |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
57 | * This is the emblem to use for this status |
|
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
58 | */ |
|
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
59 | SS_MENU_EMBLEM_COLUMN, |
|
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
60 | |
|
35455
216a37403c5b
Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
61 | /* |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
62 | * And whether or not that emblem is visible |
|
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
63 | */ |
|
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
64 | SS_MENU_EMBLEM_VISIBLE_COLUMN, |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24816
diff
changeset
|
65 | |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
66 | SS_MENU_NUM_COLUMNS |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
67 | }; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
68 | |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12238
diff
changeset
|
69 | static void |
| 15884 | 70 | status_menu_cb(GtkComboBox *widget, void(*callback)(PurpleSavedStatus*)) |
| 12195 | 71 | { |
|
12237
91cf841da813
[gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12199
diff
changeset
|
72 | GtkTreeIter iter; |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
73 | int type; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
74 | gpointer data; |
| 15884 | 75 | PurpleSavedStatus *status = NULL; |
|
12237
91cf841da813
[gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12199
diff
changeset
|
76 | |
|
91cf841da813
[gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12199
diff
changeset
|
77 | if (!gtk_combo_box_get_active_iter(widget, &iter)) |
|
91cf841da813
[gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12199
diff
changeset
|
78 | return; |
|
91cf841da813
[gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12199
diff
changeset
|
79 | |
|
91cf841da813
[gaim-migrate @ 14539]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12199
diff
changeset
|
80 | gtk_tree_model_get(gtk_combo_box_get_model(widget), &iter, |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
81 | SS_MENU_TYPE_COLUMN, &type, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
82 | SS_MENU_DATA_COLUMN, &data, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
83 | -1); |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
84 | |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
85 | if (type == SS_MENU_ENTRY_TYPE_PRIMITIVE) |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
86 | { |
| 15884 | 87 | PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data); |
| 88 | status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL); | |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
89 | if (status == NULL) |
| 15884 | 90 | status = purple_savedstatus_new(NULL, primitive); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
91 | } |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
92 | else if (type == SS_MENU_ENTRY_TYPE_SAVEDSTATUS) |
| 15884 | 93 | status = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data)); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
94 | |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
95 | callback(status); |
| 12195 | 96 | } |
| 97 | ||
|
12817
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
98 | static gint |
|
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
99 | saved_status_sort_alphabetically_func(gconstpointer a, gconstpointer b) |
|
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
100 | { |
| 15884 | 101 | const PurpleSavedStatus *saved_status_a = a; |
| 102 | const PurpleSavedStatus *saved_status_b = b; | |
| 103 | return g_utf8_collate(purple_savedstatus_get_title(saved_status_a), | |
| 104 | purple_savedstatus_get_title(saved_status_b)); | |
|
12817
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
105 | } |
|
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
106 | |
| 15884 | 107 | static gboolean pidgin_status_menu_add_primitive(GtkListStore *model, GtkWidget *w, PurpleStatusPrimitive primitive, |
| 108 | PurpleSavedStatus *current_status) | |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
109 | { |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
110 | GtkTreeIter iter; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
111 | gboolean currently_selected = FALSE; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
112 | |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
113 | gtk_list_store_append(model, &iter); |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
114 | gtk_list_store_set(model, &iter, |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
115 | SS_MENU_TYPE_COLUMN, SS_MENU_ENTRY_TYPE_PRIMITIVE, |
|
41095
c2471cdf5a4e
Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41087
diff
changeset
|
116 | SS_MENU_ICON_COLUMN, pidgin_icon_name_from_status_primitive(primitive, NULL), |
| 15884 | 117 | SS_MENU_TEXT_COLUMN, purple_primitive_get_name_from_type(primitive), |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
118 | SS_MENU_DATA_COLUMN, GINT_TO_POINTER(primitive), |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
119 | SS_MENU_EMBLEM_VISIBLE_COLUMN, FALSE, |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
120 | -1); |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
121 | |
| 15884 | 122 | if (purple_savedstatus_is_transient(current_status) |
| 123 | && !purple_savedstatus_has_substatuses(current_status) | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
124 | && purple_savedstatus_get_primitive_type(current_status) == primitive) |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
125 | currently_selected = TRUE; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
126 | |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
127 | return currently_selected; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
128 | } |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
129 | |
|
23401
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
130 | static void |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
131 | pidgin_status_menu_update_iter(GtkWidget *combobox, GtkListStore *store, GtkTreeIter *iter, |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
132 | PurpleSavedStatus *status) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
133 | { |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25900
diff
changeset
|
134 | PurpleStatusPrimitive primitive; |
|
23401
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
135 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
136 | if (store == NULL) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
137 | store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox))); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
138 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
139 | primitive = purple_savedstatus_get_primitive_type(status); |
|
23401
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
140 | gtk_list_store_set(store, iter, |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
141 | SS_MENU_TYPE_COLUMN, SS_MENU_ENTRY_TYPE_SAVEDSTATUS, |
|
41095
c2471cdf5a4e
Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41087
diff
changeset
|
142 | SS_MENU_ICON_COLUMN, pidgin_icon_name_from_status_primitive(primitive, NULL), |
|
23401
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
143 | SS_MENU_TEXT_COLUMN, purple_savedstatus_get_title(status), |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
144 | SS_MENU_DATA_COLUMN, GINT_TO_POINTER(purple_savedstatus_get_creation_time(status)), |
|
41025
f8cb01c54b84
Remove the usage of Stock items from gtksavedstatues
Gary Kramlich <grim@reaperworld.com>
parents:
40704
diff
changeset
|
145 | SS_MENU_EMBLEM_COLUMN, "document-save", |
|
23401
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
146 | SS_MENU_EMBLEM_VISIBLE_COLUMN, TRUE, |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
147 | -1); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
148 | } |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
149 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
150 | static gboolean |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
151 | pidgin_status_menu_find_iter(GtkListStore *store, GtkTreeIter *iter, PurpleSavedStatus *find) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
152 | { |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
153 | int type; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
154 | gpointer data; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
155 | time_t creation_time = purple_savedstatus_get_creation_time(find); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
156 | GtkTreeModel *model = GTK_TREE_MODEL(store); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
157 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
158 | if (!gtk_tree_model_get_iter_first(model, iter)) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
159 | return FALSE; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
160 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
161 | do { |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
162 | gtk_tree_model_get(model, iter, |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
163 | SS_MENU_TYPE_COLUMN, &type, |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
164 | SS_MENU_DATA_COLUMN, &data, |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
165 | -1); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
166 | if (type == SS_MENU_ENTRY_TYPE_PRIMITIVE) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
167 | continue; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
168 | if (GPOINTER_TO_INT(data) == creation_time) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
169 | return TRUE; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
170 | } while (gtk_tree_model_iter_next(model, iter)); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
171 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
172 | return FALSE; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
173 | } |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
174 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
175 | static void |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
176 | savedstatus_added_cb(PurpleSavedStatus *status, GtkWidget *combobox) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
177 | { |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
178 | GtkListStore *store; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
179 | GtkTreeIter iter; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
180 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
181 | if (purple_savedstatus_is_transient(status)) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
182 | return; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
183 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
184 | store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox))); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
185 | gtk_list_store_append(store, &iter); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
186 | pidgin_status_menu_update_iter(combobox, store, &iter, status); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
187 | } |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
188 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
189 | static void |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
190 | savedstatus_deleted_cb(PurpleSavedStatus *status, GtkWidget *combobox) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
191 | { |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
192 | GtkListStore *store; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
193 | GtkTreeIter iter; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
194 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
195 | if (purple_savedstatus_is_transient(status)) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
196 | return; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
197 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
198 | store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox))); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
199 | if (pidgin_status_menu_find_iter(store, &iter, status)) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
200 | gtk_list_store_remove(store, &iter); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
201 | } |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
202 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
203 | static void |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
204 | savedstatus_modified_cb(PurpleSavedStatus *status, GtkWidget *combobox) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
205 | { |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
206 | GtkListStore *store; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
207 | GtkTreeIter iter; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
208 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
209 | if (purple_savedstatus_is_transient(status)) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
210 | return; |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
211 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
212 | store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox))); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
213 | if (pidgin_status_menu_find_iter(store, &iter, status)) |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
214 | pidgin_status_menu_update_iter(combobox, store, &iter, status); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
215 | } |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
216 | |
| 15884 | 217 | GtkWidget *pidgin_status_menu(PurpleSavedStatus *current_status, GCallback callback) |
| 12195 | 218 | { |
| 219 | GtkWidget *combobox; | |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
220 | GtkListStore *model; |
|
12817
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
221 | GList *sorted, *cur; |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
222 | int i = 0; |
| 12195 | 223 | int index = -1; |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
224 | GtkTreeIter iter; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
225 | GtkCellRenderer *text_rend; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
226 | GtkCellRenderer *icon_rend; |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
227 | GtkCellRenderer *emblem_rend; |
|
12329
987036c6c7f9
[gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents:
12246
diff
changeset
|
228 | |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25900
diff
changeset
|
229 | model = gtk_list_store_new(SS_MENU_NUM_COLUMNS, G_TYPE_INT, G_TYPE_STRING, |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
230 | G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_BOOLEAN); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
231 | |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
232 | combobox = gtk_combo_box_new(); |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
233 | |
| 15884 | 234 | if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_AVAILABLE, current_status)) |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
235 | index = i; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
236 | i++; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
237 | |
| 15884 | 238 | if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_AWAY, current_status)) |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
239 | index = i; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
240 | i++; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
241 | |
| 15884 | 242 | if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_INVISIBLE, current_status)) |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
243 | index = i; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
244 | i++; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
245 | |
| 15884 | 246 | if (pidgin_status_menu_add_primitive(model, combobox, PURPLE_STATUS_OFFLINE, current_status)) |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
247 | index = i; |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
248 | i++; |
|
12329
987036c6c7f9
[gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents:
12246
diff
changeset
|
249 | |
| 15884 | 250 | sorted = g_list_copy((GList *)purple_savedstatuses_get_all()); |
|
12817
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
251 | sorted = g_list_sort(sorted, saved_status_sort_alphabetically_func); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
252 | for (cur = sorted; cur; cur = cur->next) |
|
12329
987036c6c7f9
[gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents:
12246
diff
changeset
|
253 | { |
| 15884 | 254 | PurpleSavedStatus *status = (PurpleSavedStatus *) cur->data; |
| 255 | if (!purple_savedstatus_is_transient(status)) | |
|
13179
e9e22c1cc839
[gaim-migrate @ 15541]
Mark Doliner <markdoliner@pidgin.im>
parents:
13177
diff
changeset
|
256 | { |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
257 | gtk_list_store_append(model, &iter); |
|
23401
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
258 | |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
259 | pidgin_status_menu_update_iter(combobox, model, &iter, status); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
260 | |
| 12199 | 261 | if (status == current_status) |
| 262 | index = i; | |
| 263 | i++; | |
| 264 | } | |
| 12195 | 265 | } |
|
12817
d84b2c520f7d
[gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents:
12726
diff
changeset
|
266 | g_list_free(sorted); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12238
diff
changeset
|
267 | |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
268 | gtk_combo_box_set_model(GTK_COMBO_BOX(combobox), GTK_TREE_MODEL(model)); |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
269 | |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
270 | text_rend = gtk_cell_renderer_text_new(); |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
271 | icon_rend = gtk_cell_renderer_pixbuf_new(); |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
272 | emblem_rend = gtk_cell_renderer_pixbuf_new(); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
273 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), icon_rend, FALSE); |
|
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
274 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), text_rend, TRUE); |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
275 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), emblem_rend, FALSE); |
|
41095
c2471cdf5a4e
Replace pidgin_stock_id_from_status_primitive by pidgin_icon_name_from_status_primitive
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41087
diff
changeset
|
276 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), icon_rend, "icon-name", SS_MENU_ICON_COLUMN, NULL); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
277 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), text_rend, "markup", SS_MENU_TEXT_COLUMN, NULL); |
|
16482
a6621f3d0619
Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents:
16254
diff
changeset
|
278 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), emblem_rend, |
|
41025
f8cb01c54b84
Remove the usage of Stock items from gtksavedstatues
Gary Kramlich <grim@reaperworld.com>
parents:
40704
diff
changeset
|
279 | "icon-name", SS_MENU_EMBLEM_COLUMN, "visible", SS_MENU_EMBLEM_VISIBLE_COLUMN, NULL); |
|
28931
79e72b4741a2
Allow ellipsizing on the status menus in the preference window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27005
diff
changeset
|
280 | g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
|
14739
eefbd27ae047
[gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
281 | |
| 12195 | 282 | gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index); |
| 283 | g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(status_menu_cb), callback); | |
|
12329
987036c6c7f9
[gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents:
12246
diff
changeset
|
284 | |
|
23401
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
285 | /* Make sure the list is updated dynamically when a substatus is changed/deleted |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
286 | * or a new one is added. */ |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
287 | purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-added", |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
288 | combobox, G_CALLBACK(savedstatus_added_cb), combobox); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
289 | purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-deleted", |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
290 | combobox, G_CALLBACK(savedstatus_deleted_cb), combobox); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
291 | purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-modified", |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
292 | combobox, G_CALLBACK(savedstatus_modified_cb), combobox); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
293 | g_signal_connect(G_OBJECT(combobox), "destroy", |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
294 | G_CALLBACK(purple_signals_disconnect_by_handle), NULL); |
|
9aafdbc03ac0
Update the list of statuses when a new status is added, or an existing
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22942
diff
changeset
|
295 | |
| 12195 | 296 | return combobox; |
| 297 | } |