annotate src/gtkstatusselector.c @ 10397:566177590bd5

[gaim-migrate @ 11627] The typing icon was bigger than my menu text so every time someone started typing the contents of my window moved down and then moved back up when it went away. I'm going to assume this won't mess up anyone's conversation windows, if it does I'll just figure out some other way to fix it. Oh, and I guess this is my first commit. Hi Mom. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Sun, 19 Dec 2004 02:00:44 +0000
parents 5879593a6a10
children 6a043ae92db6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10249
diff changeset
2 * @file gtkstatusselector.c GTK+ Status selector widget
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup gtkui
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * source distribution.
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 *
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "internal.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #include "gtkgaim.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "gtkimhtml.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 #include "gtkstatusselector.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "gtkutils.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 #include "account.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 #include "debug.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 #include "prefs.h"
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 struct _GaimGtkStatusSelectorPrivate
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 GtkWidget *combo;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 GtkWidget *entry;
10191
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
39 GtkWidget *frame;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
41 GtkWidget *optmenu;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
42 GtkWidget *menu;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
43 GtkSizeGroup *sg;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
44
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 GtkListStore *model;
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
46
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
47 guint entry_timer;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 };
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 enum
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 COLUMN_STATUS_TYPE_ID,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 COLUMN_ICON,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 COLUMN_NAME,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 NUM_COLUMNS
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 };
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
58 #define GAIM_SELECTOR_TEXT "gaim-text"
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
59 #define GAIM_SELECTOR_STATUS_TYPE_ID "gaim-status-type-id"
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
60
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 static void gaim_gtk_status_selector_class_init(GaimGtkStatusSelectorClass *klass);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 static void gaim_gtk_status_selector_init(GaimGtkStatusSelector *selector);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 static void gaim_gtk_status_selector_finalize(GObject *obj);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 static void gaim_gtk_status_selector_destroy(GtkObject *obj);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 static void status_switched_cb(GtkWidget *combo, GaimGtkStatusSelector *selector);
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
66 static gboolean key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer user_data);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 static void signed_on_off_cb(GaimConnection *gc, GaimGtkStatusSelector *selector);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 static void rebuild_list(GaimGtkStatusSelector *selector);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 static GtkVBox *parent_class = NULL;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 GType
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 gaim_gtk_status_selector_get_type(void)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 static GType type = 0;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 if (!type)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 static const GTypeInfo info =
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 sizeof(GaimGtkStatusSelectorClass),
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 NULL,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 NULL,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 (GClassInitFunc)gaim_gtk_status_selector_class_init,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 NULL,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 NULL,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 sizeof(GaimGtkStatusSelector),
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 0,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 (GInstanceInitFunc)gaim_gtk_status_selector_init
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 };
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 type = g_type_register_static(GTK_TYPE_VBOX,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 "GaimGtkStatusSelector", &info, 0);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 return type;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 gaim_gtk_status_selector_class_init(GaimGtkStatusSelectorClass *klass)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 GObjectClass *gobject_class;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 GtkObjectClass *object_class;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 parent_class = g_type_class_peek_parent(klass);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 gobject_class = G_OBJECT_CLASS(klass);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 object_class = GTK_OBJECT_CLASS(klass);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 gobject_class->finalize = gaim_gtk_status_selector_finalize;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 object_class->destroy = gaim_gtk_status_selector_destroy;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 gaim_gtk_status_selector_init(GaimGtkStatusSelector *selector)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10207
diff changeset
118 #if GTK_CHECK_VERSION(2,4,0)
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 GtkWidget *combo;
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
120 GtkCellRenderer *renderer;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
121 #else
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
122 GtkWidget *optmenu;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
123 #endif
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 GtkWidget *entry;
10191
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
125 GtkWidget *toolbar;
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
126 GtkWidget *frame;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 selector->priv = g_new0(GaimGtkStatusSelectorPrivate, 1);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 #if GTK_CHECK_VERSION(2,4,0)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 selector->priv->model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_POINTER,
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
132 GDK_TYPE_PIXBUF, G_TYPE_STRING);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(selector->priv->model));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 selector->priv->combo = combo;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 g_object_unref(G_OBJECT(selector->priv->model));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 renderer = gtk_cell_renderer_pixbuf_new();
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 "pixbuf", COLUMN_ICON,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 renderer = gtk_cell_renderer_text_new();
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 "text", COLUMN_NAME,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 g_signal_connect(G_OBJECT(combo), "changed",
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 G_CALLBACK(status_switched_cb), selector);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 /* TODO */
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 gtk_widget_show(combo);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 gtk_box_pack_start(GTK_BOX(selector), combo, FALSE, FALSE, 0);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
160
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
161 #else /* GTK < 2.4.0 */
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
162 selector->priv->optmenu = optmenu = gtk_option_menu_new();
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
163 gtk_widget_show(optmenu);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
164
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
165 selector->priv->menu = gtk_menu_new();
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
166 gtk_widget_show(selector->priv->menu);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
167 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), selector->priv->menu);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
168
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
169 selector->priv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
170
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
171 g_signal_connect(G_OBJECT(optmenu), "changed",
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
172 G_CALLBACK(status_switched_cb), selector);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
173
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
174 gtk_box_pack_start(GTK_BOX(selector), optmenu, FALSE, FALSE, 0);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
175 #endif
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
176
10191
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
177 frame = gaim_gtk_create_imhtml(TRUE, &entry, &toolbar);
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
178 selector->priv->entry = entry;
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
179 selector->priv->frame = frame;
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
180 gtk_widget_set_name(entry, "gaim_gtkstatusselector_imhtml");
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
181 gtk_box_pack_start(GTK_BOX(selector), frame, TRUE, TRUE, 0);
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
182 gtk_widget_hide(toolbar);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
184 g_signal_connect(G_OBJECT(entry), "key_press_event",
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
185 G_CALLBACK(key_press_cb), selector);
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
186
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
188 selector, GAIM_CALLBACK(signed_on_off_cb),
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
189 selector);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
191 selector, GAIM_CALLBACK(signed_on_off_cb),
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
192 selector);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 rebuild_list(selector);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 gaim_gtk_status_selector_finalize(GObject *obj)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 GaimGtkStatusSelector *selector;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 g_return_if_fail(obj != NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 g_return_if_fail(GAIM_GTK_IS_STATUS_SELECTOR(obj));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 selector = GAIM_GTK_STATUS_SELECTOR(obj);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
207 if (selector->priv->sg) {
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
208 g_object_unref(selector->priv->sg);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
209 selector->priv->sg = NULL;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
210 }
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
211
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 g_free(selector->priv);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 if (G_OBJECT_CLASS(parent_class)->finalize)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 G_OBJECT_CLASS(parent_class)->finalize(obj);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 gaim_gtk_status_selector_destroy(GtkObject *obj)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 GaimGtkStatusSelector *selector;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 g_return_if_fail(obj != NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 g_return_if_fail(GAIM_GTK_IS_STATUS_SELECTOR(obj));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 selector = GAIM_GTK_STATUS_SELECTOR(obj);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227
10187
5a1fe52036ad [gaim-migrate @ 11302]
Mark Doliner <mark@kingant.net>
parents: 10183
diff changeset
228 gaim_signals_disconnect_by_handle(selector);
10249
a7c8a8735a31 [gaim-migrate @ 11389]
Mark Doliner <mark@kingant.net>
parents: 10248
diff changeset
229 if (selector->priv->entry_timer != 0)
a7c8a8735a31 [gaim-migrate @ 11389]
Mark Doliner <mark@kingant.net>
parents: 10248
diff changeset
230 gaim_timeout_remove(selector->priv->entry_timer);
10187
5a1fe52036ad [gaim-migrate @ 11302]
Mark Doliner <mark@kingant.net>
parents: 10183
diff changeset
231
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 if (GTK_OBJECT_CLASS(parent_class)->destroy)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 GTK_OBJECT_CLASS(parent_class)->destroy(obj);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
236 static gboolean
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
237 get_selected_data(GaimGtkStatusSelector *selector, const char **text, const char **status_type_id)
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
238 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10207
diff changeset
239 #if GTK_CHECK_VERSION(2,4,0)
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
240 GtkTreeIter iter;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
241
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
242 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(selector->priv->combo),
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
243 &iter))
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
244 return FALSE;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
245
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
246 gtk_tree_model_get(GTK_TREE_MODEL(selector->priv->model), &iter,
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
247 COLUMN_NAME, text,
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
248 COLUMN_STATUS_TYPE_ID, status_type_id,
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
249 -1);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
250 return TRUE;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
251 #else
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
252 GtkWidget *item;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
253 int i;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
254 GList *l;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
255
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
256 i = gtk_option_menu_get_history(GTK_OPTION_MENU(selector->priv->optmenu));
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
257 l = GTK_MENU_SHELL(selector->priv->menu)->children;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
258 item = g_list_nth_data(l, i);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
259 *text = g_object_get_data(G_OBJECT(item), GAIM_SELECTOR_TEXT);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
260 *status_type_id = g_object_get_data(G_OBJECT(item), GAIM_SELECTOR_STATUS_TYPE_ID);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
261 return TRUE;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
262 #endif
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
263 return FALSE;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
264 }
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
265
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 status_switched_cb(GtkWidget *combo, GaimGtkStatusSelector *selector)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 {
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
269 const char *status_type_id = NULL;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
270 const char *text = NULL;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
272 if (!get_selected_data(selector, &text, &status_type_id))
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
273 return;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274
10191
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
275 if (status_type_id == NULL)
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
276 {
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
277 if (!strcmp(text, _("New Status")))
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
278 {
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
279 /* TODO */
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
280 }
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
281 }
10197
7369bf2bf593 [gaim-migrate @ 11314]
Mark Doliner <mark@kingant.net>
parents: 10191
diff changeset
282 else
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
283 {
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
284 /*
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
285 * If the chosen status does not require a message, then set the
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
286 * status immediately. Otherwise just register a timeout and the
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
287 * status will be set whenever the user stops typing the message.
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
288 */
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
289 GList *l;
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
290 GtkTextBuffer *buffer;
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
291 gboolean allow_message = FALSE;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
293 buffer =
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
294 gtk_text_view_get_buffer(GTK_TEXT_VIEW(selector->priv->entry));
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
295
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
296 gtk_text_buffer_set_text(buffer, text, -1);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
297
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
298 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
299 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
300 GaimConnection *gc = (GaimConnection *)l->data;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
301 GaimAccount *account = gaim_connection_get_account(gc);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
302 GaimStatusType *status_type;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
303
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
304 status_type = gaim_account_get_status_type(account,
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
305 status_type_id);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
306
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
307 if (status_type == NULL)
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
308 continue;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
309
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
310 if (gaim_status_type_get_attr(status_type, "message") != NULL)
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
311 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
312 allow_message = TRUE;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
313 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
314 else
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
315 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
316 gaim_account_set_status(account,
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
317 status_type_id, TRUE,
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
318 NULL);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
319 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
320 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
321
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
322 if (allow_message)
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
323 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
324 gtk_widget_show(selector->priv->frame);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
325 key_press_cb(NULL, NULL, selector);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
326 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
327 else
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
328 gtk_widget_hide(selector->priv->frame);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
329 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
330 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
331
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
332 static gboolean
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
333 insert_text_timeout_cb(gpointer data)
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
334 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
335 GaimGtkStatusSelector *selector = (GaimGtkStatusSelector *)data;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
336 const char *status_type_id;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
337 const char *text;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
338
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
339 if (!get_selected_data(selector, &text, &status_type_id))
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
340 return FALSE;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
341
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
342 if (status_type_id == NULL)
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
343 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
344 if (!strcmp(text, _("New Status")))
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
345 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
346 /* TODO */
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
347 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
348 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
349 else
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
350 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
351 gchar *message;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
352 GList *l;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
353
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
354 message = gtk_imhtml_get_markup(GTK_IMHTML(selector->priv->entry));
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
355
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
356 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 {
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
358 GaimConnection *gc = (GaimConnection *)l->data;
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
359 GaimAccount *account = gaim_connection_get_account(gc);
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
360 GaimStatusType *status_type;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
362 status_type = gaim_account_get_status_type(account,
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
363 status_type_id);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
365 if (status_type == NULL)
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
366 continue;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
368 if (gaim_status_type_get_attr(status_type, "message") != NULL)
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369 {
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
370 gaim_account_set_status(account,
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
371 status_type_id, TRUE,
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
372 "message", message,
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
373 NULL);
10188
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
374 }
5709800d1dee [gaim-migrate @ 11303]
Mark Doliner <mark@kingant.net>
parents: 10187
diff changeset
375 }
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
376 }
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
378 return FALSE;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
379 }
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
380
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
381 /**
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
382 * The user typed in the IMHTML entry widget. If the user is finished
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
383 * typing then we want to set the appropriate status message. So let's
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
384 * wait 3 seconds, and if they haven't typed anything else then set the
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
385 * status message.
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
386 */
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
387 static gboolean
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
388 key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer user_data)
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
389 {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
390 GaimGtkStatusSelector *selector = (GaimGtkStatusSelector *)user_data;
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
391
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
392 if (selector->priv->entry_timer != 0) {
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
393 gaim_timeout_remove(selector->priv->entry_timer);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394 }
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
395
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
396 selector->priv->entry_timer = gaim_timeout_add(3000, insert_text_timeout_cb,
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
397 selector);
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
398
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10197
diff changeset
399 return FALSE;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 signed_on_off_cb(GaimConnection *gc, GaimGtkStatusSelector *selector)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 rebuild_list(selector);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 static GdkPixbuf *
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409 load_icon(const char *basename)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 char *filename;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 GdkPixbuf *pixbuf, *scale = NULL;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 if (!strcmp(basename, "available.png"))
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 basename = "online.png";
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 else if (!strcmp(basename, "hidden.png"))
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 basename = "invisible.png";
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "icons",
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 basename, NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 g_free(filename);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424 if (pixbuf != NULL)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 GDK_INTERP_BILINEAR);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 g_object_unref(G_OBJECT(pixbuf));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 else
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 "default", basename, NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 scale = gdk_pixbuf_new_from_file(filename, NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 g_free(filename);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 return scale;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 add_item(GaimGtkStatusSelector *selector, const char *status_type_id,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 const char *text, GdkPixbuf *pixbuf)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 {
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
446 #if GTK_CHECK_VERSION(2,4,0)
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 GtkTreeIter iter;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 gtk_list_store_append(selector->priv->model, &iter);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 gtk_list_store_set(selector->priv->model, &iter,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 COLUMN_STATUS_TYPE_ID, status_type_id,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 COLUMN_ICON, pixbuf,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 COLUMN_NAME, text,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 -1);
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
455 #else
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
456 GtkWidget *image = gtk_image_new_from_pixbuf(pixbuf);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
457 GtkWidget *item, *hbox, *label;
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
458
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
459 /* Create the item. */
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
460 item = gtk_menu_item_new();
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
461
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
462 /* Create the hbox. */
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
463 hbox = gtk_hbox_new(FALSE, 4);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
464 gtk_container_add(GTK_CONTAINER(item), hbox);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
465 gtk_widget_show(hbox);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
466
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
467 gtk_size_group_add_widget(selector->priv->sg, image);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
468
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
469 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
470 gtk_widget_show(image);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
471
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
472 /* Create the label. */
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
473 label = gtk_label_new(text);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
474 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
475 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
476 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
477 gtk_widget_show(label);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
478
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
479 g_object_set_data_full(G_OBJECT(item), GAIM_SELECTOR_TEXT, g_strdup(text), g_free);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
480 g_object_set_data_full(G_OBJECT(item), GAIM_SELECTOR_STATUS_TYPE_ID, g_strdup(status_type_id), g_free);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
481
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
482 gtk_menu_shell_append(GTK_MENU_SHELL(selector->priv->menu), item);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
483 gtk_widget_show(item);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
484 gaim_set_accessible_label(item, label);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
485 #endif
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487 if (pixbuf != NULL)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 g_object_unref(G_OBJECT(pixbuf));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
491
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 static void
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 rebuild_list(GaimGtkStatusSelector *selector)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 gboolean single_prpl = TRUE;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 GaimAccount *first_account = NULL;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 const char *first_prpl_type = NULL;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498 GList *l;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 g_return_if_fail(selector != NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 g_return_if_fail(GAIM_GTK_IS_STATUS_SELECTOR(selector));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
503 #if GTK_CHECK_VERSION(2,4,0)
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 gtk_list_store_clear(selector->priv->model);
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
505 #else
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
506 gtk_option_menu_remove_menu(GTK_OPTION_MENU(selector->priv->optmenu));
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
507 /* XXX this automaticly destroys the menu, right? */
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
508 selector->priv->menu = gtk_menu_new();
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
509 gtk_widget_show(selector->priv->menu);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
510 #endif
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 /*
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
513 * If no accounts are connected then gray ourself out and get
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
514 * outta hee.
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
515 */
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
516 if (gaim_connections_get_all() == NULL)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
517 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
518 gtk_widget_set_sensitive(GTK_WIDGET(selector), FALSE);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
519 return;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
520 }
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
521 gtk_widget_set_sensitive(GTK_WIDGET(selector), TRUE);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
522
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10347
diff changeset
523 /*
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 * If the user only has one IM account or one type of IM account
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525 * connected, they'll see all their statuses. This is ideal for those
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 * who use only one account, or one single protocol. Everyone else
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 * gets Available and Away and a list of saved statuses.
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
528 */
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529 for (l = gaim_connections_get_all(); l != NULL && single_prpl; l = l->next)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531 GaimConnection *gc = (GaimConnection *)l->data;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 GaimAccount *account = gaim_connection_get_account(gc);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 GaimPluginProtocolInfo *prpl_info;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
534 const char *basename;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
535
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537 basename = prpl_info->list_icon(account, NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 if (first_prpl_type == NULL)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541 first_prpl_type = basename;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542 first_account = account;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543 }
10179
97ee3bf7bcf7 [gaim-migrate @ 11294]
Christian Hammond <chipx86@chipx86.com>
parents: 10178
diff changeset
544 else if (strcmp(first_prpl_type, basename))
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545 single_prpl = FALSE;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548 if (single_prpl)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 const GList *l;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
551
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552 for (l = gaim_account_get_status_types(first_account);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
553 l != NULL;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554 l = l->next)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 GaimStatusType *status_type = (GaimStatusType *)l->data;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 char filename[BUFSIZ];
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559 if (!gaim_status_type_is_user_settable(status_type))
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 continue;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561
10207
9d03dd6ccc9a [gaim-migrate @ 11328]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
562 /*
9d03dd6ccc9a [gaim-migrate @ 11328]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
563 * TODO Find a way to fallback to the GaimStatusPrimitive
9d03dd6ccc9a [gaim-migrate @ 11328]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
564 * if an icon for this id does not exist.
9d03dd6ccc9a [gaim-migrate @ 11328]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
565 */
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 g_snprintf(filename, sizeof(filename), "%s.png",
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 gaim_status_type_get_id(status_type));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 add_item(selector,
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 gaim_status_type_get_id(status_type),
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 gaim_status_type_get_name(status_type),
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 load_icon(filename));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
574 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
575 else
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 add_item(selector, "available", _("Available"),
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 load_icon("online.png"));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 add_item(selector, "away", _("Away"), load_icon("away.png"));
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581
10191
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
582 /* TODO: Add saved statuses here? */
0f86175b41a4 [gaim-migrate @ 11306]
Mark Doliner <mark@kingant.net>
parents: 10188
diff changeset
583
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 add_item(selector, NULL, _("New Status"),
10347
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
585 gtk_widget_render_icon(GTK_WIDGET(selector), GTK_STOCK_NEW,
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
586 GTK_ICON_SIZE_MENU, NULL));
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
587 #if !GTK_CHECK_VERSION(2,4,0)
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
588 gtk_option_menu_set_menu(GTK_OPTION_MENU(selector->priv->optmenu), selector->priv->menu);
4d2ecbb139a0 [gaim-migrate @ 11561]
Tim Ringenbach <marv@pidgin.im>
parents: 10297
diff changeset
589 #endif
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 }
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 GtkWidget *
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593 gaim_gtk_status_selector_new(void)
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594 {
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595 GaimGtkStatusSelector *selector;
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 selector = g_object_new(GAIM_GTK_TYPE_STATUS_SELECTOR, NULL);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 return GTK_WIDGET(selector);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600 }