Mercurial > pidgin.yaz
annotate gtk/gtkstatusbox.c @ 15280:fbfdbde296b0
[gaim-migrate @ 18069]
Patch from Graham Booker which prevents the following crash:
Thread 0 Crashed:
0 Libgaim 0x0fbbbe3a flap_connection_send + 17 (flap_connection.c:977)
1 Libgaim 0x0fbb2c04 aim_srv_setidle + 61 (family_oservice.c:588)
2 Libgaim 0x0fb1470e set_account_unidle + 122 (idle.c:93)
3 Libgaim 0x0fafd75c gaim_signal_emit_vargs + 234 (signals.c:485)
4 Libgaim 0x0fafd7c4 gaim_signal_emit + 90 (signals.c:435)
5 Libgaim 0x0fb1da57 gaim_connection_destroy + 186 (connection.c:180)
6 Libgaim 0x0fb2cb46 gaim_account_disconnect + 119 (account.c:1017)
7 Libgaim 0x0fb1d3ee gaim_connection_disconnect_cb + 37 (connection.c:425)
committer: Tailor Script <tailor@pidgin.im>
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Wed, 03 Jan 2007 20:52:40 +0000 |
parents | ca72c74bf5e3 |
children | 85a2aafc9c4b |
rev | line source |
---|---|
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2 * @file gtkstatusbox.c GTK+ Status Selection Widget |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
3 * @ingroup gtkui |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
4 * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
5 * gaim |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
6 * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
9 * source distribution. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
10 * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
14 * (at your option) any later version. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
15 * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
19 * GNU General Public License for more details. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
20 * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
24 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
25 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
26 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
27 * The status box is made up of two main pieces: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
28 * - The box that displays the current status, which is made |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
29 * of a GtkListStore ("status_box->store") and GtkCellView |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
30 * ("status_box->cell_view"). There is always exactly 1 row |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
31 * in this list store. Only the TYPE_ICON and TYPE_TEXT |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
32 * columns are used in this list store. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
33 * - The dropdown menu that lets users select a status, which |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
34 * is made of a GtkComboBox ("status_box") and GtkListStore |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
35 * ("status_box->dropdown_store"). This dropdown is shown |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
36 * when the user clicks on the box that displays the current |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
37 * status. This list store contains one row for Available, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
38 * one row for Away, etc., a few rows for popular statuses, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
39 * and the "New..." and "Saved..." options. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
40 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
41 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
42 #include <gdk/gdkkeysyms.h> |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
43 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
44 #include "account.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
45 #include "internal.h" |
14705 | 46 #include "network.h" |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
47 #include "savedstatuses.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
48 #include "status.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
49 #include "debug.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
50 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
51 #include "gtkgaim.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
52 #include "gtksavedstatuses.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
53 #include "gaimstock.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
54 #include "gtkstatusbox.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
55 #include "gtkutils.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
56 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
57 #ifdef USE_GTKSPELL |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
58 # include <gtkspell/gtkspell.h> |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
59 # ifdef _WIN32 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
60 # include "wspell.h" |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
61 # endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
62 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
63 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
64 #define TYPING_TIMEOUT 4000 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
65 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
66 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
67 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
68 static void remove_typing_cb(GtkGaimStatusBox *box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
69 static void update_size (GtkGaimStatusBox *box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
70 static gint get_statusbox_index(GtkGaimStatusBox *box, GaimSavedStatus *saved_status); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
71 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
72 static void gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
73 static void gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box); |
14742
f453cc774882
[gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14739
diff
changeset
|
74 static void status_menu_refresh_iter(GtkGaimStatusBox *status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
75 static void gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box); |
15080 | 76 static void gtk_gaim_status_box_changed(GtkGaimStatusBox *box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
77 static void gtk_gaim_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
78 static void gtk_gaim_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
79 static gboolean gtk_gaim_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); |
14599 | 80 static void gtk_gaim_status_box_redisplay_buddy_icon(GtkGaimStatusBox *status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
81 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
15080 | 82 static void gaim_gtk_status_box_popup(GtkGaimStatusBox *box); |
83 static void gaim_gtk_status_box_popdown(GtkGaimStatusBox *box); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
84 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
85 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
86 static void icon_choose_cb(const char *filename, gpointer data); |
15021
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
87 static void remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
88 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
89 enum { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
90 /** A GtkGaimStatusBoxItemType */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
91 TYPE_COLUMN, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
92 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
93 /** |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
94 * This is a GdkPixbuf (the other columns are strings). |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
95 * This column is visible. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
96 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
97 ICON_COLUMN, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
98 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
99 /** The text displayed on the status box. This column is visible. */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
100 TEXT_COLUMN, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
101 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
102 /** The plain-English title of this item */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
103 TITLE_COLUMN, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
104 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
105 /** A plain-English description of this item */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
106 DESC_COLUMN, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
107 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
108 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
109 * This value depends on TYPE_COLUMN. For POPULAR types, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
110 * this is the creation time. For PRIMITIVE types, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
111 * this is the GaimStatusPrimitive. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
112 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
113 DATA_COLUMN, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
114 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
115 NUM_COLUMNS |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
116 }; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
117 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
118 enum { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
119 PROP_0, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
120 PROP_ACCOUNT, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
121 PROP_ICON_SEL, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
122 }; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
123 |
15080 | 124 GtkContainerClass *parent_class = NULL; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
125 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
126 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
127 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
128 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
129 GType |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
130 gtk_gaim_status_box_get_type (void) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
131 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
132 static GType status_box_type = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
133 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
134 if (!status_box_type) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
135 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
136 static const GTypeInfo status_box_info = |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
137 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
138 sizeof (GtkGaimStatusBoxClass), |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
139 NULL, /* base_init */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
140 NULL, /* base_finalize */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
141 (GClassInitFunc) gtk_gaim_status_box_class_init, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
142 NULL, /* class_finalize */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
143 NULL, /* class_data */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
144 sizeof (GtkGaimStatusBox), |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
145 0, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
146 (GInstanceInitFunc) gtk_gaim_status_box_init, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
147 NULL /* value_table */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
148 }; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
149 |
15080 | 150 status_box_type = g_type_register_static(GTK_TYPE_CONTAINER, |
14803 | 151 "GtkGaimStatusBox", |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
152 &status_box_info, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
153 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
154 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
155 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
156 return status_box_type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
157 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
158 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
159 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
160 gtk_gaim_status_box_get_property(GObject *object, guint param_id, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
161 GValue *value, GParamSpec *psec) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
162 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
163 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
164 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
165 switch (param_id) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
166 case PROP_ACCOUNT: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
167 g_value_set_pointer(value, statusbox->account); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
168 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
169 case PROP_ICON_SEL: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
170 g_value_set_boolean(value, statusbox->icon_box != NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
171 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
172 default: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
173 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, psec); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
174 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
175 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
176 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
177 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
178 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
179 update_to_reflect_account_status(GtkGaimStatusBox *status_box, GaimAccount *account, GaimStatus *newstatus) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
180 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
181 const GList *l; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
182 int status_no = -1; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
183 const GaimStatusType *statustype = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
184 const char *message; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
185 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
186 statustype = gaim_status_type_find_with_id((GList *)gaim_account_get_status_types(account), |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
187 (char *)gaim_status_type_get_id(gaim_status_get_type(newstatus))); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
188 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
189 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
190 GaimStatusType *status_type = (GaimStatusType *)l->data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
191 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
192 if (!gaim_status_type_is_user_settable(status_type)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
193 continue; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
194 status_no++; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
195 if (statustype == status_type) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
196 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
197 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
198 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
199 if (status_no != -1) { |
15080 | 200 GtkTreePath *path; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
201 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); |
15080 | 202 path = gtk_tree_path_new_from_indices(status_no, -1); |
203 if (status_box->active_row) | |
204 gtk_tree_row_reference_free(status_box->active_row); | |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
205 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); |
15080 | 206 gtk_tree_path_free(path); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
207 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
208 message = gaim_status_get_attr_string(newstatus, "message"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
209 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
210 if (!message || !*message) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
211 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
212 gtk_widget_hide_all(status_box->vbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
213 status_box->imhtml_visible = FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
214 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
215 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
216 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
217 gtk_widget_show_all(status_box->vbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
218 status_box->imhtml_visible = TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
219 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
220 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
221 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
222 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
223 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
224 gtk_gaim_status_box_refresh(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
225 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
226 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
227 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
228 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
229 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
230 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
231 if (status_box->account == account) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
232 update_to_reflect_account_status(status_box, account, newstatus); |
14742
f453cc774882
[gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14739
diff
changeset
|
233 else if (status_box->token_status_account == account) |
f453cc774882
[gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14739
diff
changeset
|
234 status_menu_refresh_iter(status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
235 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
236 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
237 static gboolean |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
238 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
239 { |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
240 if (event->button == 3) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
241 GtkWidget *menu_item; |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
242 |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
243 if (box->icon_box_menu) |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
244 gtk_widget_destroy(box->icon_box_menu); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
245 |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
246 box->icon_box_menu = gtk_menu_new(); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
247 |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
248 menu_item = gaim_new_item_from_stock(box->icon_box_menu, _("Remove"), GTK_STOCK_REMOVE, |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
249 G_CALLBACK(remove_buddy_icon_cb), |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
250 box, 0, 0, NULL); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
251 if (gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon") == NULL) |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
252 gtk_widget_set_sensitive(menu_item, FALSE); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
253 |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
254 gtk_menu_popup(GTK_MENU(box->icon_box_menu), NULL, NULL, NULL, NULL, |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
255 event->button, event->time); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
256 |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
257 } else { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
258 if (box->buddy_icon_sel) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
259 gtk_window_present(GTK_WINDOW(box->buddy_icon_sel)); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
260 return FALSE; |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
261 } |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
262 |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
263 box->buddy_icon_sel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
264 gtk_widget_show_all(box->buddy_icon_sel); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
265 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
266 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
267 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
268 |
14561 | 269 static void |
270 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, | |
271 GtkSelectionData *sd, guint info, guint t, GtkGaimStatusBox *box) | |
272 { | |
273 gchar *name = (gchar *)sd->data; | |
274 | |
275 if ((sd->length >= 0) && (sd->format == 8)) { | |
276 /* Well, it looks like the drag event was cool. | |
277 * Let's do something with it */ | |
278 if (!g_ascii_strncasecmp(name, "file://", 7)) { | |
279 GError *converr = NULL; | |
280 gchar *tmp, *rtmp; | |
281 | |
282 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { | |
283 gaim_debug(GAIM_DEBUG_ERROR, "buddyicon", "%s\n", | |
284 (converr ? converr->message : | |
285 "g_filename_from_uri error")); | |
286 return; | |
287 } | |
288 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n'))) | |
289 *rtmp = '\0'; | |
290 icon_choose_cb(tmp, box); | |
291 g_free(tmp); | |
292 } | |
293 gtk_drag_finish(dc, TRUE, FALSE, t); | |
294 } | |
295 gtk_drag_finish(dc, FALSE, FALSE, t); | |
296 } | |
297 | |
298 | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
299 static gboolean |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
300 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
301 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
302 gdk_window_set_cursor(widget->window, box->hand_cursor); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
303 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
304 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
305 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
306 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
307 static gboolean |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
308 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
309 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
310 gdk_window_set_cursor(widget->window, box->arrow_cursor); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
311 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
312 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
313 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
314 |
14561 | 315 |
316 static const GtkTargetEntry dnd_targets[] = { | |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
317 {"text/plain", 0, 0}, |
14561 | 318 {"text/uri-list", 0, 1}, |
319 {"STRING", 0, 2} | |
320 }; | |
321 | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
322 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
323 setup_icon_box(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
324 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
325 if (status_box->icon_box != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
326 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
327 |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
328 status_box->icon = gtk_image_new(); |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
329 status_box->icon_box = gtk_event_box_new(); |
15080 | 330 gtk_widget_set_parent(status_box->icon_box, GTK_WIDGET(status_box)); |
331 gtk_widget_show(status_box->icon_box); | |
332 | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
333 if (status_box->account && |
15140 | 334 !gaim_account_get_bool(status_box->account, "use-global-buddyicon", TRUE)) |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
335 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
336 char *string = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(status_box->account)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
337 gtk_gaim_status_box_set_buddy_icon(status_box, string); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
338 g_free(string); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
339 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
340 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
341 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
342 gtk_gaim_status_box_set_buddy_icon(status_box, gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon")); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
343 } |
14599 | 344 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
345 status_box->hand_cursor = gdk_cursor_new (GDK_HAND2); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
346 status_box->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
347 |
14561 | 348 /* Set up DND */ |
349 gtk_drag_dest_set(status_box->icon_box, | |
350 GTK_DEST_DEFAULT_MOTION | | |
351 GTK_DEST_DEFAULT_DROP, | |
352 dnd_targets, | |
353 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
354 GDK_ACTION_COPY); | |
14599 | 355 |
14561 | 356 g_signal_connect(G_OBJECT(status_box->icon_box), "drag_data_received", G_CALLBACK(icon_box_dnd_cb), status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
357 g_signal_connect(G_OBJECT(status_box->icon_box), "enter-notify-event", G_CALLBACK(icon_box_enter_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
358 g_signal_connect(G_OBJECT(status_box->icon_box), "leave-notify-event", G_CALLBACK(icon_box_leave_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
359 g_signal_connect(G_OBJECT(status_box->icon_box), "button-press-event", G_CALLBACK(icon_box_press_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
360 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
361 gtk_container_add(GTK_CONTAINER(status_box->icon_box), status_box->icon); |
15080 | 362 gtk_widget_show(status_box->icon); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
363 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
364 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
365 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
366 destroy_icon_box(GtkGaimStatusBox *statusbox) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
367 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
368 if (statusbox->icon_box == NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
369 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
370 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
371 gtk_widget_destroy(statusbox->icon_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
372 gdk_cursor_unref(statusbox->hand_cursor); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
373 gdk_cursor_unref(statusbox->arrow_cursor); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
374 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
375 g_object_unref(G_OBJECT(statusbox->buddy_icon)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
376 g_object_unref(G_OBJECT(statusbox->buddy_icon_hover)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
377 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
378 if (statusbox->buddy_icon_sel) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
379 gtk_widget_destroy(statusbox->buddy_icon_sel); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
380 |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
381 if (statusbox->icon_box_menu) |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
382 gtk_widget_destroy(statusbox->icon_box_menu); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
383 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
384 g_free(statusbox->buddy_icon_path); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
385 |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
386 statusbox->icon = NULL; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
387 statusbox->icon_box = NULL; |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
388 statusbox->icon_box_menu = NULL; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
389 statusbox->buddy_icon_path = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
390 statusbox->buddy_icon = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
391 statusbox->buddy_icon_hover = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
392 statusbox->hand_cursor = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
393 statusbox->arrow_cursor = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
394 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
395 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
396 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
397 gtk_gaim_status_box_set_property(GObject *object, guint param_id, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
398 const GValue *value, GParamSpec *pspec) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
399 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
400 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
401 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
402 switch (param_id) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
403 case PROP_ICON_SEL: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
404 if (g_value_get_boolean(value)) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
405 if (statusbox->account) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
406 GaimPlugin *plug = gaim_plugins_find_with_id(gaim_account_get_protocol_id(statusbox->account)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
407 if (plug) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
408 GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
409 if (prplinfo && prplinfo->icon_spec.format != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
410 setup_icon_box(statusbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
411 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
412 } else { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
413 setup_icon_box(statusbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
414 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
415 } else { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
416 destroy_icon_box(statusbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
417 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
418 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
419 case PROP_ACCOUNT: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
420 statusbox->account = g_value_get_pointer(value); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
421 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
422 gtk_gaim_status_box_regenerate(statusbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
423 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
424 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
425 default: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
426 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
427 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
428 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
429 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
430 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
431 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
432 gtk_gaim_status_box_finalize(GObject *obj) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
433 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
434 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(obj); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
435 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
436 gaim_signals_disconnect_by_handle(statusbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
437 gaim_prefs_disconnect_by_handle(statusbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
438 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
439 gdk_cursor_unref(statusbox->hand_cursor); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
440 gdk_cursor_unref(statusbox->arrow_cursor); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
441 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
442 g_object_unref(G_OBJECT(statusbox->buddy_icon)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
443 g_object_unref(G_OBJECT(statusbox->buddy_icon_hover)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
444 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
445 if (statusbox->buddy_icon_sel) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
446 gtk_widget_destroy(statusbox->buddy_icon_sel); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
447 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
448 g_free(statusbox->buddy_icon_path); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
449 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
450 G_OBJECT_CLASS(parent_class)->finalize(obj); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
451 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
452 |
15080 | 453 static GType |
454 gtk_gaim_status_box_child_type (GtkContainer *container) | |
455 { | |
456 return GTK_TYPE_WIDGET; | |
457 } | |
458 | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
459 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
460 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
461 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
462 GObjectClass *object_class; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
463 GtkWidgetClass *widget_class; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
464 GtkContainerClass *container_class = (GtkContainerClass*)klass; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
465 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
466 parent_class = g_type_class_peek_parent(klass); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
467 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
468 widget_class = (GtkWidgetClass*)klass; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
469 widget_class->size_request = gtk_gaim_status_box_size_request; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
470 widget_class->size_allocate = gtk_gaim_status_box_size_allocate; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
471 widget_class->expose_event = gtk_gaim_status_box_expose_event; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
472 |
15080 | 473 container_class->child_type = gtk_gaim_status_box_child_type; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
474 container_class->forall = gtk_gaim_status_box_forall; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
475 container_class->remove = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
476 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
477 object_class = (GObjectClass *)klass; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
478 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
479 object_class->finalize = gtk_gaim_status_box_finalize; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
480 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
481 object_class->get_property = gtk_gaim_status_box_get_property; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
482 object_class->set_property = gtk_gaim_status_box_set_property; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
483 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
484 g_object_class_install_property(object_class, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
485 PROP_ACCOUNT, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
486 g_param_spec_pointer("account", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
487 "Account", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
488 "The account, or NULL for all accounts", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
489 G_PARAM_READWRITE |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
490 ) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
491 ); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
492 g_object_class_install_property(object_class, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
493 PROP_ICON_SEL, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
494 g_param_spec_boolean("iconsel", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
495 "Icon Selector", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
496 "Whether the icon selector should be displayed or not.", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
497 FALSE, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
498 G_PARAM_READWRITE |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
499 ) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
500 ); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
501 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
502 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
503 /** |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
504 * This updates the text displayed on the status box so that it shows |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
505 * the current status. This is the only function in this file that |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
506 * should modify status_box->store |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
507 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
508 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
509 gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
510 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
511 GtkIconSize icon_size; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
512 GtkStyle *style; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
513 char aa_color[8]; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
514 GaimSavedStatus *saved_status; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
515 char *primary, *secondary, *text; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
516 GdkPixbuf *pixbuf; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
517 GtkTreePath *path; |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
518 gboolean account_status = FALSE; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
519 GaimAccount *acct = (status_box->token_status_account) ? status_box->token_status_account : status_box->account; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
520 |
15080 | 521 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS); |
522 | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
523 style = gtk_widget_get_style(GTK_WIDGET(status_box)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
524 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
525 style->text_aa[GTK_STATE_NORMAL].red >> 8, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
526 style->text_aa[GTK_STATE_NORMAL].green >> 8, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
527 style->text_aa[GTK_STATE_NORMAL].blue >> 8); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
528 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
529 saved_status = gaim_savedstatus_get_current(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
530 |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
531 if (status_box->account || (status_box->token_status_account |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
532 && gaim_savedstatus_is_transient(saved_status))) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
533 account_status = TRUE; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
534 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
535 /* Primary */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
536 if (status_box->typing != 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
537 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
538 GtkTreeIter iter; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
539 GtkGaimStatusBoxItemType type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
540 gpointer data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
541 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
542 /* Primary (get the status selected in the dropdown) */ |
15080 | 543 path = gtk_tree_row_reference_get_path(status_box->active_row); |
544 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path)) | |
545 return; | |
546 gtk_tree_path_free(path); | |
547 | |
14803 | 548 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
549 TYPE_COLUMN, &type, | |
550 DATA_COLUMN, &data, | |
551 -1); | |
552 if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE) | |
553 primary = g_strdup(gaim_primitive_get_name_from_type(GPOINTER_TO_INT(data))); | |
554 else | |
555 /* This should never happen, but just in case... */ | |
556 primary = g_strdup("New status"); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
557 } |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
558 else if (account_status) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
559 primary = g_strdup(gaim_status_get_name(gaim_account_get_active_status(acct))); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
560 else if (gaim_savedstatus_is_transient(saved_status)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
561 primary = g_strdup(gaim_primitive_get_name_from_type(gaim_savedstatus_get_type(saved_status))); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
562 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
563 primary = g_markup_escape_text(gaim_savedstatus_get_title(saved_status), -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
564 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
565 /* Secondary */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
566 if (status_box->typing != 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
567 secondary = g_strdup(_("Typing")); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
568 else if (status_box->connecting) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
569 secondary = g_strdup(_("Connecting")); |
14705 | 570 else if (!status_box->network_available) |
571 secondary = g_strdup(_("Waiting for network connection")); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
572 else if (gaim_savedstatus_is_transient(saved_status)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
573 secondary = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
574 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
575 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
576 const char *message; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
577 char *tmp; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
578 message = gaim_savedstatus_get_message(saved_status); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
579 if (message != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
580 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
581 tmp = gaim_markup_strip_html(message); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
582 gaim_util_chrreplace(tmp, '\n', ' '); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
583 secondary = g_markup_escape_text(tmp, -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
584 g_free(tmp); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
585 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
586 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
587 secondary = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
588 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
589 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
590 /* Pixbuf */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
591 if (status_box->typing != 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
592 pixbuf = status_box->typing_pixbufs[status_box->typing_index]; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
593 else if (status_box->connecting) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
594 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
595 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
596 { |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
597 if (account_status) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
598 pixbuf = gaim_gtk_create_prpl_icon_with_status(acct, |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
599 gaim_status_get_type(gaim_account_get_active_status(acct)), |
15080 | 600 0.5); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
601 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
602 pixbuf = gaim_gtk_create_gaim_icon_with_status( |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
603 gaim_savedstatus_get_type(saved_status), |
15080 | 604 0.5); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
605 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
606 if (!gaim_savedstatus_is_transient(saved_status)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
607 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
608 GdkPixbuf *emblem; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
609 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
610 /* Overlay a disk in the bottom left corner */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
611 emblem = gtk_widget_render_icon(GTK_WIDGET(status_box->vbox), |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
612 GTK_STOCK_SAVE, icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
613 if (emblem != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
614 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
615 int width, height; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
616 width = gdk_pixbuf_get_width(pixbuf) / 2; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
617 height = gdk_pixbuf_get_height(pixbuf) / 2; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
618 gdk_pixbuf_composite(emblem, pixbuf, 0, height, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
619 width, height, 0, height, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
620 0.5, 0.5, GDK_INTERP_BILINEAR, 255); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
621 g_object_unref(G_OBJECT(emblem)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
622 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
623 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
624 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
625 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
626 if (status_box->account != NULL) { |
15080 | 627 text = g_strdup_printf("%s - <span size=\"smaller\" color=\"%s\">%s</span>", |
628 gaim_account_get_username(status_box->account), | |
629 aa_color, secondary ? secondary : primary); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
630 } else if (secondary != NULL) { |
15080 | 631 text = g_strdup_printf("%s<span size=\"smaller\" color=\"%s\"> - %s</span>", |
632 primary, aa_color, secondary); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
633 } else { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
634 text = g_strdup(primary); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
635 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
636 g_free(primary); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
637 g_free(secondary); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
638 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
639 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
640 * Only two columns are used in this list store (does it |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
641 * really need to be a list store?) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
642 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
643 gtk_list_store_set(status_box->store, &(status_box->iter), |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
644 ICON_COLUMN, pixbuf, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
645 TEXT_COLUMN, text, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
646 -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
647 if ((status_box->typing == 0) && (!status_box->connecting)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
648 g_object_unref(pixbuf); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
649 g_free(text); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
650 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
651 /* Make sure to activate the only row in the tree view */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
652 path = gtk_tree_path_new_from_string("0"); |
14803 | 653 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
654 gtk_tree_path_free(path); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
655 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
656 update_size(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
657 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
658 |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
659 static GaimStatusType * |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
660 find_status_type_by_index(const GaimAccount *account, gint active) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
661 { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
662 const GList *l = gaim_account_get_status_types(account); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
663 gint i; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
664 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
665 for (i = 0; l; l = l->next) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
666 GaimStatusType *status_type = l->data; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
667 if (!gaim_status_type_is_user_settable(status_type)) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
668 continue; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
669 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
670 if (active == i) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
671 return status_type; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
672 i++; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
673 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
674 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
675 return NULL; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
676 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
677 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
678 /** |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
679 * This updates the GtkTreeView so that it correctly shows the state |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
680 * we are currently using. It is used when the current state is |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
681 * updated from somewhere other than the GtkStatusBox (from a plugin, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
682 * or when signing on with the "-n" option, for example). It is |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
683 * also used when the user selects the "New..." option. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
684 * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
685 * Maybe we could accomplish this by triggering off the mouse and |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
686 * keyboard signals instead of the changed signal? |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
687 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
688 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
689 status_menu_refresh_iter(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
690 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
691 GaimSavedStatus *saved_status; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
692 GaimStatusPrimitive primitive; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
693 gint index; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
694 const char *message; |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
695 GtkTreePath *path = NULL; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
696 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
697 /* this function is inappropriate for ones with accounts */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
698 if (status_box->account) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
699 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
700 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
701 saved_status = gaim_savedstatus_get_current(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
702 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
703 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
704 * Suppress the "changed" signal because the status |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
705 * was changed programmatically. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
706 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
707 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
708 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
709 /* |
14739
63d5b71d0c68
[gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents:
14705
diff
changeset
|
710 * If there is a token-account, then select the primitive from the |
63d5b71d0c68
[gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents:
14705
diff
changeset
|
711 * dropdown using a loop. Otherwise select from the default list. |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
712 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
713 primitive = gaim_savedstatus_get_type(saved_status); |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
714 if (!status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) && |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
715 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
716 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
717 (!gaim_savedstatus_has_substatuses(saved_status))) |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
718 { |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
719 index = get_statusbox_index(status_box, saved_status); |
15080 | 720 path = gtk_tree_path_new_from_indices(index, -1); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
721 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
722 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
723 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
724 GtkTreeIter iter; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
725 GtkGaimStatusBoxItemType type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
726 gpointer data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
727 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
728 /* If this saved status is in the list store, then set it as the active item */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
729 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
730 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
731 do |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
732 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
733 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
734 TYPE_COLUMN, &type, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
735 DATA_COLUMN, &data, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
736 -1); |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
737 |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
738 /* This is a special case because Primitives for the token_status_account are actually |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
739 * saved statuses with substatuses for the enabled accounts */ |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
740 if (status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
741 && type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
742 { |
14676
beabf64760e8
[gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14663
diff
changeset
|
743 char *name; |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
744 const char *acct_status_name = gaim_status_get_name( |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
745 gaim_account_get_active_status(status_box->token_status_account)); |
14676
beabf64760e8
[gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14663
diff
changeset
|
746 |
beabf64760e8
[gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14663
diff
changeset
|
747 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
beabf64760e8
[gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14663
diff
changeset
|
748 TEXT_COLUMN, &name, -1); |
beabf64760e8
[gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14663
diff
changeset
|
749 |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
750 if (!gaim_savedstatus_has_substatuses(saved_status) |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
751 || !strcmp(name, acct_status_name)) |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
752 { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
753 /* Found! */ |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
754 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter); |
14676
beabf64760e8
[gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14663
diff
changeset
|
755 g_free(name); |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
756 break; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
757 } |
14676
beabf64760e8
[gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14663
diff
changeset
|
758 g_free(name); |
15084 | 759 |
760 } else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && | |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
761 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
762 { |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
763 /* Found! */ |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
764 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter); |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
765 break; |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
766 } |
15155
7696f5dec7d8
[gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15140
diff
changeset
|
767 } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
768 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
769 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
770 |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
771 if (status_box->active_row) |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
772 gtk_tree_row_reference_free(status_box->active_row); |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
773 if (path) { /* path should never be NULL */ |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
774 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
775 gtk_tree_path_free(path); |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
776 } else |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
777 status_box->active_row = NULL; |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
778 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
779 message = gaim_savedstatus_get_message(saved_status); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
780 if (!gaim_savedstatus_is_transient(saved_status) || !message || !*message) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
781 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
782 status_box->imhtml_visible = FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
783 gtk_widget_hide_all(status_box->vbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
784 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
785 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
786 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
787 status_box->imhtml_visible = TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
788 gtk_widget_show_all(status_box->vbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
789 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
790 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
791 * Suppress the "changed" signal because the status |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
792 * was changed programmatically. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
793 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
794 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
795 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
796 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
797 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
798 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
799 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
800 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
801 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
802 update_size(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
803 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
804 /* Stop suppressing the "changed" signal. */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
805 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
806 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
807 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
808 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
809 add_popular_statuses(GtkGaimStatusBox *statusbox) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
810 { |
15080 | 811 GtkIconSize icon_size; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
812 GList *list, *cur; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
813 GdkPixbuf *pixbuf, *emblem; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
814 int width, height; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
815 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
816 list = gaim_savedstatuses_get_popular(6); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
817 if (list == NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
818 /* Odd... oh well, nothing we can do about it. */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
819 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
820 |
15080 | 821 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
822 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
823 gtk_gaim_status_box_add_separator(statusbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
824 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
825 for (cur = list; cur != NULL; cur = cur->next) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
826 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
827 GaimSavedStatus *saved = cur->data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
828 const gchar *message; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
829 gchar *stripped = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
830 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
831 /* Get an appropriate status icon */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
832 pixbuf = gaim_gtk_create_gaim_icon_with_status( |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
833 gaim_savedstatus_get_type(saved), |
15080 | 834 0.5); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
835 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
836 if (gaim_savedstatus_is_transient(saved)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
837 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
838 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
839 * Transient statuses do not have a title, so the savedstatus |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
840 * API returns the message when gaim_savedstatus_get_title() is |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
841 * called, so we don't need to get the message a second time. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
842 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
843 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
844 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
845 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
846 message = gaim_savedstatus_get_message(saved); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
847 if (message != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
848 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
849 stripped = gaim_markup_strip_html(message); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
850 gaim_util_chrreplace(stripped, '\n', ' '); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
851 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
852 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
853 /* Overlay a disk in the bottom left corner */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
854 emblem = gtk_widget_render_icon(GTK_WIDGET(statusbox->vbox), |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
855 GTK_STOCK_SAVE, icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
856 if (emblem != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
857 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
858 width = gdk_pixbuf_get_width(pixbuf) / 2; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
859 height = gdk_pixbuf_get_height(pixbuf) / 2; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
860 gdk_pixbuf_composite(emblem, pixbuf, 0, height, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
861 width, height, 0, height, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
862 0.5, 0.5, GDK_INTERP_BILINEAR, 255); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
863 g_object_unref(G_OBJECT(emblem)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
864 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
865 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
866 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
867 gtk_gaim_status_box_add(statusbox, GTK_GAIM_STATUS_BOX_TYPE_POPULAR, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
868 pixbuf, gaim_savedstatus_get_title(saved), stripped, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
869 GINT_TO_POINTER(gaim_savedstatus_get_creation_time(saved))); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
870 g_free(stripped); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
871 if (pixbuf != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
872 g_object_unref(G_OBJECT(pixbuf)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
873 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
874 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
875 g_list_free(list); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
876 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
877 |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
878 /* This returns NULL if the active accounts don't have identical |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
879 * statuses and a token account if they do */ |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
880 static GaimAccount* check_active_accounts_for_identical_statuses() |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
881 { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
882 GaimAccount *acct = NULL, *acct2; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
883 GList *tmp, *tmp2, *active_accts = gaim_accounts_get_all_active(); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
884 const GList *s, *s1, *s2; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
885 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
886 for (tmp = active_accts; tmp; tmp = tmp->next) { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
887 acct = tmp->data; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
888 s = gaim_account_get_status_types(acct); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
889 for (tmp2 = tmp->next; tmp2; tmp2 = tmp2->next) { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
890 acct2 = tmp2->data; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
891 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
892 /* Only actually look at the statuses if the accounts use the same prpl */ |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
893 if (strcmp(gaim_account_get_protocol_id(acct), gaim_account_get_protocol_id(acct2))) { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
894 acct = NULL; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
895 break; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
896 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
897 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
898 s2 = gaim_account_get_status_types(acct2); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
899 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
900 s1 = s; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
901 while (s1 && s2) { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
902 GaimStatusType *st1 = s1->data, *st2 = s2->data; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
903 /* TODO: Are these enough to consider the statuses identical? */ |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
904 if (gaim_status_type_get_primitive(st1) != gaim_status_type_get_primitive(st2) |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
905 || strcmp(gaim_status_type_get_id(st1), gaim_status_type_get_id(st2)) |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
906 || strcmp(gaim_status_type_get_name(st1), gaim_status_type_get_name(st2))) { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
907 acct = NULL; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
908 break; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
909 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
910 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
911 s1 = s1->next; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
912 s2 = s2->next; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
913 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
914 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
915 if (s1 != s2) {/* Will both be NULL if matched */ |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
916 acct = NULL; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
917 break; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
918 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
919 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
920 if (!acct) |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
921 break; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
922 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
923 g_list_free(active_accts); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
924 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
925 return acct; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
926 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
927 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
928 static void |
15080 | 929 add_account_statuses(GtkGaimStatusBox *status_box, GaimAccount *account) |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
930 { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
931 /* Per-account */ |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
932 const GList *l; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
933 GdkPixbuf *tmp; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
934 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
935 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
936 { |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
937 GaimStatusType *status_type = (GaimStatusType *)l->data; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
938 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
939 if (!gaim_status_type_is_user_settable(status_type)) |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
940 continue; |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
941 |
15080 | 942 tmp = gaim_gtk_create_prpl_icon_with_status(account, status_type, 0.5); |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
943 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
944 GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, tmp, |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
945 gaim_status_type_get_name(status_type), |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
946 NULL, |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
947 GINT_TO_POINTER(gaim_status_type_get_primitive(status_type))); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
948 if (tmp != NULL) |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
949 g_object_unref(tmp); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
950 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
951 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
952 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
953 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
954 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
955 { |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
956 GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
957 GtkIconSize icon_size; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
958 |
15080 | 959 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
960 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
961 /* Unset the model while clearing it */ |
15080 | 962 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), NULL); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
963 gtk_list_store_clear(status_box->dropdown_store); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
964 /* Don't set the model until the new statuses have been added to the box. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
965 * What is presumably a bug in Gtk < 2.4 causes things to get all confused |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
966 * if we do this here. */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
967 /* gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
968 |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
969 if (status_box->account == NULL) |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
970 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
971 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_ONLINE, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
972 icon_size, "GtkGaimStatusBox"); |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
973 /* Do all the currently enabled accounts have the same statuses? |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
974 * If so, display them instead of our global list. |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
975 */ |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
976 if (status_box->token_status_account) { |
15080 | 977 add_account_statuses(status_box, status_box->token_status_account); |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
978 } else { |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
979 /* Global */ |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
980 pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_AWAY, |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
981 icon_size, "GtkGaimStatusBox"); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
982 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE, |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
983 icon_size, "GtkGaimStatusBox"); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
984 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_INVISIBLE, |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
985 icon_size, "GtkGaimStatusBox"); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
986 |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
987 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, _("Available"), NULL, GINT_TO_POINTER(GAIM_STATUS_AVAILABLE)); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
988 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf2, _("Away"), NULL, GINT_TO_POINTER(GAIM_STATUS_AWAY)); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
989 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf4, _("Invisible"), NULL, GINT_TO_POINTER(GAIM_STATUS_INVISIBLE)); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
990 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf3, _("Offline"), NULL, GINT_TO_POINTER(GAIM_STATUS_OFFLINE)); |
14739
63d5b71d0c68
[gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents:
14705
diff
changeset
|
991 |
63d5b71d0c68
[gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents:
14705
diff
changeset
|
992 if (pixbuf2) g_object_unref(G_OBJECT(pixbuf2)); |
63d5b71d0c68
[gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents:
14705
diff
changeset
|
993 if (pixbuf3) g_object_unref(G_OBJECT(pixbuf3)); |
63d5b71d0c68
[gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents:
14705
diff
changeset
|
994 if (pixbuf4) g_object_unref(G_OBJECT(pixbuf4)); |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
995 } |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
996 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
997 add_popular_statuses(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
998 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
999 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1000 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1001 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); |
14739
63d5b71d0c68
[gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents:
14705
diff
changeset
|
1002 if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1003 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1004 status_menu_refresh_iter(status_box); |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1005 gtk_gaim_status_box_refresh(status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1006 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1007 } else { |
15080 | 1008 add_account_statuses(status_box, status_box->account); |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1009 update_to_reflect_account_status(status_box, status_box->account, |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1010 gaim_account_get_active_status(status_box->account)); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1011 } |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1012 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), GTK_TREE_MODEL(status_box->dropdown_store)); |
15116
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1013 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1014 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1015 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1016 static gboolean combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1017 { |
15080 | 1018 gaim_gtk_status_box_popup(GTK_GAIM_STATUS_BOX(w)); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1019 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1020 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1021 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1022 static gboolean imhtml_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1023 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1024 if (event->direction == GDK_SCROLL_UP) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1025 gtk_imhtml_page_up(imhtml); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1026 else if (event->direction == GDK_SCROLL_DOWN) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1027 gtk_imhtml_page_down(imhtml); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1028 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1029 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1030 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1031 static int imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1032 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1033 if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1034 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1035 /* If last inserted character is a tab, then remove the focus from here */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1036 GtkWidget *top = gtk_widget_get_toplevel(w); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1037 g_signal_emit_by_name(G_OBJECT(top), "move_focus", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1038 (event->state & GDK_SHIFT_MASK) ? |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1039 GTK_DIR_TAB_BACKWARD: GTK_DIR_TAB_FORWARD); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1040 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1041 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1042 if (!status_box->typing != 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1043 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1044 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1045 /* Reset the status if Escape was pressed */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1046 if (event->keyval == GDK_Escape) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1047 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1048 g_source_remove(status_box->typing); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1049 status_box->typing = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1050 if (status_box->account != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1051 update_to_reflect_account_status(status_box, status_box->account, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1052 gaim_account_get_active_status(status_box->account)); |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1053 else { |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1054 status_menu_refresh_iter(status_box); |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1055 gtk_gaim_status_box_refresh(status_box); |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1056 } |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1057 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1058 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1059 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1060 gtk_gaim_status_box_pulse_typing(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1061 g_source_remove(status_box->typing); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1062 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1063 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1064 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1065 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1066 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1067 #if GTK_CHECK_VERSION(2,6,0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1068 static gboolean |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1069 dropdown_store_row_separator_func(GtkTreeModel *model, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1070 GtkTreeIter *iter, gpointer data) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1071 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1072 GtkGaimStatusBoxItemType type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1073 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1074 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1075 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1076 if (type == GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1077 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1078 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1079 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1080 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1081 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1082 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1083 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1084 cache_pixbufs(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1085 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1086 GtkIconSize icon_size; |
15080 | 1087 |
1088 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL); | |
15206
348b7f3b2ecd
[gaim-migrate @ 17995]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15163
diff
changeset
|
1089 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1090 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1091 if (status_box->connecting_pixbufs[0] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1092 gdk_pixbuf_unref(status_box->connecting_pixbufs[0]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1093 if (status_box->connecting_pixbufs[1] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1094 gdk_pixbuf_unref(status_box->connecting_pixbufs[1]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1095 if (status_box->connecting_pixbufs[2] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1096 gdk_pixbuf_unref(status_box->connecting_pixbufs[2]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1097 if (status_box->connecting_pixbufs[3] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1098 gdk_pixbuf_unref(status_box->connecting_pixbufs[3]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1099 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1100 status_box->connecting_index = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1101 status_box->connecting_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT0, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1102 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1103 status_box->connecting_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT1, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1104 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1105 status_box->connecting_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT2, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1106 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1107 status_box->connecting_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT3, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1108 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1109 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1110 if (status_box->typing_pixbufs[0] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1111 gdk_pixbuf_unref(status_box->typing_pixbufs[0]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1112 if (status_box->typing_pixbufs[1] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1113 gdk_pixbuf_unref(status_box->typing_pixbufs[1]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1114 if (status_box->typing_pixbufs[2] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1115 gdk_pixbuf_unref(status_box->typing_pixbufs[2]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1116 if (status_box->typing_pixbufs[3] != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1117 gdk_pixbuf_unref(status_box->typing_pixbufs[3]); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1118 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1119 status_box->typing_index = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1120 status_box->typing_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING0, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1121 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1122 status_box->typing_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING1, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1123 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1124 status_box->typing_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING2, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1125 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1126 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING3, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1127 icon_size, "GtkGaimStatusBox"); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1128 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1129 |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1130 static void account_enabled_cb(GaimAccount *acct, GtkGaimStatusBox *status_box) { |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1131 GaimAccount *initial_token_acct = status_box->token_status_account; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1132 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1133 status_box->token_status_account = check_active_accounts_for_identical_statuses(); |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1134 |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1135 /* Regenerate the list if it has changed */ |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1136 if (initial_token_acct != status_box->token_status_account) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1137 gtk_gaim_status_box_regenerate(status_box); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1138 } |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1139 |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1140 } |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1141 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1142 static void |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1143 current_savedstatus_changed_cb(GaimSavedStatus *now, GaimSavedStatus *old, GtkGaimStatusBox *status_box) |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1144 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1145 /* Make sure our current status is added to the list of popular statuses */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1146 gtk_gaim_status_box_regenerate(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1147 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1148 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1149 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1150 spellcheck_prefs_cb(const char *name, GaimPrefType type, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1151 gconstpointer value, gpointer data) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1152 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1153 #ifdef USE_GTKSPELL |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1154 GtkGaimStatusBox *status_box = (GtkGaimStatusBox *)data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1155 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1156 if (value) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1157 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1158 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1159 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1160 GtkSpell *spell; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1161 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1162 gtkspell_detach(spell); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1163 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1164 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1165 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1166 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1167 #if 0 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1168 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1169 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1170 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1171 if (event->button != 1) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1172 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1173 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1174 if (!box->imhtml_visible) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1175 g_signal_emit_by_name(G_OBJECT(box), "changed", NULL, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1176 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1177 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1178 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1179 static gboolean button_pressed_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1180 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1181 if (event->button != 1) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1182 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1183 gtk_combo_box_popup(GTK_COMBO_BOX(box)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1184 // Disabled until button_released_cb works |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1185 // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), TRUE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1186 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1187 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1188 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1189 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1190 static void |
15080 | 1191 gtk_gaim_status_box_list_position (GtkGaimStatusBox *status_box, int *x, int *y, int *width, int *height) |
1192 { | |
15259 | 1193 #if GTK_CHECK_VERSION(2,2,0) |
15080 | 1194 GdkScreen *screen; |
1195 gint monitor_num; | |
1196 GdkRectangle monitor; | |
15259 | 1197 #endif |
15080 | 1198 GtkRequisition popup_req; |
1199 GtkPolicyType hpolicy, vpolicy; | |
1200 | |
1201 gdk_window_get_origin (GTK_WIDGET(status_box)->window, x, y); | |
1202 | |
1203 *x += GTK_WIDGET(status_box)->allocation.x; | |
1204 *y += GTK_WIDGET(status_box)->allocation.y; | |
1205 | |
1206 *width = GTK_WIDGET(status_box)->allocation.width; | |
1207 | |
1208 hpolicy = vpolicy = GTK_POLICY_NEVER; | |
1209 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), | |
1210 hpolicy, vpolicy); | |
1211 gtk_widget_size_request (status_box->popup_frame, &popup_req); | |
1212 | |
1213 if (popup_req.width > *width) | |
1214 { | |
1215 hpolicy = GTK_POLICY_ALWAYS; | |
1216 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), | |
1217 hpolicy, vpolicy); | |
1218 gtk_widget_size_request (status_box->popup_frame, &popup_req); | |
1219 } | |
1220 | |
1221 *height = popup_req.height; | |
1222 | |
15259 | 1223 #if GTK_CHECK_VERSION(2,2,0) |
15080 | 1224 screen = gtk_widget_get_screen (GTK_WIDGET (status_box)); |
1225 monitor_num = gdk_screen_get_monitor_at_window (screen, | |
1226 GTK_WIDGET (status_box)->window); | |
1227 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); | |
1228 | |
1229 if (*x < monitor.x) | |
1230 *x = monitor.x; | |
1231 else if (*x + *width > monitor.x + monitor.width) | |
1232 *x = monitor.x + monitor.width - *width; | |
1233 | |
1234 if (*y + GTK_WIDGET(status_box)->allocation.height + *height <= monitor.y + monitor.height) | |
1235 *y += GTK_WIDGET(status_box)->allocation.height; | |
1236 else if (*y - *height >= monitor.y) | |
1237 *y -= *height; | |
1238 else if (monitor.y + monitor.height - (*y + GTK_WIDGET(status_box)->allocation.height) > *y - monitor.y) | |
1239 { | |
1240 *y += GTK_WIDGET(status_box)->allocation.height; | |
1241 *height = monitor.y + monitor.height - *y; | |
1242 } | |
1243 else | |
1244 { | |
1245 *height = *y - monitor.y; | |
1246 *y = monitor.y; | |
1247 } | |
1248 | |
1249 if (popup_req.height > *height) | |
1250 { | |
1251 vpolicy = GTK_POLICY_ALWAYS; | |
1252 | |
1253 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), | |
1254 hpolicy, vpolicy); | |
1255 } | |
15259 | 1256 #endif |
15080 | 1257 } |
1258 | |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1259 static gboolean |
15084 | 1260 popup_grab_on_window (GdkWindow *window, |
1261 guint32 activate_time, | |
1262 gboolean grab_keyboard) | |
1263 { | |
1264 if ((gdk_pointer_grab (window, TRUE, | |
1265 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | |
1266 GDK_POINTER_MOTION_MASK, | |
1267 NULL, NULL, activate_time) == 0)) | |
1268 { | |
1269 if (!grab_keyboard || | |
1270 gdk_keyboard_grab (window, TRUE, | |
1271 activate_time) == 0) | |
1272 return TRUE; | |
1273 else | |
1274 { | |
15259 | 1275 #if GTK_CHECK_VERSION(2,2,0) |
15084 | 1276 gdk_display_pointer_ungrab (gdk_drawable_get_display (window), |
1277 activate_time); | |
15259 | 1278 #else |
1279 gdk_pointer_ungrab(activate_time); | |
1280 gdk_keyboard_ungrab(activate_time); | |
1281 #endif | |
15084 | 1282 return FALSE; |
1283 } | |
1284 } | |
1285 | |
1286 return FALSE; | |
1287 } | |
1288 | |
1289 | |
15080 | 1290 static void |
1291 gaim_gtk_status_box_popup(GtkGaimStatusBox *box) | |
1292 { | |
1293 int width, height, x, y; | |
1294 gtk_gaim_status_box_list_position (box, &x, &y, &width, &height); | |
1295 | |
1296 gtk_widget_set_size_request (box->popup_window, width, height); | |
1297 gtk_window_move (GTK_WINDOW (box->popup_window), x, y); | |
1298 gtk_widget_show(box->popup_window); | |
15084 | 1299 gtk_widget_grab_focus (box->tree_view); |
1300 if (!popup_grab_on_window (box->popup_window->window, | |
1301 GDK_CURRENT_TIME, TRUE)) { | |
1302 gtk_widget_hide (box->popup_window); | |
1303 return; | |
1304 } | |
1305 gtk_grab_add (box->popup_window); | |
15080 | 1306 box->popup_in_progress = TRUE; |
15084 | 1307 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), |
1308 TRUE); | |
1309 | |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1310 if (box->active_row) { |
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1311 GtkTreePath *path = gtk_tree_row_reference_get_path(box->active_row); |
15274
ca72c74bf5e3
[gaim-migrate @ 18063]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15259
diff
changeset
|
1312 gtk_tree_view_set_cursor(GTK_TREE_VIEW(box->tree_view), path, NULL, FALSE); |
15163
96f3a7286375
[gaim-migrate @ 17948]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15155
diff
changeset
|
1313 gtk_tree_path_free(path); |
15121
e95dfced3030
[gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15119
diff
changeset
|
1314 } |
15080 | 1315 } |
1316 | |
1317 static void | |
1318 gaim_gtk_status_box_popdown(GtkGaimStatusBox *box) { | |
1319 gtk_widget_hide(box->popup_window); | |
1320 box->popup_in_progress = FALSE; | |
1321 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), | |
1322 FALSE); | |
15084 | 1323 gtk_grab_remove (box->popup_window); |
15080 | 1324 } |
1325 | |
1326 | |
1327 static void | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1328 toggled_cb(GtkWidget *widget, GtkGaimStatusBox *box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1329 { |
15080 | 1330 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { |
1331 if (!box->popup_in_progress) | |
1332 gaim_gtk_status_box_popup (box); | |
1333 } else { | |
1334 gaim_gtk_status_box_popdown(box); | |
1335 } | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1336 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1337 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1338 static void |
15021
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1339 buddy_icon_set_cb(const char *filename, GtkGaimStatusBox *box) |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1340 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1341 |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1342 if (box->account) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1343 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account)); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1344 if (plug) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1345 GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1346 if (prplinfo && prplinfo->icon_spec.format) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1347 char *icon = NULL; |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1348 if (filename) |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1349 icon = gaim_gtk_convert_buddy_icon(plug, filename); |
15140 | 1350 gaim_account_set_bool(box->account, "use-global-buddyicon", (filename != NULL)); |
15071 | 1351 gaim_account_set_ui_string(box->account, GAIM_GTK_UI, "non-global-buddyicon-cached-path", icon); |
1352 gaim_account_set_buddy_icon_path(box->account, filename); | |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1353 gaim_account_set_buddy_icon(box->account, icon); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1354 g_free(icon); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1355 } |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1356 } |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1357 } else { |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1358 GList *accounts; |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1359 for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1360 GaimAccount *account = accounts->data; |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1361 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1362 if (plug) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1363 GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1364 if (prplinfo != NULL && |
15140 | 1365 gaim_account_get_bool(account, "use-global-buddyicon", TRUE) && |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1366 prplinfo->icon_spec.format) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1367 char *icon = NULL; |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1368 if (filename) |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1369 icon = gaim_gtk_convert_buddy_icon(plug, filename); |
15071 | 1370 gaim_account_set_buddy_icon_path(account, filename); |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1371 gaim_account_set_buddy_icon(account, icon); |
14254
360c016459d0
[gaim-migrate @ 16936]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14191
diff
changeset
|
1372 g_free(icon); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1373 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1374 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1375 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1376 } |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1377 gtk_gaim_status_box_set_buddy_icon(box, filename); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1378 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1379 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1380 static void |
15021
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1381 remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box) |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1382 { |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1383 if (box->account == NULL) |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1384 /* The pref-connect callback does the actual work */ |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1385 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", NULL); |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1386 else |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1387 buddy_icon_set_cb(NULL, box); |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1388 |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1389 gtk_widget_destroy(box->icon_box_menu); |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1390 box->icon_box_menu = NULL; |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1391 } |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1392 |
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1393 static void |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1394 icon_choose_cb(const char *filename, gpointer data) |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1395 { |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1396 GtkGaimStatusBox *box = data; |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1397 if (filename) { |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1398 if (box->account == NULL) |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1399 /* The pref-connect callback does the actual work */ |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1400 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); |
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1401 else |
15021
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1402 buddy_icon_set_cb(filename, box); |
15018
40364ce5d6e3
[gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15003
diff
changeset
|
1403 } |
14785
36b55cb22bc2
[gaim-migrate @ 17549]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14747
diff
changeset
|
1404 |
36b55cb22bc2
[gaim-migrate @ 17549]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14747
diff
changeset
|
1405 box->buddy_icon_sel = NULL; |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1406 } |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1407 |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1408 static void |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1409 update_buddyicon_cb(const char *name, GaimPrefType type, |
15080 | 1410 gconstpointer value, gpointer data) |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1411 { |
15021
af2debe897c8
[gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15018
diff
changeset
|
1412 buddy_icon_set_cb(value, (GtkGaimStatusBox*) data); |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1413 } |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1414 |
15116
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1415 static void |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1416 treeview_activate_current_selection(GtkGaimStatusBox *status_box, GtkTreePath *path) |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1417 { |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1418 if (status_box->active_row) |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1419 gtk_tree_row_reference_free(status_box->active_row); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1420 |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1421 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1422 |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1423 gaim_gtk_status_box_popdown (status_box); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1424 gtk_gaim_status_box_changed(status_box); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1425 } |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1426 |
15080 | 1427 static gboolean |
1428 treeview_button_release_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *status_box) | |
1429 { | |
1430 GtkTreePath *path = NULL; | |
15084 | 1431 int ret; |
1432 GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event); | |
1433 | |
1434 if (ewidget != status_box->tree_view) { | |
1435 if (ewidget == status_box->toggle_button && | |
15115 | 1436 status_box->popup_in_progress && |
15084 | 1437 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (status_box->toggle_button))) { |
1438 gaim_gtk_status_box_popdown (status_box); | |
1439 return TRUE; | |
1440 } | |
1441 | |
1442 /* released outside treeview */ | |
1443 if (ewidget != status_box->toggle_button) | |
1444 { | |
1445 gaim_gtk_status_box_popdown (status_box); | |
1446 return TRUE; | |
1447 } | |
1448 | |
1449 return FALSE; | |
1450 } | |
1451 | |
1452 ret = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (status_box->tree_view), | |
15080 | 1453 event->x, event->y, |
1454 &path, | |
1455 NULL, NULL, NULL); | |
15116
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1456 |
15080 | 1457 if (!ret) |
1458 return TRUE; /* clicked outside window? */ | |
1459 | |
15116
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1460 treeview_activate_current_selection(status_box, path); |
15080 | 1461 gtk_tree_path_free (path); |
1462 | |
1463 return TRUE; | |
1464 } | |
1465 | |
15116
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1466 static gboolean |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1467 treeview_key_press_event(GtkWidget *widget, |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1468 GdkEventKey *event, GtkGaimStatusBox *box) |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1469 { |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1470 if (box->popup_in_progress) { |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1471 if (event->keyval == GDK_Escape) { |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1472 gaim_gtk_status_box_popdown(box); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1473 return TRUE; |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1474 } else if (event->keyval == GDK_Return) { |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1475 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(box->tree_view)); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1476 GtkTreeIter iter; |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1477 GtkTreePath *path; |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1478 |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1479 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1480 path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1481 treeview_activate_current_selection(box, path); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1482 gtk_tree_path_free (path); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1483 return TRUE; |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1484 } |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1485 } |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1486 } |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1487 return FALSE; |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1488 } |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1489 |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1490 static void |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1491 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1492 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1493 GtkCellRenderer *text_rend; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1494 GtkCellRenderer *icon_rend; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1495 GtkTextBuffer *buffer; |
15080 | 1496 GtkWidget *toplevel; |
1497 GtkTreeSelection *sel; | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1498 |
15080 | 1499 GTK_WIDGET_SET_FLAGS (status_box, GTK_NO_WINDOW); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1500 status_box->imhtml_visible = FALSE; |
14705 | 1501 status_box->network_available = gaim_network_is_available(); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1502 status_box->connecting = FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1503 status_box->typing = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1504 status_box->toggle_button = gtk_toggle_button_new(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1505 status_box->hbox = gtk_hbox_new(FALSE, 6); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1506 status_box->cell_view = gtk_cell_view_new(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1507 status_box->vsep = gtk_vseparator_new(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1508 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); |
15080 | 1509 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1510 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1511 status_box->dropdown_store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
15080 | 1512 ; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1513 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1514 gtk_list_store_append(status_box->store, &(status_box->iter)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1515 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1516 gtk_container_add(GTK_CONTAINER(status_box->toggle_button), status_box->hbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1517 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->cell_view, TRUE, TRUE, 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1518 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->vsep, FALSE, FALSE, 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1519 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->arrow, FALSE, FALSE, 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1520 gtk_widget_show_all(status_box->toggle_button); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1521 #if GTK_CHECK_VERSION(2,4,0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1522 gtk_button_set_focus_on_click(GTK_BUTTON(status_box->toggle_button), FALSE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1523 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1524 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1525 text_rend = gtk_cell_renderer_text_new(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1526 icon_rend = gtk_cell_renderer_pixbuf_new(); |
15080 | 1527 |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1528 status_box->popup_window = gtk_window_new (GTK_WINDOW_POPUP); |
15080 | 1529 |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1530 toplevel = gtk_widget_get_toplevel (GTK_WIDGET (status_box)); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1531 if (GTK_IS_WINDOW (toplevel)) { |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1532 gtk_window_set_transient_for (GTK_WINDOW (status_box->popup_window), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1533 GTK_WINDOW (toplevel)); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1534 } |
15080 | 1535 |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1536 gtk_window_set_resizable (GTK_WINDOW (status_box->popup_window), FALSE); |
15259 | 1537 #if GTK_CHECK_VERSION(2,2,0) |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1538 gtk_window_set_screen (GTK_WINDOW (status_box->popup_window), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1539 gtk_widget_get_screen (GTK_WIDGET (status_box))); |
15259 | 1540 #endif |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1541 status_box->popup_frame = gtk_frame_new (NULL); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1542 gtk_frame_set_shadow_type (GTK_FRAME (status_box->popup_frame), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1543 GTK_SHADOW_ETCHED_IN); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1544 gtk_container_add (GTK_CONTAINER (status_box->popup_window), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1545 status_box->popup_frame); |
15080 | 1546 |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1547 gtk_widget_show (status_box->popup_frame); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1548 |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1549 status_box->scrolled_window = gtk_scrolled_window_new (NULL, NULL); |
15080 | 1550 |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1551 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1552 GTK_POLICY_NEVER, |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1553 GTK_POLICY_NEVER); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1554 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (status_box->scrolled_window), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1555 GTK_SHADOW_NONE); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1556 |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1557 gtk_widget_show (status_box->scrolled_window); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1558 |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1559 gtk_container_add (GTK_CONTAINER (status_box->popup_frame), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1560 status_box->scrolled_window); |
15080 | 1561 |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1562 status_box->tree_view = gtk_tree_view_new (); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1563 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (status_box->tree_view)); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1564 gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1565 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (status_box->tree_view), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1566 FALSE); |
15259 | 1567 #if GTK_CHECK_VERSION(2,6,0) |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1568 gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (status_box->tree_view), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1569 TRUE); |
15259 | 1570 #endif |
15122
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1571 gtk_tree_view_set_model (GTK_TREE_VIEW (status_box->tree_view), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1572 GTK_TREE_MODEL(status_box->dropdown_store)); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1573 status_box->column = gtk_tree_view_column_new (); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1574 gtk_tree_view_append_column (GTK_TREE_VIEW (status_box->tree_view), |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1575 status_box->column); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1576 gtk_tree_view_column_pack_start(status_box->column, icon_rend, FALSE); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1577 gtk_tree_view_column_pack_start(status_box->column, text_rend, TRUE); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1578 gtk_tree_view_column_set_attributes(status_box->column, icon_rend, "pixbuf", ICON_COLUMN, NULL); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1579 gtk_tree_view_column_set_attributes(status_box->column, text_rend, "markup", TEXT_COLUMN, NULL); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1580 gtk_container_add(GTK_CONTAINER(status_box->scrolled_window), status_box->tree_view); |
e3e668ddf945
[gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15121
diff
changeset
|
1581 gtk_widget_show(status_box->tree_view); |
15116
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1582 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN); |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1583 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(status_box->tree_view), |
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1584 gaim_gtk_tree_view_search_equal_func, NULL, NULL); |
15080 | 1585 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1586 #if GTK_CHECK_VERSION(2, 6, 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1587 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1588 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1589 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1590 status_box->icon_rend = gtk_cell_renderer_pixbuf_new(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1591 status_box->text_rend = gtk_cell_renderer_text_new(); |
14803 | 1592 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE); |
1593 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE); | |
1594 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "pixbuf", ICON_COLUMN, NULL); | |
1595 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1596 #if GTK_CHECK_VERSION(2, 6, 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1597 g_object_set(status_box->text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1598 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1599 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1600 status_box->vbox = gtk_vbox_new(0, FALSE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1601 status_box->sw = gaim_gtk_create_imhtml(FALSE, &status_box->imhtml, NULL, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1602 gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1603 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1604 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1605 #if 0 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1606 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1607 G_CALLBACK(button_pressed_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1608 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1609 G_CALLBACK(button_released_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1610 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1611 g_signal_connect(G_OBJECT(status_box->toggle_button), "toggled", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1612 G_CALLBACK(toggled_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1613 g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(imhtml_changed_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1614 g_signal_connect(G_OBJECT(status_box->imhtml), "format_function_toggle", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1615 G_CALLBACK(imhtml_format_changed_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1616 g_signal_connect(G_OBJECT(status_box->imhtml), "key_press_event", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1617 G_CALLBACK(imhtml_remove_focus), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1618 g_signal_connect_swapped(G_OBJECT(status_box->imhtml), "message_send", G_CALLBACK(remove_typing_cb), status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1619 gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1620 #ifdef USE_GTKSPELL |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1621 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1622 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1623 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1624 gtk_widget_set_parent(status_box->vbox, GTK_WIDGET(status_box)); |
15080 | 1625 gtk_widget_show_all(status_box->vbox); |
1626 | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1627 gtk_widget_set_parent(status_box->toggle_button, GTK_WIDGET(status_box)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1628 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1629 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1630 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1631 g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1632 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1633 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml); |
15084 | 1634 g_signal_connect(G_OBJECT(status_box->popup_window), "button_release_event", G_CALLBACK(treeview_button_release_cb), status_box); |
15116
6cb9996fcc97
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15115
diff
changeset
|
1635 g_signal_connect(G_OBJECT(status_box->popup_window), "key_press_event", G_CALLBACK(treeview_key_press_event), status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1636 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1637 #if GTK_CHECK_VERSION(2,6,0) |
15080 | 1638 gtk_tree_view_set_row_separator_func(GTK_TREE_VIEW(status_box->tree_view), dropdown_store_row_separator_func, NULL, NULL); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1639 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1640 |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1641 status_box->token_status_account = check_active_accounts_for_identical_statuses(); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
1642 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1643 cache_pixbufs(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1644 gtk_gaim_status_box_regenerate(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1645 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1646 gaim_signal_connect(gaim_savedstatuses_get_handle(), "savedstatus-changed", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1647 status_box, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1648 GAIM_CALLBACK(current_savedstatus_changed_cb), |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1649 status_box); |
14641
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1650 gaim_signal_connect(gaim_accounts_get_handle(), "account-enabled", status_box, |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1651 GAIM_CALLBACK(account_enabled_cb), |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1652 status_box); |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1653 gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled", status_box, |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1654 GAIM_CALLBACK(account_enabled_cb), |
f0646e3c1c05
[gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14636
diff
changeset
|
1655 status_box); |
14742
f453cc774882
[gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14739
diff
changeset
|
1656 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", status_box, |
f453cc774882
[gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14739
diff
changeset
|
1657 GAIM_CALLBACK(account_status_changed_cb), |
f453cc774882
[gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14739
diff
changeset
|
1658 status_box); |
f453cc774882
[gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14739
diff
changeset
|
1659 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1660 gaim_prefs_connect_callback(status_box, "/gaim/gtk/conversations/spellcheck", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1661 spellcheck_prefs_cb, status_box); |
14636
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1662 gaim_prefs_connect_callback(status_box, "/gaim/gtk/accounts/buddyicon", |
2c09131fffa5
[gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14599
diff
changeset
|
1663 update_buddyicon_cb, status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1664 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1665 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1666 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1667 gtk_gaim_status_box_size_request(GtkWidget *widget, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1668 GtkRequisition *requisition) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1669 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1670 GtkRequisition box_req; |
15080 | 1671 gint border_width = GTK_CONTAINER (widget)->border_width; |
1672 | |
1673 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toggle_button, requisition); | |
1674 | |
1675 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ | |
15113 | 1676 requisition->height = MAX(requisition->height, 30 + (border_width*2)); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1677 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1678 /* If the gtkimhtml is visible, then add some additional padding */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1679 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1680 if (box_req.height > 1) |
15119
4bf1777efb1f
[gaim-migrate @ 17904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15116
diff
changeset
|
1681 requisition->height += box_req.height + border_width * 2; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1682 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1683 requisition->width = 1; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1684 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1685 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1686 /* From gnome-panel */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1687 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1688 do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1689 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1690 gint i, j; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1691 gint width, height, has_alpha, srcrowstride, destrowstride; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1692 guchar *target_pixels; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1693 guchar *original_pixels; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1694 guchar *pixsrc; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1695 guchar *pixdest; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1696 int val; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1697 guchar r,g,b; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1698 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1699 has_alpha = gdk_pixbuf_get_has_alpha (src); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1700 width = gdk_pixbuf_get_width (src); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1701 height = gdk_pixbuf_get_height (src); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1702 srcrowstride = gdk_pixbuf_get_rowstride (src); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1703 destrowstride = gdk_pixbuf_get_rowstride (dest); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1704 target_pixels = gdk_pixbuf_get_pixels (dest); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1705 original_pixels = gdk_pixbuf_get_pixels (src); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1706 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1707 for (i = 0; i < height; i++) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1708 pixdest = target_pixels + i*destrowstride; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1709 pixsrc = original_pixels + i*srcrowstride; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1710 for (j = 0; j < width; j++) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1711 r = *(pixsrc++); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1712 g = *(pixsrc++); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1713 b = *(pixsrc++); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1714 val = r + shift; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1715 *(pixdest++) = CLAMP(val, 0, 255); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1716 val = g + shift; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1717 *(pixdest++) = CLAMP(val, 0, 255); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1718 val = b + shift; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1719 *(pixdest++) = CLAMP(val, 0, 255); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1720 if (has_alpha) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1721 *(pixdest++) = *(pixsrc++); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1722 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1723 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1724 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1725 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1726 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1727 gtk_gaim_status_box_size_allocate(GtkWidget *widget, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1728 GtkAllocation *allocation) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1729 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1730 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1731 GtkRequisition req = {0,0}; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1732 GtkAllocation parent_alc, box_alc, icon_alc; |
14546 | 1733 gint border_width = GTK_CONTAINER (widget)->border_width; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1734 |
15080 | 1735 gtk_widget_size_request(status_box->toggle_button, &req); |
1736 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ | |
1737 | |
15113 | 1738 req.height = MAX(req.height, 30 + (border_width*2)); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1739 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1740 box_alc = *allocation; |
14599 | 1741 |
14546 | 1742 box_alc.width -= (border_width * 2); |
1743 box_alc.height = MAX(1, ((allocation->height - req.height) - (border_width*2))); | |
1744 box_alc.x += border_width; | |
1745 box_alc.y += req.height + border_width; | |
15119
4bf1777efb1f
[gaim-migrate @ 17904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15116
diff
changeset
|
1746 gtk_widget_size_allocate(status_box->vbox, &box_alc); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1747 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1748 parent_alc = *allocation; |
15080 | 1749 parent_alc.height = MAX(1,req.height - (border_width *2)); |
14546 | 1750 parent_alc.width -= (border_width * 2); |
1751 parent_alc.x += border_width; | |
1752 parent_alc.y += border_width; | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1753 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1754 if (status_box->icon_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1755 { |
14561 | 1756 GtkTextDirection dir = gtk_widget_get_direction(widget); |
14546 | 1757 parent_alc.width -= (parent_alc.height + border_width); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1758 icon_alc = *allocation; |
15080 | 1759 icon_alc.height = MAX(1,req.height) - (border_width*2); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1760 icon_alc.width = icon_alc.height; |
14561 | 1761 if (dir == GTK_TEXT_DIR_RTL) { |
1762 icon_alc.x = parent_alc.x; | |
1763 parent_alc.x += icon_alc.width + border_width; | |
1764 } else { | |
1765 icon_alc.x = allocation->width - (icon_alc.width + border_width); | |
1766 } | |
14546 | 1767 icon_alc.y += border_width; |
14599 | 1768 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1769 if (status_box->icon_size != icon_alc.height) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1770 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1771 status_box->icon_size = icon_alc.height; |
14599 | 1772 gtk_gaim_status_box_redisplay_buddy_icon(status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1773 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1774 gtk_widget_size_allocate(status_box->icon_box, &icon_alc); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1775 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1776 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1777 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1778 widget->allocation = *allocation; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1779 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1780 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1781 static gboolean |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1782 gtk_gaim_status_box_expose_event(GtkWidget *widget, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1783 GdkEventExpose *event) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1784 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1785 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1786 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1787 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1788 if (status_box->icon_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1789 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->icon_box, event); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1790 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1791 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1792 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1793 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1794 gtk_gaim_status_box_forall(GtkContainer *container, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1795 gboolean include_internals, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1796 GtkCallback callback, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1797 gpointer callback_data) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1798 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1799 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX (container); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1800 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1801 if (include_internals) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1802 { |
15080 | 1803 (* callback) (status_box->vbox, callback_data); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1804 (* callback) (status_box->toggle_button, callback_data); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1805 (* callback) (status_box->arrow, callback_data); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1806 if (status_box->icon_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1807 (* callback) (status_box->icon_box, callback_data); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1808 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1809 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1810 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1811 GtkWidget * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1812 gtk_gaim_status_box_new() |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1813 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1814 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", NULL, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1815 "iconsel", TRUE, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1816 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1817 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1818 GtkWidget * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1819 gtk_gaim_status_box_new_with_account(GaimAccount *account) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1820 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1821 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", account, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1822 "iconsel", TRUE, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1823 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1824 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1825 /** |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1826 * Add a row to the dropdown menu. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1827 * |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1828 * @param status_box The status box itself. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1829 * @param type A GtkGaimStatusBoxItemType. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1830 * @param pixbuf The icon to associate with this row in the menu. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1831 * @param title The title of this item. For the primitive entries, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1832 * this is something like "Available" or "Away." For |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1833 * the saved statuses, this is something like |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1834 * "My favorite away message!" This should be |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1835 * plaintext (non-markedup) (this function escapes it). |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1836 * @param desc The secondary text for this item. This will be |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1837 * placed on the row below the title, in a dimmer |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1838 * font (generally gray). This text should be plaintext |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1839 * (non-markedup) (this function escapes it). |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1840 * @param data Data to be associated with this row in the dropdown |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1841 * menu. For primitives this is the value of the |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1842 * GaimStatusPrimitive. For saved statuses this is the |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1843 * creation timestamp. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1844 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1845 void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1846 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *title, const char *desc, gpointer data) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1847 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1848 GtkTreeIter iter; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1849 char *text; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1850 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1851 if (desc == NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1852 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1853 text = g_markup_escape_text(title, -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1854 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1855 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1856 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1857 GtkStyle *style; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1858 char aa_color[8]; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1859 gchar *escaped_title, *escaped_desc; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1860 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1861 style = gtk_widget_get_style(GTK_WIDGET(status_box)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1862 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x", |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1863 style->text_aa[GTK_STATE_NORMAL].red >> 8, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1864 style->text_aa[GTK_STATE_NORMAL].green >> 8, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1865 style->text_aa[GTK_STATE_NORMAL].blue >> 8); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1866 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1867 escaped_title = g_markup_escape_text(title, -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1868 escaped_desc = g_markup_escape_text(desc, -1); |
15080 | 1869 text = g_strdup_printf("%s - <span color=\"%s\" size=\"smaller\">%s</span>", |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1870 escaped_title, |
15080 | 1871 aa_color, escaped_desc); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1872 g_free(escaped_title); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1873 g_free(escaped_desc); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1874 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1875 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1876 gtk_list_store_append(status_box->dropdown_store, &iter); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1877 gtk_list_store_set(status_box->dropdown_store, &iter, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1878 TYPE_COLUMN, type, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1879 ICON_COLUMN, pixbuf, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1880 TEXT_COLUMN, text, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1881 TITLE_COLUMN, title, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1882 DESC_COLUMN, desc, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1883 DATA_COLUMN, data, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1884 -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1885 g_free(text); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1886 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1887 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1888 void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1889 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1890 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1891 /* Don't do anything unless GTK actually supports |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1892 * gtk_combo_box_set_row_separator_func */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1893 #if GTK_CHECK_VERSION(2,6,0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1894 GtkTreeIter iter; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1895 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1896 gtk_list_store_append(status_box->dropdown_store, &iter); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1897 gtk_list_store_set(status_box->dropdown_store, &iter, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1898 TYPE_COLUMN, GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1899 -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1900 #endif |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1901 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1902 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1903 void |
14705 | 1904 gtk_gaim_status_box_set_network_available(GtkGaimStatusBox *status_box, gboolean available) |
1905 { | |
1906 if (!status_box) | |
1907 return; | |
1908 status_box->network_available = available; | |
1909 gtk_gaim_status_box_refresh(status_box); | |
1910 } | |
1911 | |
1912 void | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1913 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1914 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1915 if (!status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1916 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1917 status_box->connecting = connecting; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1918 gtk_gaim_status_box_refresh(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1919 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1920 |
14599 | 1921 static void |
1922 gtk_gaim_status_box_redisplay_buddy_icon(GtkGaimStatusBox *status_box) | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1923 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1924 |
14599 | 1925 /* This is sometimes called before the box is shown, and we will not have a size */ |
1926 if (status_box->icon_size <= 0) | |
1927 return; | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1928 |
14599 | 1929 if (status_box->buddy_icon) |
1930 g_object_unref(status_box->buddy_icon); | |
1931 if (status_box->buddy_icon_hover) | |
1932 g_object_unref(status_box->buddy_icon_hover); | |
1933 status_box->buddy_icon = NULL; | |
1934 status_box->buddy_icon_hover = NULL; | |
1935 | |
1936 if ((status_box->buddy_icon_path != NULL) && | |
1937 (*status_box->buddy_icon_path != '\0')) | |
1938 status_box->buddy_icon = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path, | |
1939 status_box->icon_size, status_box->icon_size, FALSE, NULL); | |
1940 | |
1941 if (status_box->buddy_icon == NULL) | |
1942 { | |
1943 /* Show a placeholder icon */ | |
1944 gchar *filename; | |
1945 filename = g_build_filename(DATADIR, "pixmaps", | |
1946 "gaim", "insert-image.png", NULL); | |
1947 status_box->buddy_icon = gdk_pixbuf_new_from_file(filename, NULL); | |
1948 g_free(filename); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1949 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1950 |
14599 | 1951 if (status_box->buddy_icon != NULL) { |
1952 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon); | |
1953 status_box->buddy_icon_hover = gdk_pixbuf_copy(status_box->buddy_icon); | |
1954 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 30); | |
1955 } | |
1956 } | |
1957 | |
1958 void | |
1959 gtk_gaim_status_box_set_buddy_icon(GtkGaimStatusBox *status_box, const char *filename) | |
1960 { | |
1961 g_free(status_box->buddy_icon_path); | |
1962 status_box->buddy_icon_path = g_strdup(filename); | |
1963 | |
1964 gtk_gaim_status_box_redisplay_buddy_icon(status_box); | |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1965 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1966 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1967 const char* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1968 gtk_gaim_status_box_get_buddy_icon(GtkGaimStatusBox *box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1969 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1970 return box->buddy_icon_path; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1971 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1972 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1973 void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1974 gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1975 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1976 if (!status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1977 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1978 if (status_box->connecting_index == 3) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1979 status_box->connecting_index = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1980 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1981 status_box->connecting_index++; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1982 gtk_gaim_status_box_refresh(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1983 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1984 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1985 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1986 gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1987 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1988 if (status_box->typing_index == 3) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1989 status_box->typing_index = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1990 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1991 status_box->typing_index++; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1992 gtk_gaim_status_box_refresh(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1993 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1994 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1995 static gboolean |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1996 message_changed(const char *one, const char *two) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1997 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1998 if (one == NULL && two == NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
1999 return FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2000 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2001 if (one == NULL || two == NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2002 return TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2003 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2004 return (g_utf8_collate(one, two) != 0); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2005 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2006 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2007 static void |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2008 activate_currently_selected_status(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2009 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2010 GtkGaimStatusBoxItemType type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2011 gpointer data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2012 gchar *title; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2013 GtkTreeIter iter; |
15080 | 2014 GtkTreePath *path; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2015 char *message; |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2016 GaimSavedStatus *saved_status = NULL; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2017 gboolean changed = TRUE; |
15080 | 2018 |
2019 path = gtk_tree_row_reference_get_path(status_box->active_row); | |
2020 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path)) | |
14803 | 2021 return; |
15080 | 2022 gtk_tree_path_free(path); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2023 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2024 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2025 TYPE_COLUMN, &type, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2026 DATA_COLUMN, &data, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2027 -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2028 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2029 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2030 * If the currently selected status is "New..." or |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2031 * "Saved..." or a popular status then do nothing. |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2032 * Popular statuses are |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2033 * activated elsewhere, and we update the status_box |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2034 * accordingly by connecting to the savedstatus-changed |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2035 * signal and then calling status_menu_refresh_iter() |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2036 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2037 if (type != GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2038 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2039 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2040 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2041 TITLE_COLUMN, &title, -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2042 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2043 message = gtk_gaim_status_box_get_message(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2044 if (!message || !*message) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2045 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2046 gtk_widget_hide_all(status_box->vbox); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2047 status_box->imhtml_visible = FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2048 if (message != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2049 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2050 g_free(message); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2051 message = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2052 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2053 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2054 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2055 if (status_box->account == NULL) { |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2056 GaimStatusType *acct_status_type = NULL; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2057 GaimStatusPrimitive primitive = GPOINTER_TO_INT(data); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2058 /* Global */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2059 /* Save the newly selected status to prefs.xml and status.xml */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2060 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2061 /* Has the status really been changed? */ |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2062 if (status_box->token_status_account) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2063 gint active; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2064 GaimStatus *status; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2065 const char *id = NULL; |
15080 | 2066 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row); |
2067 active = gtk_tree_path_get_indices(path)[0]; | |
2068 | |
2069 gtk_tree_path_free(path); | |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2070 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2071 status = gaim_account_get_active_status(status_box->token_status_account); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2072 |
15080 | 2073 acct_status_type = find_status_type_by_index(status_box->token_status_account, active); |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2074 id = gaim_status_type_get_id(acct_status_type); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2075 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2076 if (strncmp(id, gaim_status_get_id(status), strlen(id)) == 0) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2077 { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2078 /* Selected status and previous status is the same */ |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2079 if (!message_changed(message, gaim_status_get_attr_string(status, "message"))) |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2080 { |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2081 GaimSavedStatus *ss = gaim_savedstatus_get_current(); |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2082 /* Make sure that statusbox displays the correct thing. |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2083 * It can get messed up if the previous selection was a |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2084 * saved status that wasn't supported by this account */ |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2085 if ((gaim_savedstatus_get_type(ss) == primitive) |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2086 && gaim_savedstatus_is_transient(ss) |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2087 && gaim_savedstatus_has_substatuses(ss)) |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2088 changed = FALSE; |
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2089 } |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2090 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2091 } else { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2092 saved_status = gaim_savedstatus_get_current(); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2093 if (gaim_savedstatus_get_type(saved_status) == primitive && |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2094 !gaim_savedstatus_has_substatuses(saved_status)) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2095 { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2096 if (!message_changed(gaim_savedstatus_get_message(saved_status), message)) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2097 changed = FALSE; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2098 } |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2099 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2100 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2101 if (changed) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2102 { |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2103 /* Manually find the appropriate transient acct */ |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2104 if (status_box->token_status_account) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2105 const GList *iter = gaim_savedstatuses_get_all(); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2106 GList *tmp, *active_accts = gaim_accounts_get_all_active(); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2107 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2108 for (; iter != NULL; iter = iter->next) { |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2109 GaimSavedStatus *ss = iter->data; |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2110 const char *ss_msg = gaim_savedstatus_get_message(ss); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2111 if ((gaim_savedstatus_get_type(ss) == primitive) && gaim_savedstatus_is_transient(ss) && |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2112 gaim_savedstatus_has_substatuses(ss) && /* Must have substatuses */ |
14747
091b6ce6372e
[gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14744
diff
changeset
|
2113 !message_changed(ss_msg, message)) |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2114 { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2115 gboolean found = FALSE; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2116 /* The currently enabled accounts must have substatuses for all the active accts */ |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2117 for(tmp = active_accts; tmp != NULL; tmp = tmp->next) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2118 GaimAccount *acct = tmp->data; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2119 GaimSavedStatusSub *sub = gaim_savedstatus_get_substatus(ss, acct); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2120 if (sub) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2121 const GaimStatusType *sub_type = gaim_savedstatus_substatus_get_type(sub); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2122 if (!strcmp(gaim_status_type_get_id(sub_type), |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2123 gaim_status_type_get_id(acct_status_type))) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2124 found = TRUE; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2125 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2126 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2127 if (!found) |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2128 continue; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2129 saved_status = ss; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2130 break; |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2131 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2132 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2133 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2134 g_list_free(active_accts); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2135 |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2136 } else { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2137 /* If we've used this type+message before, lookup the transient status */ |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2138 saved_status = gaim_savedstatus_find_transient_by_type_and_message(primitive, message); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2139 } |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2140 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2141 /* If this type+message is unique then create a new transient saved status */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2142 if (saved_status == NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2143 { |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2144 saved_status = gaim_savedstatus_new(NULL, primitive); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2145 gaim_savedstatus_set_message(saved_status, message); |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2146 if (status_box->token_status_account) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2147 GList *tmp, *active_accts = gaim_accounts_get_all_active(); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2148 for (tmp = active_accts; tmp != NULL; tmp = tmp->next) { |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2149 gaim_savedstatus_set_substatus(saved_status, |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2150 (GaimAccount*) tmp->data, acct_status_type, message); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2151 } |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2152 g_list_free(active_accts); |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2153 } |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2154 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2155 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2156 /* Set the status for each account */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2157 gaim_savedstatus_activate(saved_status); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2158 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2159 } else { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2160 /* Per-account */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2161 gint active; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2162 GaimStatusType *status_type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2163 GaimStatus *status; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2164 const char *id = NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2165 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2166 status = gaim_account_get_active_status(status_box->account); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2167 |
15155
7696f5dec7d8
[gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15140
diff
changeset
|
2168 active = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(status_box), "active")); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2169 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2170 status_type = find_status_type_by_index(status_box->account, active); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2171 id = gaim_status_type_get_id(status_type); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2172 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2173 if (strncmp(id, gaim_status_get_id(status), strlen(id)) == 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2174 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2175 /* Selected status and previous status is the same */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2176 if (!message_changed(message, gaim_status_get_attr_string(status, "message"))) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2177 changed = FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2178 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2179 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2180 if (changed) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2181 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2182 if (message) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2183 gaim_account_set_status(status_box->account, id, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2184 TRUE, "message", message, NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2185 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2186 gaim_account_set_status(status_box->account, id, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2187 TRUE, NULL); |
15003
1a8aa1ff4c62
[gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14803
diff
changeset
|
2188 |
1a8aa1ff4c62
[gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14803
diff
changeset
|
2189 saved_status = gaim_savedstatus_get_current(); |
1a8aa1ff4c62
[gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14803
diff
changeset
|
2190 if (gaim_savedstatus_is_transient(saved_status)) |
1a8aa1ff4c62
[gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14803
diff
changeset
|
2191 gaim_savedstatus_set_substatus(saved_status, status_box->account, |
1a8aa1ff4c62
[gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14803
diff
changeset
|
2192 status_type, message); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2193 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2194 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2195 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2196 g_free(title); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2197 g_free(message); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2198 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2199 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2200 static void update_size(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2201 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2202 GtkTextBuffer *buffer; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2203 GtkTextIter iter; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2204 int wrapped_lines; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2205 int lines; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2206 GdkRectangle oneline; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2207 int height; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2208 int pad_top, pad_inside, pad_bottom; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2209 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2210 if (!status_box->imhtml_visible) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2211 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2212 if (status_box->vbox != NULL) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2213 gtk_widget_set_size_request(status_box->vbox, -1, -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2214 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2215 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2216 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2217 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2218 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2219 wrapped_lines = 1; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2220 gtk_text_buffer_get_start_iter(buffer, &iter); |
15119
4bf1777efb1f
[gaim-migrate @ 17904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15116
diff
changeset
|
2221 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->imhtml), &iter, &oneline); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2222 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(status_box->imhtml), &iter)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2223 wrapped_lines++; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2224 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2225 lines = gtk_text_buffer_get_line_count(buffer); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2226 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2227 /* Show a maximum of 4 lines */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2228 lines = MIN(lines, 4); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2229 wrapped_lines = MIN(wrapped_lines, 4); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2230 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2231 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2232 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2233 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2234 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2235 height = (oneline.height + pad_top + pad_bottom) * lines; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2236 height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2237 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2238 gtk_widget_set_size_request(status_box->vbox, -1, height + GAIM_HIG_BOX_SPACE); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2239 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2240 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2241 static void remove_typing_cb(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2242 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2243 if (status_box->typing == 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2244 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2245 /* Nothing has changed, so we don't need to do anything */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2246 status_menu_refresh_iter(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2247 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2248 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2249 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2250 g_source_remove(status_box->typing); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2251 status_box->typing = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2252 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2253 activate_currently_selected_status(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2254 gtk_gaim_status_box_refresh(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2255 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2256 |
15080 | 2257 static void gtk_gaim_status_box_changed(GtkGaimStatusBox *status_box) |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2258 { |
15080 | 2259 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2260 GtkTreeIter iter; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2261 GtkGaimStatusBoxItemType type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2262 gpointer data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2263 GList *accounts = NULL, *node; |
15155
7696f5dec7d8
[gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15140
diff
changeset
|
2264 int active; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2265 |
15080 | 2266 |
2267 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path)) | |
14803 | 2268 return; |
15155
7696f5dec7d8
[gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15140
diff
changeset
|
2269 active = gtk_tree_path_get_indices(path)[0]; |
15080 | 2270 gtk_tree_path_free(path); |
15155
7696f5dec7d8
[gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15140
diff
changeset
|
2271 g_object_set_data(G_OBJECT(status_box), "active", GINT_TO_POINTER(active)); |
15080 | 2272 |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2273 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2274 TYPE_COLUMN, &type, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2275 DATA_COLUMN, &data, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2276 -1); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2277 if (status_box->typing != 0) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2278 g_source_remove(status_box->typing); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2279 status_box->typing = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2280 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2281 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2282 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2283 if (type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2284 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2285 GaimSavedStatus *saved; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2286 saved = gaim_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2287 g_return_if_fail(saved != NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2288 gaim_savedstatus_activate(saved); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2289 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2290 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2291 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2292 if (type == GTK_GAIM_STATUS_BOX_TYPE_CUSTOM) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2293 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2294 GaimSavedStatus *saved_status; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2295 saved_status = gaim_savedstatus_get_current(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2296 gaim_gtk_status_editor_show(FALSE, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2297 gaim_savedstatus_is_transient(saved_status) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2298 ? saved_status : NULL); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2299 status_menu_refresh_iter(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2300 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2301 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2302 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2303 if (type == GTK_GAIM_STATUS_BOX_TYPE_SAVED) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2304 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2305 gaim_gtk_status_window_show(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2306 status_menu_refresh_iter(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2307 return; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2308 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2309 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2310 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2311 /* |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2312 * Show the message box whenever the primitive allows for a |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2313 * message attribute on any protocol that is enabled, |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2314 * or our protocol, if we have account set |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2315 */ |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2316 if (status_box->account) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2317 accounts = g_list_prepend(accounts, status_box->account); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2318 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2319 accounts = gaim_accounts_get_all_active(); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2320 status_box->imhtml_visible = FALSE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2321 for (node = accounts; node != NULL; node = node->next) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2322 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2323 GaimAccount *account; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2324 GaimStatusType *status_type; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2325 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2326 account = node->data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2327 status_type = gaim_account_get_status_type_with_primitive(account, GPOINTER_TO_INT(data)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2328 if ((status_type != NULL) && |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2329 (gaim_status_type_get_attr(status_type, "message") != NULL)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2330 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2331 status_box->imhtml_visible = TRUE; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2332 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2333 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2334 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2335 g_list_free(accounts); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2336 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2337 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2338 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2339 if (status_box->imhtml_visible) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2340 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2341 gtk_widget_show_all(status_box->vbox); |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2342 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2343 gtk_widget_grab_focus(status_box->imhtml); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2344 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2345 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2346 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2347 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2348 gtk_widget_hide_all(status_box->vbox); |
14663
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2349 activate_currently_selected_status(status_box); /* This is where we actually set the status */ |
587268c9c6d7
[gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14641
diff
changeset
|
2350 return; |
14191
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2351 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2352 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2353 gtk_gaim_status_box_refresh(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2354 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2355 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2356 static gint |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2357 get_statusbox_index(GtkGaimStatusBox *box, GaimSavedStatus *saved_status) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2358 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2359 gint index; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2360 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2361 switch (gaim_savedstatus_get_type(saved_status)) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2362 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2363 case GAIM_STATUS_AVAILABLE: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2364 index = 0; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2365 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2366 case GAIM_STATUS_AWAY: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2367 index = 1; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2368 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2369 case GAIM_STATUS_INVISIBLE: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2370 index = 2; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2371 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2372 case GAIM_STATUS_OFFLINE: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2373 index = 3; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2374 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2375 default: |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2376 index = -1; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2377 break; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2378 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2379 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2380 return index; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2381 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2382 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2383 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2384 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2385 GtkGaimStatusBox *status_box = (GtkGaimStatusBox*)data; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2386 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2387 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2388 if (status_box->typing != 0) { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2389 gtk_gaim_status_box_pulse_typing(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2390 g_source_remove(status_box->typing); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2391 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2392 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2393 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2394 gtk_gaim_status_box_refresh(status_box); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2395 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2396 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2397 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2398 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2399 imhtml_changed_cb(NULL, data); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2400 } |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2401 |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2402 char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2403 { |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2404 if (status_box->imhtml_visible) |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2405 return gtk_imhtml_get_markup(GTK_IMHTML(status_box->imhtml)); |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2406 else |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2407 return NULL; |
009db0b357b5
This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff
changeset
|
2408 } |