pidgin/gtksavedstatuses.c

Mon, 28 Nov 2022 23:20:24 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Mon, 28 Nov 2022 23:20:24 -0600
changeset 41947
7b3312d0760c
parent 41416
253e831b0a1e
permissions
-rw-r--r--

Bump C standard to C99 for Pidgin files and fix warnings

Bump C standard to C99 for Pidgin files only and fix warnings

Testing Done:
Touched all Pidgin files, compiled and saw no new warnings.

Reviewed at https://reviews.imfreedom.org/r/2103/

20330
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 19859
diff changeset
1 /* pidgin
10418
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
5 * source distribution.
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
6 *
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
11 *
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
16 *
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
20 */
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
27
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
7b632343a29c [gaim-migrate @ 11669]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
70 status_menu_cb(GtkComboBox *widget, void(*callback)(PurpleSavedStatus*))
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
87 PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
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
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
96 }
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
101 const PurpleSavedStatus *saved_status_a = a;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
102 const PurpleSavedStatus *saved_status_b = b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
103 return g_utf8_collate(purple_savedstatus_get_title(saved_status_a),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
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
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
107 static gboolean
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
108 pidgin_status_menu_add_primitive(GtkListStore *model,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
109 G_GNUC_UNUSED GtkWidget *w,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
110 PurpleStatusPrimitive primitive,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41416
diff changeset
111 PurpleSavedStatus *current_status)
14739
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 GtkTreeIter iter;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
114 gboolean currently_selected = FALSE;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
115
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
116 gtk_list_store_append(model, &iter);
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
117 gtk_list_store_set(model, &iter,
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
118 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
119 SS_MENU_ICON_COLUMN, pidgin_icon_name_from_status_primitive(primitive, NULL),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
120 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
121 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
122 SS_MENU_EMBLEM_VISIBLE_COLUMN, FALSE,
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
123 -1);
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
124
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
125 if (purple_savedstatus_is_transient(current_status)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
126 && !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
127 && purple_savedstatus_get_primitive_type(current_status) == primitive)
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
128 currently_selected = TRUE;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
129
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
130 return currently_selected;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
131 }
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
132
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
133 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
134 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
135 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
136 {
26846
d5546da39e44 Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25900
diff changeset
137 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
138
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
139 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
140 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
141
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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150 -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
151 }
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 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
154 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
155 {
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 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
157 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
158 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
159 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
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 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
162 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
163
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 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
165 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
166 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
167 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
168 -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
169 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
170 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
171 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
172 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
173 } 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
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 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
176 }
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 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
179 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
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 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
182 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
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 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
185 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
186
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 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
188 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
189 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
190 }
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 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
193 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
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 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
196 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
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 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
199 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
200
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 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
202 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
203 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
204 }
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 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
207 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
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 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
210 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
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 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
213 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
214
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 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
216 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
217 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
218 }
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
219
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
220 GtkWidget *pidgin_status_menu(PurpleSavedStatus *current_status, GCallback callback)
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
221 {
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
222 GtkWidget *combobox;
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
223 GtkListStore *model;
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
224 GList *sorted, *cur;
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
225 int i = 0;
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
226 int index = -1;
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
227 GtkTreeIter iter;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
228 GtkCellRenderer *text_rend;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
229 GtkCellRenderer *icon_rend;
16482
a6621f3d0619 Use menu emblem for saved statuses in preferences also.
Sean Egan <seanegan@pidgin.im>
parents: 16254
diff changeset
230 GtkCellRenderer *emblem_rend;
12329
987036c6c7f9 [gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents: 12246
diff changeset
231
26846
d5546da39e44 Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25900
diff changeset
232 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
233 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
234
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
235 combobox = gtk_combo_box_new();
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
236
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
237 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
238 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
239 i++;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
240
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
241 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
242 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
243 i++;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
244
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
245 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
246 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
247 i++;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
248
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
249 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
250 index = i;
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
251 i++;
12329
987036c6c7f9 [gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents: 12246
diff changeset
252
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
253 sorted = g_list_copy((GList *)purple_savedstatuses_get_all());
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
254 sorted = g_list_sort(sorted, saved_status_sort_alphabetically_func);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
255 for (cur = sorted; cur; cur = cur->next)
12329
987036c6c7f9 [gaim-migrate @ 14633]
Mark Doliner <markdoliner@pidgin.im>
parents: 12246
diff changeset
256 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
257 PurpleSavedStatus *status = (PurpleSavedStatus *) cur->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
258 if (!purple_savedstatus_is_transient(status))
13179
e9e22c1cc839 [gaim-migrate @ 15541]
Mark Doliner <markdoliner@pidgin.im>
parents: 13177
diff changeset
259 {
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
260 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
261
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
262 pidgin_status_menu_update_iter(combobox, model, &iter, status);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
263
12199
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
264 if (status == current_status)
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
265 index = i;
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
266 i++;
0cf90c70f0dc [gaim-migrate @ 14501]
Sean Egan <seanegan@pidgin.im>
parents: 12195
diff changeset
267 }
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
268 }
12817
d84b2c520f7d [gaim-migrate @ 15165]
Mark Doliner <markdoliner@pidgin.im>
parents: 12726
diff changeset
269 g_list_free(sorted);
12246
7af1ef3b1cc4 [gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents: 12238
diff changeset
270
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
271 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
272
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
273 text_rend = gtk_cell_renderer_text_new();
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
274 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
275 emblem_rend = gtk_cell_renderer_pixbuf_new();
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
276 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
277 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
278 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
279 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
280 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
281 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
282 "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
283 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
14739
eefbd27ae047 [gaim-migrate @ 17426]
Daniel Atallah <datallah@pidgin.im>
parents: 14253
diff changeset
284
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
285 gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), index);
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
286 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
287
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
288 /* 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
289 * 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
290 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
291 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
292 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
293 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
294 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
295 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
296 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
297 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
298
12195
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
299 return combobox;
ef8f46c29e77 [gaim-migrate @ 14497]
Sean Egan <seanegan@pidgin.im>
parents: 12173
diff changeset
300 }

mercurial