annotate gtk/gtkstatusbox.c @ 15252:7dd8192b1a5c

[gaim-migrate @ 18042] Only prompt to resend a non-acked packet when the result of that packet being dropped would probably be significant. In that case, give a user-friendly notification. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Fri, 22 Dec 2006 05:31:54 +0000
parents 348b7f3b2ecd
children cfdd47296dbc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
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);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
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);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
82 static void gaim_gtk_status_box_popup(GtkGaimStatusBox *box);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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);
15020
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
150 status_box_type = g_type_register_static(GTK_TYPE_CONTAINER,
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
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) {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
202 path = gtk_tree_path_new_from_indices(status_no, -1);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
203 if (status_box->active_row)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
204 gtk_tree_row_reference_free(status_box->active_row);
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
205 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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 {
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
240 if (event->button == 3) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
241 GtkWidget *menu_item;
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
242
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
243 if (box->icon_box_menu)
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
244 gtk_widget_destroy(box->icon_box_menu);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
245
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
246 box->icon_box_menu = gtk_menu_new();
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
247
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
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: 15002
diff changeset
249 G_CALLBACK(remove_buddy_icon_cb),
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
250 box, 0, 0, NULL);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
251 if (gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon") == NULL)
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
252 gtk_widget_set_sensitive(menu_item, FALSE);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
253
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
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: 15002
diff changeset
255 event->button, event->time);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
256
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
257 } else {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
258 if (box->buddy_icon_sel) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
259 gtk_window_present(GTK_WINDOW(box->buddy_icon_sel));
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
260 return FALSE;
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
261 }
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
262
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
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: 15002
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
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
269 static void
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
270 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
271 GtkSelectionData *sd, guint info, guint t, GtkGaimStatusBox *box)
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
272 {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
273 gchar *name = (gchar *)sd->data;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
274
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
275 if ((sd->length >= 0) && (sd->format == 8)) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
276 /* Well, it looks like the drag event was cool.
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
277 * Let's do something with it */
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
278 if (!g_ascii_strncasecmp(name, "file://", 7)) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
279 GError *converr = NULL;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
280 gchar *tmp, *rtmp;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
281
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
282 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
283 gaim_debug(GAIM_DEBUG_ERROR, "buddyicon", "%s\n",
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
284 (converr ? converr->message :
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
285 "g_filename_from_uri error"));
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
286 return;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
287 }
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
288 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
289 *rtmp = '\0';
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
290 icon_choose_cb(tmp, box);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
291 g_free(tmp);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
292 }
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
293 gtk_drag_finish(dc, TRUE, FALSE, t);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
294 }
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
295 gtk_drag_finish(dc, FALSE, FALSE, t);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
296 }
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
297
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
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
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
315
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
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
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
318 {"text/uri-list", 0, 1},
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
319 {"STRING", 0, 2}
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
320 };
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
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();
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
330 gtk_widget_set_parent(status_box->icon_box, GTK_WIDGET(status_box));
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
331 gtk_widget_show(status_box->icon_box);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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 &&
15139
63d554c2675d [gaim-migrate @ 17925]
Mark Huetsch <markhuetsch>
parents: 15121
diff changeset
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
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
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
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
348 /* Set up DND */
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
349 gtk_drag_dest_set(status_box->icon_box,
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
350 GTK_DEST_DEFAULT_MOTION |
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
351 GTK_DEST_DEFAULT_DROP,
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
352 dnd_targets,
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
353 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
354 GDK_ACTION_COPY);
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
355
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
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);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
381 if (statusbox->icon_box_menu)
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
382 gtk_widget_destroy(statusbox->icon_box_menu);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
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;
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
453 static GType
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
454 gtk_gaim_status_box_child_type (GtkContainer *container)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
455 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
456 return GTK_TYPE_WIDGET;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
457 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
521 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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) */
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
543 path = gtk_tree_row_reference_get_path(status_box->active_row);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
544 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
545 return;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
546 gtk_tree_path_free(path);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
547
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
548 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
549 TYPE_COLUMN, &type,
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
550 DATA_COLUMN, &data,
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
551 -1);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
552 if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE)
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
553 primary = g_strdup(gaim_primitive_get_name_from_type(GPOINTER_TO_INT(data)));
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
554 else
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
555 /* This should never happen, but just in case... */
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
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
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
570 else if (!status_box->network_available)
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
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)),
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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),
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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) {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
627 text = g_strdup_printf("%s - <span size=\"smaller\" color=\"%s\">%s</span>",
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
628 gaim_account_get_username(status_box->account),
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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) {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
631 text = g_strdup_printf("%s<span size=\"smaller\" color=\"%s\"> - %s</span>",
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
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;
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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! */
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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);
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
759
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
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! */
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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 }
15154
7696f5dec7d8 [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15139
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
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
771 if (status_box->active_row)
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
772 gtk_tree_row_reference_free(status_box->active_row);
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
773 if (path) { /* path should never be NULL */
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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: 15118
diff changeset
775 gtk_tree_path_free(path);
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
776 } else
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
777 status_box->active_row = NULL;
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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 {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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),
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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 */
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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) {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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);
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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 {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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 }
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1012 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), GTK_TREE_MODEL(status_box->dropdown_store));
15115
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
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 {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
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));
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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);
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1055 gtk_gaim_status_box_refresh(status_box);
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
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;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1087
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1088 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL);
15205
348b7f3b2ecd [gaim-migrate @ 17995]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15162
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
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1191 gtk_gaim_status_box_list_position (GtkGaimStatusBox *status_box, int *x, int *y, int *width, int *height)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1192 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1193 GdkScreen *screen;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1194 gint monitor_num;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1195 GdkRectangle monitor;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1196 GtkRequisition popup_req;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1197 GtkPolicyType hpolicy, vpolicy;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1198
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1199 gdk_window_get_origin (GTK_WIDGET(status_box)->window, x, y);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1200
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1201 *x += GTK_WIDGET(status_box)->allocation.x;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1202 *y += GTK_WIDGET(status_box)->allocation.y;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1203
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1204 *width = GTK_WIDGET(status_box)->allocation.width;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1205
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1206 hpolicy = vpolicy = GTK_POLICY_NEVER;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1207 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window),
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1208 hpolicy, vpolicy);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1209 gtk_widget_size_request (status_box->popup_frame, &popup_req);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1210
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1211 if (popup_req.width > *width)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1212 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1213 hpolicy = GTK_POLICY_ALWAYS;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1214 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window),
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1215 hpolicy, vpolicy);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1216 gtk_widget_size_request (status_box->popup_frame, &popup_req);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1217 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1218
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1219 *height = popup_req.height;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1220
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1221 screen = gtk_widget_get_screen (GTK_WIDGET (status_box));
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1222 monitor_num = gdk_screen_get_monitor_at_window (screen,
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1223 GTK_WIDGET (status_box)->window);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1224 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1225
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1226 if (*x < monitor.x)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1227 *x = monitor.x;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1228 else if (*x + *width > monitor.x + monitor.width)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1229 *x = monitor.x + monitor.width - *width;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1230
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1231 if (*y + GTK_WIDGET(status_box)->allocation.height + *height <= monitor.y + monitor.height)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1232 *y += GTK_WIDGET(status_box)->allocation.height;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1233 else if (*y - *height >= monitor.y)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1234 *y -= *height;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1235 else if (monitor.y + monitor.height - (*y + GTK_WIDGET(status_box)->allocation.height) > *y - monitor.y)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1236 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1237 *y += GTK_WIDGET(status_box)->allocation.height;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1238 *height = monitor.y + monitor.height - *y;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1239 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1240 else
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1241 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1242 *height = *y - monitor.y;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1243 *y = monitor.y;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1244 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1245
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1246 if (popup_req.height > *height)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1247 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1248 vpolicy = GTK_POLICY_ALWAYS;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1249
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1250 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window),
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1251 hpolicy, vpolicy);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1252 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1253 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1254
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1255 static gboolean
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1256 popup_grab_on_window (GdkWindow *window,
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1257 guint32 activate_time,
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1258 gboolean grab_keyboard)
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1259 {
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1260 if ((gdk_pointer_grab (window, TRUE,
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1261 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1262 GDK_POINTER_MOTION_MASK,
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1263 NULL, NULL, activate_time) == 0))
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1264 {
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1265 if (!grab_keyboard ||
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1266 gdk_keyboard_grab (window, TRUE,
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1267 activate_time) == 0)
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1268 return TRUE;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1269 else
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1270 {
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1271 gdk_display_pointer_ungrab (gdk_drawable_get_display (window),
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1272 activate_time);
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1273 return FALSE;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1274 }
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1275 }
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1276
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1277 return FALSE;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1278 }
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1279
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1280
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1281 static void
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1282 gaim_gtk_status_box_popup(GtkGaimStatusBox *box)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1283 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1284 int width, height, x, y;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1285 gtk_gaim_status_box_list_position (box, &x, &y, &width, &height);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1286
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1287 gtk_widget_set_size_request (box->popup_window, width, height);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1288 gtk_window_move (GTK_WINDOW (box->popup_window), x, y);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1289 gtk_widget_show(box->popup_window);
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1290 gtk_widget_grab_focus (box->tree_view);
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1291 if (!popup_grab_on_window (box->popup_window->window,
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1292 GDK_CURRENT_TIME, TRUE)) {
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1293 gtk_widget_hide (box->popup_window);
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1294 return;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1295 }
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1296 gtk_grab_add (box->popup_window);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1297 box->popup_in_progress = TRUE;
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1298 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1299 TRUE);
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1300
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1301 if (box->active_row) {
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1302 GtkTreePath *path = gtk_tree_row_reference_get_path(box->active_row);
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1303 GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (box->tree_view));
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1304 gtk_tree_selection_select_path(sel, path);
15162
96f3a7286375 [gaim-migrate @ 17948]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15154
diff changeset
1305 gtk_tree_path_free(path);
15120
e95dfced3030 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15118
diff changeset
1306 }
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1307 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1308
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1309 static void
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1310 gaim_gtk_status_box_popdown(GtkGaimStatusBox *box) {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1311 gtk_widget_hide(box->popup_window);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1312 box->popup_in_progress = FALSE;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1313 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1314 FALSE);
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1315 gtk_grab_remove (box->popup_window);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1316 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1317
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1318
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1319 static void
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1320 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
1321 {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1322 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1323 if (!box->popup_in_progress)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1324 gaim_gtk_status_box_popup (box);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1325 } else {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1326 gaim_gtk_status_box_popdown(box);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1327 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1328 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1329
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1330 static void
15020
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1331 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
1332 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1333
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1334 if (box->account) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1335 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account));
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1336 if (plug) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1337 GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1338 if (prplinfo && prplinfo->icon_spec.format) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1339 char *icon = NULL;
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1340 if (filename)
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1341 icon = gaim_gtk_convert_buddy_icon(plug, filename);
15139
63d554c2675d [gaim-migrate @ 17925]
Mark Huetsch <markhuetsch>
parents: 15121
diff changeset
1342 gaim_account_set_bool(box->account, "use-global-buddyicon", (filename != NULL));
15070
97ae8709d6dc [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch>
parents: 15020
diff changeset
1343 gaim_account_set_ui_string(box->account, GAIM_GTK_UI, "non-global-buddyicon-cached-path", icon);
97ae8709d6dc [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch>
parents: 15020
diff changeset
1344 gaim_account_set_buddy_icon_path(box->account, filename);
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1345 gaim_account_set_buddy_icon(box->account, icon);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1346 g_free(icon);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1347 }
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1348 }
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1349 } else {
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1350 GList *accounts;
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1351 for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1352 GaimAccount *account = accounts->data;
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1353 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
1354 if (plug) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1355 GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug);
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1356 if (prplinfo != NULL &&
15139
63d554c2675d [gaim-migrate @ 17925]
Mark Huetsch <markhuetsch>
parents: 15121
diff changeset
1357 gaim_account_get_bool(account, "use-global-buddyicon", TRUE) &&
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1358 prplinfo->icon_spec.format) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1359 char *icon = NULL;
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1360 if (filename)
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1361 icon = gaim_gtk_convert_buddy_icon(plug, filename);
15070
97ae8709d6dc [gaim-migrate @ 17854]
Mark Huetsch <markhuetsch>
parents: 15020
diff changeset
1362 gaim_account_set_buddy_icon_path(account, filename);
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1363 gaim_account_set_buddy_icon(account, icon);
14254
360c016459d0 [gaim-migrate @ 16936]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14191
diff changeset
1364 g_free(icon);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1365 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1366 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1367 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1368 }
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1369 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
1370 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1371
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1372 static void
15020
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1373 remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box)
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1374 {
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1375 if (box->account == NULL)
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1376 /* The pref-connect callback does the actual work */
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1377 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", NULL);
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1378 else
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1379 buddy_icon_set_cb(NULL, box);
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1380
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1381 gtk_widget_destroy(box->icon_box_menu);
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1382 box->icon_box_menu = NULL;
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1383 }
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1384
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1385 static void
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1386 icon_choose_cb(const char *filename, gpointer data)
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1387 {
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1388 GtkGaimStatusBox *box = data;
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1389 if (filename) {
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1390 if (box->account == NULL)
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1391 /* The pref-connect callback does the actual work */
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1392 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename);
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1393 else
15020
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1394 buddy_icon_set_cb(filename, box);
15017
40364ce5d6e3 [gaim-migrate @ 17799]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15002
diff changeset
1395 }
14785
36b55cb22bc2 [gaim-migrate @ 17549]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14747
diff changeset
1396
36b55cb22bc2 [gaim-migrate @ 17549]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14747
diff changeset
1397 box->buddy_icon_sel = NULL;
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1398 }
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1399
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1400 static void
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1401 update_buddyicon_cb(const char *name, GaimPrefType type,
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1402 gconstpointer value, gpointer data)
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1403 {
15020
af2debe897c8 [gaim-migrate @ 17802]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15017
diff changeset
1404 buddy_icon_set_cb(value, (GtkGaimStatusBox*) data);
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1405 }
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1406
15115
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1407 static void
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1408 treeview_activate_current_selection(GtkGaimStatusBox *status_box, GtkTreePath *path)
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1409 {
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1410 if (status_box->active_row)
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1411 gtk_tree_row_reference_free(status_box->active_row);
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1412
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1413 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: 15114
diff changeset
1414
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1415 gaim_gtk_status_box_popdown (status_box);
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1416 gtk_gaim_status_box_changed(status_box);
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1417 }
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1418
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1419 static gboolean
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1420 treeview_button_release_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *status_box)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1421 {
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1422 GtkTreePath *path = NULL;
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1423 int ret;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1424 GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event);
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1425
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1426 if (ewidget != status_box->tree_view) {
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1427 if (ewidget == status_box->toggle_button &&
15114
c18c02aeb366 [gaim-migrate @ 17900]
Sean Egan <seanegan@gmail.com>
parents: 15112
diff changeset
1428 status_box->popup_in_progress &&
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1429 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (status_box->toggle_button))) {
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1430 gaim_gtk_status_box_popdown (status_box);
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1431 return TRUE;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1432 }
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1433
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1434 /* released outside treeview */
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1435 if (ewidget != status_box->toggle_button)
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1436 {
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1437 gaim_gtk_status_box_popdown (status_box);
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1438 return TRUE;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1439 }
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1440
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1441 return FALSE;
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1442 }
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1443
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1444 ret = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (status_box->tree_view),
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1445 event->x, event->y,
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1446 &path,
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1447 NULL, NULL, NULL);
15115
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1448
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1449 if (!ret)
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1450 return TRUE; /* clicked outside window? */
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1451
15115
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1452 treeview_activate_current_selection(status_box, path);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1453 gtk_tree_path_free (path);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1454
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1455 return TRUE;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1456 }
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1457
15115
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1458 static gboolean
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1459 treeview_key_press_event(GtkWidget *widget,
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1460 GdkEventKey *event, GtkGaimStatusBox *box)
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1461 {
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1462 if (box->popup_in_progress) {
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1463 if (event->keyval == GDK_Escape) {
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1464 gaim_gtk_status_box_popdown(box);
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1465 return TRUE;
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1466 } else if (event->keyval == GDK_Return) {
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1467 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(box->tree_view));
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1468 GtkTreeIter iter;
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1469 GtkTreePath *path;
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1470
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1471 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) {
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1472 path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter);
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1473 treeview_activate_current_selection(box, path);
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1474 gtk_tree_path_free (path);
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1475 return TRUE;
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1476 }
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1477 }
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1478 }
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1479 return FALSE;
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1480 }
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1481
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1482 static void
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1483 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
1484 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1485 GtkCellRenderer *text_rend;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1486 GtkCellRenderer *icon_rend;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1487 GtkTextBuffer *buffer;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1488 GtkWidget *toplevel;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1489 GtkTreeSelection *sel;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1490
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1491 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
1492 status_box->imhtml_visible = FALSE;
14705
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1493 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
1494 status_box->connecting = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1495 status_box->typing = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1496 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
1497 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
1498 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
1499 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
1500 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1501
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1502 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
1503 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);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1504 ;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1505 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
1506 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
1507
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1508 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
1509 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
1510 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
1511 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
1512 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
1513 #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
1514 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
1515 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1516
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1517 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
1518 icon_rend = gtk_cell_renderer_pixbuf_new();
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1519
15121
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1520 status_box->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1521
15121
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1522 toplevel = gtk_widget_get_toplevel (GTK_WIDGET (status_box));
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1523 if (GTK_IS_WINDOW (toplevel)) {
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1524 gtk_window_set_transient_for (GTK_WINDOW (status_box->popup_window),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1525 GTK_WINDOW (toplevel));
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1526 }
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1527
15121
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1528 gtk_window_set_resizable (GTK_WINDOW (status_box->popup_window), FALSE);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1529 gtk_window_set_screen (GTK_WINDOW (status_box->popup_window),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1530 gtk_widget_get_screen (GTK_WIDGET (status_box)));
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1531 status_box->popup_frame = gtk_frame_new (NULL);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1532 gtk_frame_set_shadow_type (GTK_FRAME (status_box->popup_frame),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1533 GTK_SHADOW_ETCHED_IN);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1534 gtk_container_add (GTK_CONTAINER (status_box->popup_window),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1535 status_box->popup_frame);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1536
15121
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1537 gtk_widget_show (status_box->popup_frame);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1538
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1539 status_box->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1540
15121
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1541 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1542 GTK_POLICY_NEVER,
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1543 GTK_POLICY_NEVER);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1544 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (status_box->scrolled_window),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1545 GTK_SHADOW_NONE);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1546
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1547 gtk_widget_show (status_box->scrolled_window);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1548
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1549 gtk_container_add (GTK_CONTAINER (status_box->popup_frame),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1550 status_box->scrolled_window);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1551
15121
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1552 status_box->tree_view = gtk_tree_view_new ();
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1553 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (status_box->tree_view));
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1554 gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1555 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (status_box->tree_view),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1556 FALSE);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1557 gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (status_box->tree_view),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1558 TRUE);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1559 gtk_tree_view_set_model (GTK_TREE_VIEW (status_box->tree_view),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1560 GTK_TREE_MODEL(status_box->dropdown_store));
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1561 status_box->column = gtk_tree_view_column_new ();
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1562 gtk_tree_view_append_column (GTK_TREE_VIEW (status_box->tree_view),
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1563 status_box->column);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1564 gtk_tree_view_column_pack_start(status_box->column, icon_rend, FALSE);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1565 gtk_tree_view_column_pack_start(status_box->column, text_rend, TRUE);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1566 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: 15120
diff changeset
1567 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: 15120
diff changeset
1568 gtk_container_add(GTK_CONTAINER(status_box->scrolled_window), status_box->tree_view);
e3e668ddf945 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15120
diff changeset
1569 gtk_widget_show(status_box->tree_view);
15115
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1570 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: 15114
diff changeset
1571 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: 15114
diff changeset
1572 gaim_gtk_tree_view_search_equal_func, NULL, NULL);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1573
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1574 #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
1575 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
1576 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1577
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1578 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
1579 status_box->text_rend = gtk_cell_renderer_text_new();
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1580 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1581 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1582 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "pixbuf", ICON_COLUMN, NULL);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1583 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
1584 #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
1585 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
1586 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1587
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1588 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
1589 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
1590 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
1591
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1592 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
1593 #if 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1594 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
1595 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
1596 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
1597 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
1598 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1599 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
1600 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
1601 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
1602 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
1603 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
1604 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
1605 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
1606 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
1607 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
1608 #ifdef USE_GTKSPELL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1609 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
1610 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
1611 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1612 gtk_widget_set_parent(status_box->vbox, GTK_WIDGET(status_box));
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1613 gtk_widget_show_all(status_box->vbox);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1614
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1615 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
1616
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1617 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
1618
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1619 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
1620 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
1621 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml);
15083
8fc4d62b14ad [gaim-migrate @ 17869]
Sean Egan <seanegan@gmail.com>
parents: 15079
diff changeset
1622 g_signal_connect(G_OBJECT(status_box->popup_window), "button_release_event", G_CALLBACK(treeview_button_release_cb), status_box);
15115
6cb9996fcc97 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15114
diff changeset
1623 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
1624
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1625 #if GTK_CHECK_VERSION(2,6,0)
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1626 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
1627 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1628
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1629 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
1630
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1631 cache_pixbufs(status_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1632 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
1633
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1634 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
1635 status_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1636 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
1637 status_box);
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1638 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
1639 GAIM_CALLBACK(account_enabled_cb),
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1640 status_box);
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1641 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
1642 GAIM_CALLBACK(account_enabled_cb),
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1643 status_box);
14742
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
1644 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
1645 GAIM_CALLBACK(account_status_changed_cb),
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
1646 status_box);
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
1647
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1648 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
1649 spellcheck_prefs_cb, status_box);
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1650 gaim_prefs_connect_callback(status_box, "/gaim/gtk/accounts/buddyicon",
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1651 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
1652 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1653
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1654 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1655 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
1656 GtkRequisition *requisition)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1657 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1658 GtkRequisition box_req;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1659 gint border_width = GTK_CONTAINER (widget)->border_width;
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1660
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1661 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toggle_button, requisition);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1662
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1663 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
15112
072987463f90 [gaim-migrate @ 17898]
Sean Egan <seanegan@gmail.com>
parents: 15083
diff changeset
1664 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
1665
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1666 /* 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
1667 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
1668 if (box_req.height > 1)
15118
4bf1777efb1f [gaim-migrate @ 17904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15115
diff changeset
1669 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
1670
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1671 requisition->width = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1672 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1673
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1674 /* From gnome-panel */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1675 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1676 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
1677 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1678 gint i, j;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1679 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
1680 guchar *target_pixels;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1681 guchar *original_pixels;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1682 guchar *pixsrc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1683 guchar *pixdest;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1684 int val;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1685 guchar r,g,b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1686
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1687 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
1688 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
1689 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
1690 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
1691 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
1692 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
1693 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
1694
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1695 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
1696 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
1697 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
1698 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
1699 r = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1700 g = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1701 b = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1702 val = r + shift;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1703 *(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
1704 val = g + shift;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1705 *(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
1706 val = b + shift;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1707 *(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
1708 if (has_alpha)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1709 *(pixdest++) = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1710 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1711 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1712 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1713
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1714 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1715 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
1716 GtkAllocation *allocation)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1717 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1718 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
1719 GtkRequisition req = {0,0};
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1720 GtkAllocation parent_alc, box_alc, icon_alc;
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1721 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
1722
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1723 gtk_widget_size_request(status_box->toggle_button, &req);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1724 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1725
15112
072987463f90 [gaim-migrate @ 17898]
Sean Egan <seanegan@gmail.com>
parents: 15083
diff changeset
1726 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
1727
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1728 box_alc = *allocation;
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1729
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1730 box_alc.width -= (border_width * 2);
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1731 box_alc.height = MAX(1, ((allocation->height - req.height) - (border_width*2)));
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1732 box_alc.x += border_width;
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1733 box_alc.y += req.height + border_width;
15118
4bf1777efb1f [gaim-migrate @ 17904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15115
diff changeset
1734 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
1735
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1736 parent_alc = *allocation;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1737 parent_alc.height = MAX(1,req.height - (border_width *2));
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1738 parent_alc.width -= (border_width * 2);
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1739 parent_alc.x += border_width;
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1740 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
1741
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1742 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
1743 {
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1744 GtkTextDirection dir = gtk_widget_get_direction(widget);
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1745 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
1746 icon_alc = *allocation;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1747 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
1748 icon_alc.width = icon_alc.height;
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1749 if (dir == GTK_TEXT_DIR_RTL) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1750 icon_alc.x = parent_alc.x;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1751 parent_alc.x += icon_alc.width + border_width;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1752 } else {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1753 icon_alc.x = allocation->width - (icon_alc.width + border_width);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1754 }
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1755 icon_alc.y += border_width;
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1756
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1757 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
1758 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1759 status_box->icon_size = icon_alc.height;
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1760 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
1761 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1762 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
1763 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1764
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1765 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
1766 widget->allocation = *allocation;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1767 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1768
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1769 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1770 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
1771 GdkEventExpose *event)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1772 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1773 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
1774 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
1775 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
1776 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
1777 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
1778 return FALSE;
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 void
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_forall(GtkContainer *container,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1783 gboolean include_internals,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1784 GtkCallback callback,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1785 gpointer callback_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1786 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1787 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
1788
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1789 if (include_internals)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1790 {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1791 (* 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
1792 (* 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
1793 (* 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
1794 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
1795 (* 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
1796 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1797 }
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 GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1800 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
1801 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1802 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
1803 "iconsel", TRUE, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1804 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1805
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1806 GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1807 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
1808 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1809 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
1810 "iconsel", TRUE, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1811 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1812
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 * 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
1815 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1816 * @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
1817 * @param type A GtkGaimStatusBoxItemType.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1818 * @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
1819 * @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
1820 * 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
1821 * 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
1822 * "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
1823 * 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
1824 * @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
1825 * 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
1826 * 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
1827 * (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
1828 * @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
1829 * 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
1830 * 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
1831 * creation timestamp.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1832 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1833 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1834 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
1835 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1836 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1837 char *text;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1838
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1839 if (desc == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1840 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1841 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
1842 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1843 else
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 GtkStyle *style;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1846 char aa_color[8];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1847 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
1848
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1849 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
1850 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
1851 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
1852 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
1853 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
1854
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1855 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
1856 escaped_desc = g_markup_escape_text(desc, -1);
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1857 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
1858 escaped_title,
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
1859 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
1860 g_free(escaped_title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1861 g_free(escaped_desc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1862 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1863
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1864 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
1865 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
1866 TYPE_COLUMN, type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1867 ICON_COLUMN, pixbuf,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1868 TEXT_COLUMN, text,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1869 TITLE_COLUMN, title,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1870 DESC_COLUMN, desc,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1871 DATA_COLUMN, data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1872 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1873 g_free(text);
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 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1877 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
1878 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1879 /* 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
1880 * 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
1881 #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
1882 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1883
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1884 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
1885 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
1886 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
1887 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1888 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1889 }
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 void
14705
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1892 gtk_gaim_status_box_set_network_available(GtkGaimStatusBox *status_box, gboolean available)
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1893 {
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1894 if (!status_box)
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1895 return;
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1896 status_box->network_available = available;
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1897 gtk_gaim_status_box_refresh(status_box);
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1898 }
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1899
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1900 void
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1901 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
1902 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1903 if (!status_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1904 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1905 status_box->connecting = connecting;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1906 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
1907 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1908
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1909 static void
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1910 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
1911 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1912
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1913 /* This is sometimes called before the box is shown, and we will not have a size */
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1914 if (status_box->icon_size <= 0)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1915 return;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1916
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1917 if (status_box->buddy_icon)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1918 g_object_unref(status_box->buddy_icon);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1919 if (status_box->buddy_icon_hover)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1920 g_object_unref(status_box->buddy_icon_hover);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1921 status_box->buddy_icon = NULL;
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1922 status_box->buddy_icon_hover = NULL;
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1923
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1924 if ((status_box->buddy_icon_path != NULL) &&
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1925 (*status_box->buddy_icon_path != '\0'))
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1926 status_box->buddy_icon = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path,
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1927 status_box->icon_size, status_box->icon_size, FALSE, NULL);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1928
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1929 if (status_box->buddy_icon == NULL)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1930 {
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1931 /* Show a placeholder icon */
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1932 gchar *filename;
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1933 filename = g_build_filename(DATADIR, "pixmaps",
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1934 "gaim", "insert-image.png", NULL);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1935 status_box->buddy_icon = gdk_pixbuf_new_from_file(filename, NULL);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1936 g_free(filename);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1937 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1938
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1939 if (status_box->buddy_icon != NULL) {
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1940 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1941 status_box->buddy_icon_hover = gdk_pixbuf_copy(status_box->buddy_icon);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1942 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 30);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1943 }
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1944 }
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1945
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1946 void
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1947 gtk_gaim_status_box_set_buddy_icon(GtkGaimStatusBox *status_box, const char *filename)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1948 {
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1949 g_free(status_box->buddy_icon_path);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1950 status_box->buddy_icon_path = g_strdup(filename);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1951
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1952 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
1953 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1954
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1955 const char*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1956 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
1957 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1958 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
1959 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1960
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1961 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1962 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
1963 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1964 if (!status_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1965 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1966 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
1967 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
1968 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1969 status_box->connecting_index++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1970 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
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 static 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_typing(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->typing_index == 3)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1977 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
1978 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1979 status_box->typing_index++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1980 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
1981 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1982
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1983 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1984 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
1985 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1986 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
1987 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1988
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1989 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
1990 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1991
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1992 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
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 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1996 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
1997 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1998 GtkGaimStatusBoxItemType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1999 gpointer data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2000 gchar *title;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2001 GtkTreeIter iter;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2002 GtkTreePath *path;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2003 char *message;
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2004 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
2005 gboolean changed = TRUE;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2006
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2007 path = gtk_tree_row_reference_get_path(status_box->active_row);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2008 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
2009 return;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2010 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
2011
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2012 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
2013 TYPE_COLUMN, &type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2014 DATA_COLUMN, &data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2015 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2016
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2017 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2018 * 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
2019 * "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
2020 * Popular statuses are
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2021 * 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
2022 * 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
2023 * 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
2024 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2025 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
2026 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2027
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2028 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
2029 TITLE_COLUMN, &title, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2030
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2031 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
2032 if (!message || !*message)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2033 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2034 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
2035 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
2036 if (message != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2037 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2038 g_free(message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2039 message = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2040 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2041 }
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 if (status_box->account == NULL) {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2044 GaimStatusType *acct_status_type = NULL;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2045 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
2046 /* Global */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2047 /* 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
2048
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2049 /* Has the status really been changed? */
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2050 if (status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2051 gint active;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2052 GaimStatus *status;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2053 const char *id = NULL;
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2054 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row);
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2055 active = gtk_tree_path_get_indices(path)[0];
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2056
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2057 gtk_tree_path_free(path);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2058
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2059 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
2060
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2061 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
2062 id = gaim_status_type_get_id(acct_status_type);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2063
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2064 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
2065 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2066 /* Selected status and previous status is the same */
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2067 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
2068 {
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2069 GaimSavedStatus *ss = gaim_savedstatus_get_current();
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2070 /* Make sure that statusbox displays the correct thing.
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2071 * 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
2072 * saved status that wasn't supported by this account */
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2073 if ((gaim_savedstatus_get_type(ss) == primitive)
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2074 && gaim_savedstatus_is_transient(ss)
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2075 && gaim_savedstatus_has_substatuses(ss))
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2076 changed = FALSE;
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2077 }
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2078 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2079 } else {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2080 saved_status = gaim_savedstatus_get_current();
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2081 if (gaim_savedstatus_get_type(saved_status) == primitive &&
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2082 !gaim_savedstatus_has_substatuses(saved_status))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2083 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2084 if (!message_changed(gaim_savedstatus_get_message(saved_status), message))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2085 changed = FALSE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2086 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2087 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2088
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2089 if (changed)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2090 {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2091 /* Manually find the appropriate transient acct */
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2092 if (status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2093 const GList *iter = gaim_savedstatuses_get_all();
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2094 GList *tmp, *active_accts = gaim_accounts_get_all_active();
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 for (; iter != NULL; iter = iter->next) {
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2097 GaimSavedStatus *ss = iter->data;
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2098 const char *ss_msg = gaim_savedstatus_get_message(ss);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2099 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
2100 gaim_savedstatus_has_substatuses(ss) && /* Must have substatuses */
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
2101 !message_changed(ss_msg, message))
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2102 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2103 gboolean found = FALSE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2104 /* 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
2105 for(tmp = active_accts; tmp != NULL; tmp = tmp->next) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2106 GaimAccount *acct = tmp->data;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2107 GaimSavedStatusSub *sub = gaim_savedstatus_get_substatus(ss, acct);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2108 if (sub) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2109 const GaimStatusType *sub_type = gaim_savedstatus_substatus_get_type(sub);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2110 if (!strcmp(gaim_status_type_get_id(sub_type),
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2111 gaim_status_type_get_id(acct_status_type)))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2112 found = TRUE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2113 }
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 if (!found)
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2116 continue;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2117 saved_status = ss;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2118 break;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2119 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2120 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2121
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2122 g_list_free(active_accts);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2123
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2124 } else {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2125 /* 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
2126 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
2127 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2128
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2129 /* 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
2130 if (saved_status == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2131 {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2132 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
2133 gaim_savedstatus_set_message(saved_status, message);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2134 if (status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2135 GList *tmp, *active_accts = gaim_accounts_get_all_active();
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2136 for (tmp = active_accts; tmp != NULL; tmp = tmp->next) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2137 gaim_savedstatus_set_substatus(saved_status,
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2138 (GaimAccount*) tmp->data, acct_status_type, message);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2139 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2140 g_list_free(active_accts);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2141 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2142 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2143
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2144 /* 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
2145 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
2146 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2147 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2148 /* Per-account */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2149 gint active;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2150 GaimStatusType *status_type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2151 GaimStatus *status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2152 const char *id = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2153
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2154 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
2155
15154
7696f5dec7d8 [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15139
diff changeset
2156 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
2157
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2158 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
2159 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
2160
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2161 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
2162 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2163 /* 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
2164 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
2165 changed = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2166 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2167
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2168 if (changed)
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 if (message)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2171 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
2172 TRUE, "message", message, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2173 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2174 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
2175 TRUE, NULL);
15002
1a8aa1ff4c62 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14803
diff changeset
2176
1a8aa1ff4c62 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14803
diff changeset
2177 saved_status = gaim_savedstatus_get_current();
1a8aa1ff4c62 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14803
diff changeset
2178 if (gaim_savedstatus_is_transient(saved_status))
1a8aa1ff4c62 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14803
diff changeset
2179 gaim_savedstatus_set_substatus(saved_status, status_box->account,
1a8aa1ff4c62 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14803
diff changeset
2180 status_type, message);
14191
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 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2183
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2184 g_free(title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2185 g_free(message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2186 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2187
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2188 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
2189 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2190 GtkTextBuffer *buffer;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2191 GtkTextIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2192 int wrapped_lines;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2193 int lines;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2194 GdkRectangle oneline;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2195 int height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2196 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
2197
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2198 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
2199 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2200 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
2201 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
2202 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2203 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2204
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2205 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
2206
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2207 wrapped_lines = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2208 gtk_text_buffer_get_start_iter(buffer, &iter);
15118
4bf1777efb1f [gaim-migrate @ 17904]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15115
diff changeset
2209 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
2210 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
2211 wrapped_lines++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2212
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2213 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
2214
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2215 /* 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
2216 lines = MIN(lines, 4);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2217 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
2218
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2219 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
2220 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
2221 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
2222
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2223 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
2224 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
2225
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2226 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
2227 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2228
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2229 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
2230 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2231 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
2232 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2233 /* 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
2234 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
2235 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2236 }
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 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
2239 status_box->typing = 0;
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 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
2242 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
2243 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2244
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2245 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
2246 {
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2247 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
2248 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2249 GtkGaimStatusBoxItemType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2250 gpointer data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2251 GList *accounts = NULL, *node;
15154
7696f5dec7d8 [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15139
diff changeset
2252 int active;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2253
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2254
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2255 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
2256 return;
15154
7696f5dec7d8 [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15139
diff changeset
2257 active = gtk_tree_path_get_indices(path)[0];
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2258 gtk_tree_path_free(path);
15154
7696f5dec7d8 [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 15139
diff changeset
2259 g_object_set_data(G_OBJECT(status_box), "active", GINT_TO_POINTER(active));
15079
32814a36f363 [gaim-migrate @ 17864]
Sean Egan <seanegan@gmail.com>
parents: 15070
diff changeset
2260
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2261 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
2262 TYPE_COLUMN, &type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2263 DATA_COLUMN, &data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2264 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2265 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
2266 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
2267 status_box->typing = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2268
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2269 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
2270 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2271 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
2272 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2273 GaimSavedStatus *saved;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2274 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
2275 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
2276 gaim_savedstatus_activate(saved);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2277 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2278 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2279
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2280 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
2281 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2282 GaimSavedStatus *saved_status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2283 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
2284 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
2285 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
2286 ? saved_status : NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2287 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
2288 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2289 }
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 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
2292 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2293 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
2294 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
2295 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2296 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2297 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2298
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2299 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2300 * 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
2301 * 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
2302 * 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
2303 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2304 if (status_box->account)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2305 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
2306 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2307 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
2308 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
2309 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
2310 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2311 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2312 GaimStatusType *status_type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2313
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2314 account = node->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2315 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
2316 if ((status_type != NULL) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2317 (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
2318 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2319 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
2320 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2321 }
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 g_list_free(accounts);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2324
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2325 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
2326 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2327 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
2328 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2329 gtk_widget_show_all(status_box->vbox);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2330 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
2331 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
2332 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
2333 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2334 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2335 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2336 gtk_widget_hide_all(status_box->vbox);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2337 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
2338 return;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2339 }
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_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
2342 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2343
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2344 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2345 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
2346 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2347 gint index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2348
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2349 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
2350 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2351 case GAIM_STATUS_AVAILABLE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2352 index = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2353 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2354 case GAIM_STATUS_AWAY:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2355 index = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2356 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2357 case GAIM_STATUS_INVISIBLE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2358 index = 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2359 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2360 case GAIM_STATUS_OFFLINE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2361 index = 3;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2362 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2363 default:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2364 index = -1;
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 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2367
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2368 return index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2369 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2370
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2371 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
2372 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2373 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
2374 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
2375 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2376 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
2377 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
2378 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
2379 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2380 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
2381 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2382 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
2383 }
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 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
2386 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2387 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
2388 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2389
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2390 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
2391 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2392 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
2393 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
2394 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2395 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2396 }