annotate gtk/gtkstatusbox.c @ 14942:77ca54a3af31

[gaim-migrate @ 17714] Also print the error to the console. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 09 Nov 2006 20:21:13 +0000
parents 967c39d78bc4
children 1a8aa1ff4c62
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);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
76 static void gtk_gaim_status_box_changed(GtkComboBox *box);
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);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
82
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
83 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
84 static void icon_choose_cb(const char *filename, gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
85
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
86 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
87 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
88 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
89
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
90 enum {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
91 /** A GtkGaimStatusBoxItemType */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
92 TYPE_COLUMN,
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 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
95 * 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
96 * This column is visible.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
97 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
98 ICON_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
99
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
100 /** 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
101 TEXT_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
102
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
103 /** 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
104 TITLE_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
105
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
106 /** 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
107 DESC_COLUMN,
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 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
110 * 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
111 * 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
112 * this is the GaimStatusPrimitive.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
113 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
114 DATA_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
115
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
116 NUM_COLUMNS
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
119 enum {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
120 PROP_0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
121 PROP_ACCOUNT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
122 PROP_ICON_SEL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
123 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
124
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
125 GtkComboBoxClass *parent_class = NULL;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
126
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_class_init (GtkGaimStatusBoxClass *klass);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
128 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
129
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
130 GType
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
131 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
132 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
133 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
134
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
135 if (!status_box_type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
136 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
137 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
138 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
139 sizeof (GtkGaimStatusBoxClass),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
140 NULL, /* base_init */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
141 NULL, /* base_finalize */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
142 (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
143 NULL, /* class_finalize */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
144 NULL, /* class_data */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
145 sizeof (GtkGaimStatusBox),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
146 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
147 (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
148 NULL /* value_table */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
149 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
150
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
151 status_box_type = g_type_register_static(GTK_TYPE_COMBO_BOX,
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
152 "GtkGaimStatusBox",
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
153 &status_box_info,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
154 0);
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
157 return status_box_type;
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
160 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
161 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
162 GValue *value, GParamSpec *psec)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
163 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
164 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
165
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
166 switch (param_id) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
167 case PROP_ACCOUNT:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
168 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
169 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
170 case PROP_ICON_SEL:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
171 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
172 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
173 default:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
174 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
175 break;
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
179 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
180 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
181 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
182 const GList *l;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
183 int status_no = -1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
184 const GaimStatusType *statustype = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
185 const char *message;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
186
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
187 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
188 (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
189
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
190 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
191 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
192
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
193 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
194 continue;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
195 status_no++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
196 if (statustype == status_type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
197 break;
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
200 if (status_no != -1) {
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);
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
202 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
203
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
204 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
205
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
206 if (!message || !*message)
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 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
209 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
210 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
211 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
212 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
213 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
214 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
215 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
216 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
217 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
218 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
219 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
220 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
221 }
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
224 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
225 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
226 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
227 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
228 update_to_reflect_account_status(status_box, account, newstatus);
14742
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
229 else if (status_box->token_status_account == account)
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
230 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
231 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
232
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
233 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
234 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
235 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
236 if (box->buddy_icon_sel) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
237 gtk_window_present(GTK_WINDOW(box->buddy_icon_sel));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
238 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
239 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
240
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
241 box->buddy_icon_sel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
242 gtk_widget_show_all(box->buddy_icon_sel);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
243 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
244 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
245
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
246 static void
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
247 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
248 GtkSelectionData *sd, guint info, guint t, GtkGaimStatusBox *box)
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
249 {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
250 gchar *name = (gchar *)sd->data;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
251
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
252 if ((sd->length >= 0) && (sd->format == 8)) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
253 /* Well, it looks like the drag event was cool.
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
254 * Let's do something with it */
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
255 if (!g_ascii_strncasecmp(name, "file://", 7)) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
256 GError *converr = NULL;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
257 gchar *tmp, *rtmp;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
258
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
259 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
260 gaim_debug(GAIM_DEBUG_ERROR, "buddyicon", "%s\n",
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
261 (converr ? converr->message :
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
262 "g_filename_from_uri error"));
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
263 return;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
264 }
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
265 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
266 *rtmp = '\0';
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
267 icon_choose_cb(tmp, box);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
268 g_free(tmp);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
269 }
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
270 gtk_drag_finish(dc, TRUE, FALSE, t);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
271 }
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
272 gtk_drag_finish(dc, FALSE, FALSE, t);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
273 }
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
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
276 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
277 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
278 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
279 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
280 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
281 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
282 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
283
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
284 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
285 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
286 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
287 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
288 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
289 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
290 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
291
14561
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 static const GtkTargetEntry dnd_targets[] = {
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
294 {"text/plain", 0, 0},
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
295 {"text/uri-list", 0, 1},
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
296 {"STRING", 0, 2}
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 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
300 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
301 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
302 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
303 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
304
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
305 status_box->icon = gtk_image_new();
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
306 status_box->icon_box = gtk_event_box_new();
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
307 if (status_box->account &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
308 !gaim_account_get_ui_bool(status_box->account, GAIM_GTK_UI, "use-global-buddyicon", TRUE))
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 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
311 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
312 g_free(string);
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 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
315 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
316 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
317 }
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
318
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
319 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
320 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
321
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
322 /* Set up DND */
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
323 gtk_drag_dest_set(status_box->icon_box,
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
324 GTK_DEST_DEFAULT_MOTION |
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
325 GTK_DEST_DEFAULT_DROP,
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
326 dnd_targets,
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
327 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
328 GDK_ACTION_COPY);
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
329
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
330 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
331 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
332 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
333 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
334
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
335 gtk_container_add(GTK_CONTAINER(status_box->icon_box), status_box->icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
336
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
337 gtk_widget_show_all(status_box->icon_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
338 gtk_widget_set_parent(status_box->icon_box, GTK_WIDGET(status_box));
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
341 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
342 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
343 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
344 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
345 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
346
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
347 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
348 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
349 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
350
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
351 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
352 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
353
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
354 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
355 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
356
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
357 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
358
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
359 statusbox->icon = NULL;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
360 statusbox->icon_box = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
361 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
362 statusbox->buddy_icon = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
363 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
364 statusbox->hand_cursor = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
365 statusbox->arrow_cursor = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
366 }
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 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
369 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
370 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
371 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
372 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
373
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
374 switch (param_id) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
375 case PROP_ICON_SEL:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
376 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
377 if (statusbox->account) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
378 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
379 if (plug) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
380 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
381 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
382 setup_icon_box(statusbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
383 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
384 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
385 setup_icon_box(statusbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
386 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
387 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
388 destroy_icon_box(statusbox);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
389 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
390 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
391 case PROP_ACCOUNT:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
392 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
393
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
394 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
395
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
396 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
397 default:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
398 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
399 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
400 }
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
403 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
404 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
405 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
406 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
407
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
408 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
409 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
410
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
411 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
412 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
413
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
414 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
415 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
416
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
417 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
418 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
419
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
420 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
421
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
422 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
423 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
424
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
425 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
426 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
427 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
428 GObjectClass *object_class;
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
429 GtkComboBoxClass *combo_class;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
430 GtkWidgetClass *widget_class;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
431 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
432
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
433 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
434
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
435 combo_class = (GtkComboBoxClass*)klass;
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
436 combo_class->changed = gtk_gaim_status_box_changed;
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
437
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
438 widget_class = (GtkWidgetClass*)klass;
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
439 combo_box_size_request = widget_class->size_request;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
440 widget_class->size_request = gtk_gaim_status_box_size_request;
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
441 combo_box_size_allocate = widget_class->size_allocate;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
442 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
443 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
444
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
445 combo_box_forall = container_class->forall;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
446 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
447 container_class->remove = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
448
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
449 object_class = (GObjectClass *)klass;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
450
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
451 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
452
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
453 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
454 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
455
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
456 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
457 PROP_ACCOUNT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
458 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
459 "Account",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
460 "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
461 G_PARAM_READWRITE
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
462 )
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
463 );
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
464 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
465 PROP_ICON_SEL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
466 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
467 "Icon Selector",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
468 "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
469 FALSE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
470 G_PARAM_READWRITE
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
471 )
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
472 );
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
473 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
474
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
475 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
476 * 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
477 * 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
478 * 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
479 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
480 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
481 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
482 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
483 gboolean show_buddy_icons;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
484 GtkIconSize icon_size;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
485 GtkStyle *style;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
486 char aa_color[8];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
487 GaimSavedStatus *saved_status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
488 char *primary, *secondary, *text;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
489 GdkPixbuf *pixbuf;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
490 GtkTreePath *path;
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
491 gboolean account_status = FALSE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
492 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
493
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
494
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
495 show_buddy_icons = gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
496 if (show_buddy_icons)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
497 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
498 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
499 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL);
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 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
502 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
503 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
504 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
505 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
506
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
507 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
508
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
509 if (status_box->account || (status_box->token_status_account
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
510 && gaim_savedstatus_is_transient(saved_status)))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
511 account_status = TRUE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
512
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
513 /* Primary */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
514 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
515 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
516 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
517 GtkGaimStatusBoxItemType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
518 gpointer data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
519
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
520 /* Primary (get the status selected in the dropdown) */
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
521 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
522 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
523 TYPE_COLUMN, &type,
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
524 DATA_COLUMN, &data,
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
525 -1);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
526 if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE)
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
527 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
528 else
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
529 /* This should never happen, but just in case... */
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
530 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
531 }
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
532 else if (account_status)
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
533 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
534 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
535 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
536 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
537 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
538
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
539 /* Secondary */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
540 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
541 secondary = g_strdup(_("Typing"));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
542 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
543 secondary = g_strdup(_("Connecting"));
14705
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
544 else if (!status_box->network_available)
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
545 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
546 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
547 secondary = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
548 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
549 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
550 const char *message;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
551 char *tmp;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
552 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
553 if (message != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
554 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
555 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
556 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
557 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
558 g_free(tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
559 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
560 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
561 secondary = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
562 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
563
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
564 /* Pixbuf */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
565 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
566 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
567 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
568 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
569 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
570 {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
571 if (account_status)
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
572 pixbuf = gaim_gtk_create_prpl_icon_with_status(acct,
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
573 gaim_status_get_type(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
574 show_buddy_icons ? 1.0 : 0.5);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
575 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
576 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
577 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
578 show_buddy_icons ? 1.0 : 0.5);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
579
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
580 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
581 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
582 GdkPixbuf *emblem;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
583
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
584 /* 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
585 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
586 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
587 if (emblem != 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 int width, height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
590 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
591 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
592 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
593 width, height, 0, height,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
594 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
595 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
596 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
597 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
598 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
599
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
600 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
601 text = g_strdup_printf("%s%s<span size=\"smaller\" color=\"%s\">%s</span>",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
602 gaim_account_get_username(status_box->account),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
603 show_buddy_icons ? "\n" : " - ", aa_color,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
604 secondary ? secondary : primary);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
605 } else if (secondary != NULL) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
606 char *separator;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
607 separator = show_buddy_icons ? "\n" : " - ";
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
608 text = g_strdup_printf("%s<span size=\"smaller\" color=\"%s\">%s%s</span>",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
609 primary, aa_color, separator, secondary);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
610 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
611 text = g_strdup(primary);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
612 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
613 g_free(primary);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
614 g_free(secondary);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
615
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
616 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
617 * 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
618 * 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
619 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
620 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
621 ICON_COLUMN, pixbuf,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
622 TEXT_COLUMN, text,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
623 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
624 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
625 g_object_unref(pixbuf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
626 g_free(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
627
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
628 /* 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
629 path = gtk_tree_path_new_from_string("0");
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
630 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
631 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
632
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
633 update_size(status_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
634 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
635
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
636 static GaimStatusType *
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
637 find_status_type_by_index(const GaimAccount *account, gint active)
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
638 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
639 const GList *l = gaim_account_get_status_types(account);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
640 gint i;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
641
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
642 for (i = 0; l; l = l->next) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
643 GaimStatusType *status_type = l->data;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
644 if (!gaim_status_type_is_user_settable(status_type))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
645 continue;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
646
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
647 if (active == i)
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
648 return status_type;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
649 i++;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
650 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
651
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
652 return NULL;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
653 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
654
14191
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 * 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
657 * 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
658 * 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
659 * 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
660 * 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
661 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
662 * 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
663 * 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
664 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
665 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
666 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
667 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
668 GaimSavedStatus *saved_status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
669 GaimStatusPrimitive primitive;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
670 gint index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
671 const char *message;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
672
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
673 /* 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
674 if (status_box->account)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
675 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
676
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
677 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
678
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
679 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
680 * 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
681 * was changed programmatically.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
682 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
683 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
684
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
685 /*
14739
63d5b71d0c68 [gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents: 14705
diff changeset
686 * 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
687 * 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
688 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
689 primitive = gaim_savedstatus_get_type(saved_status);
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
690 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
691 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) ||
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
692 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) &&
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
693 (!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
694 {
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
695 index = get_statusbox_index(status_box, saved_status);
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
696 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
697 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
698 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
699 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
700 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
701 GtkGaimStatusBoxItemType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
702 gpointer data;
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 /* Unset the active item */
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
705 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), -1);
14191
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 /* 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
708 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
709 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
710 do
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
711 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
712 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
713 TYPE_COLUMN, &type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
714 DATA_COLUMN, &data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
715 -1);
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
716
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
717 /* 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
718 * saved statuses with substatuses for the enabled accounts */
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
719 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
720 && 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
721 {
14676
beabf64760e8 [gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14663
diff changeset
722 char *name;
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
723 const char *acct_status_name = gaim_status_get_name(
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
724 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
725
beabf64760e8 [gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14663
diff changeset
726 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
727 TEXT_COLUMN, &name, -1);
beabf64760e8 [gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14663
diff changeset
728
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
729 if (!gaim_savedstatus_has_substatuses(saved_status)
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
730 || !strcmp(name, acct_status_name))
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
731 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
732 /* Found! */
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
733 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter);
14676
beabf64760e8 [gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14663
diff changeset
734 g_free(name);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
735 break;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
736 }
14676
beabf64760e8 [gaim-migrate @ 17425]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14663
diff changeset
737 g_free(name);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
738 }
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
739 else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) &&
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
740 (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
741 {
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
742 /* Found! */
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
743 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter);
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
744 break;
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
745 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
746 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
747 while (gtk_tree_model_iter_next(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
748 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
749 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
750
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
751 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
752 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
753 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
754 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
755 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
756 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
757 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
758 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
759 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
760 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
761
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
762 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
763 * 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
764 * was changed programmatically.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
765 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
766 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
767
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
768 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
769 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
770 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
771 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
772 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
773
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
774 update_size(status_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
775
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
776 /* 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
777 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
778 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
779
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
780 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
781 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
782 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
783 gboolean show_buddy_icons;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
784 GtkIconSize icon_size;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
785 GList *list, *cur;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
786 GdkPixbuf *pixbuf, *emblem;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
787 int width, height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
788
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
789 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
790 if (list == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
791 /* 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
792 return;
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 show_buddy_icons = gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
795 if (show_buddy_icons)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
796 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
797 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
798 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
799
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
800 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
801
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
802 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
803 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
804 GaimSavedStatus *saved = cur->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
805 const gchar *message;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
806 gchar *stripped = NULL;
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 /* 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
809 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
810 gaim_savedstatus_get_type(saved),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
811 show_buddy_icons ? 1.0 : 0.5);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
812
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
813 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
814 {
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 * 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
817 * 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
818 * 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
819 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
820 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
821 else
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 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
824 if (message != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
825 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
826 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
827 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
828 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
829
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
830 /* 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
831 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
832 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
833 if (emblem != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
834 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
835 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
836 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
837 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
838 width, height, 0, height,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
839 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
840 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
841 }
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 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
845 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
846 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
847 g_free(stripped);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
848 if (pixbuf != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
849 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
850 }
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 g_list_free(list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
853 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
854
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
855 /* 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
856 * statuses and a token account if they do */
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
857 static GaimAccount* check_active_accounts_for_identical_statuses()
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
858 {
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
859 GaimAccount *acct = NULL, *acct2;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
860 GList *tmp, *tmp2, *active_accts = gaim_accounts_get_all_active();
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
861 const GList *s, *s1, *s2;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
862
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
863 for (tmp = active_accts; tmp; tmp = tmp->next) {
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
864 acct = tmp->data;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
865 s = gaim_account_get_status_types(acct);
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
866 for (tmp2 = tmp->next; tmp2; tmp2 = tmp2->next) {
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
867 acct2 = tmp2->data;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
868
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
869 /* 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
870 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
871 acct = NULL;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
872 break;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
873 }
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
874
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
875 s2 = gaim_account_get_status_types(acct2);
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
876
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
877 s1 = s;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
878 while (s1 && s2) {
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
879 GaimStatusType *st1 = s1->data, *st2 = s2->data;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
880 /* TODO: Are these enough to consider the statuses identical? */
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
881 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
882 || 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
883 || 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
884 acct = NULL;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
885 break;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
886 }
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
887
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
888 s1 = s1->next;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
889 s2 = s2->next;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
890 }
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 if (s1 != s2) {/* Will both be NULL if matched */
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
893 acct = NULL;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
894 break;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
895 }
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 if (!acct)
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
898 break;
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 g_list_free(active_accts);
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
901
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
902 return acct;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
903 }
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
904
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
905 static void
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
906 add_account_statuses(GtkGaimStatusBox *status_box, GaimAccount *account, gboolean show_buddy_icons)
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
907 {
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
908 /* Per-account */
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
909 const GList *l;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
910 GdkPixbuf *tmp;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
911
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
912 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
913 {
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
914 GaimStatusType *status_type = (GaimStatusType *)l->data;
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
915
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
916 if (!gaim_status_type_is_user_settable(status_type))
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
917 continue;
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 tmp = gaim_gtk_create_prpl_icon_with_status(account, status_type,
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
920 show_buddy_icons ? 1.0 : 0.5);
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
921 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
922 GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, tmp,
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
923 gaim_status_type_get_name(status_type),
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
924 NULL,
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
925 GINT_TO_POINTER(gaim_status_type_get_primitive(status_type)));
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
926 if (tmp != NULL)
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
927 g_object_unref(tmp);
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
928 }
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
929 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
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
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
932 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
933 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
934 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
935 gboolean show_buddy_icons;
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
936 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
937 GtkIconSize icon_size;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
938
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
939 show_buddy_icons = gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
940 if (show_buddy_icons)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
941 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
942 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
943 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
944
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
945 /* Unset the model while clearing it */
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
946 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), NULL);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
947 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
948 /* 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
949 * 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
950 * 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
951 /* 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
952
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
953 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
954 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
955 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
956 icon_size, "GtkGaimStatusBox");
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
957 /* Do all the currently enabled accounts have the same statuses?
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
958 * If so, display them instead of our global list.
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
959 */
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
960 if (status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
961 add_account_statuses(status_box, status_box->token_status_account, show_buddy_icons);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
962 } else {
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
963 /* Global */
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
964 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
965 icon_size, "GtkGaimStatusBox");
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
966 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
967 icon_size, "GtkGaimStatusBox");
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
968 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
969 icon_size, "GtkGaimStatusBox");
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
970
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
971 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
972 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
973 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
974 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
975
63d5b71d0c68 [gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents: 14705
diff changeset
976 if (pixbuf2) g_object_unref(G_OBJECT(pixbuf2));
63d5b71d0c68 [gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents: 14705
diff changeset
977 if (pixbuf3) g_object_unref(G_OBJECT(pixbuf3));
63d5b71d0c68 [gaim-migrate @ 17495]
Etan Reisner <pidgin@unreliablesource.net>
parents: 14705
diff changeset
978 if (pixbuf4) g_object_unref(G_OBJECT(pixbuf4));
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
979 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
980
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
981 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
982
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
983 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
984 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
985 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
986 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
987
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
988 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
989 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
990
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
991 } else {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
992 add_account_statuses(status_box, status_box->account, show_buddy_icons);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
993 update_to_reflect_account_status(status_box, status_box->account,
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
994 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
995 }
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
998 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
999 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1000 gtk_combo_box_popup(GTK_COMBO_BOX(w));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1001 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1002 }
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 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
1005 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1006 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
1007 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
1008 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
1009 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
1010 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1011 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1012
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1013 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
1014 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1015 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
1016 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1017 /* 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
1018 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
1019 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
1020 (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
1021 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
1022 return TRUE;
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 (!status_box->typing != 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1025 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1026
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1027 /* 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
1028 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
1029 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1030 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
1031 status_box->typing = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1032 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
1033 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
1034 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
1035 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1036 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
1037 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1038 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1039
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1040 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
1041 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
1042 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
1043
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1044 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1045 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1046
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1047 #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
1048 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1049 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
1050 GtkTreeIter *iter, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1051 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1052 GtkGaimStatusBoxItemType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1053
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1054 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
1055
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1056 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
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 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1060 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1061 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1062
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1063 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1064 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
1065 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1066 GtkIconSize icon_size;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1067
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1068 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1069 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1070 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 6, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1071 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_TWO_LINE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1072 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1073 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1074 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL_TWO_LINE);
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1077 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
1078 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
1079 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
1080 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
1081 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
1082 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
1083 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
1084 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
1085
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1086 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
1087 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
1088 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1089 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
1090 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1091 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
1092 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1093 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
1094 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1095
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1096 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
1097 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
1098 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
1099 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
1100 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
1101 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
1102 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
1103 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
1104
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1105 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
1106 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
1107 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1108 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
1109 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1110 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
1111 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1112 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
1113 icon_size, "GtkGaimStatusBox");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1114 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1115
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1116 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
1117 GaimAccount *initial_token_acct = status_box->token_status_account;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1118
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1119 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
1120
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1121 /* Regenerate the list if it has changed */
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1122 if (initial_token_acct != status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1123 gtk_gaim_status_box_regenerate(status_box);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1124 }
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1125
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1126 }
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1127
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1128 static void
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1129 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
1130 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1131 /* 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
1132 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
1133 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1134
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1135 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1136 buddy_list_details_pref_changed_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
1137 gconstpointer val, gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1138 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1139 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
1140
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1141 cache_pixbufs(status_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1142 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
1143 }
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 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1146 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
1147 gconstpointer value, gpointer data)
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 #ifdef USE_GTKSPELL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1150 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
1151
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1152 if (value)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1153 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
1154 else
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 GtkSpell *spell;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1157 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
1158 gtkspell_detach(spell);
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 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1161 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1162
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1163 #if 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1164 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
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 (event->button != 1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1168 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1169 gtk_combo_box_popdown(GTK_COMBO_BOX(box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1170 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
1171 if (!box->imhtml_visible)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1172 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
1173 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1174 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1175
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1176 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
1177 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1178 if (event->button != 1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1179 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1180 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
1181 // 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
1182 // 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
1183 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1184 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1185 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1186
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1187 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1188 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
1189 {
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1190 gtk_combo_box_popup(GTK_COMBO_BOX(box));
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1191 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
1192 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1193
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1194 static void
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1195 buddy_icon_set_cb(const char *filename, gpointer data)
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1196 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1197 GtkGaimStatusBox *box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1198
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1199 box = data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1200
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1201 if (filename) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1202 GList *accounts;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1203
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1204 if (box->account) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1205 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1206 if (plug) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1207 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
1208 if (prplinfo && prplinfo->icon_spec.format) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1209 char *icon = gaim_gtk_convert_buddy_icon(plug, filename);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1210 gaim_account_set_buddy_icon(box->account, icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1211 gaim_account_set_ui_bool(box->account, GAIM_GTK_UI, "use-global-buddyicon", FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1212 gaim_account_set_ui_string(box->account, GAIM_GTK_UI, "non-global-buddyicon", icon);
14254
360c016459d0 [gaim-migrate @ 16936]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14191
diff changeset
1213 g_free(icon);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1214 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1215 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1216 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1217 for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1218 GaimAccount *account = accounts->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1219 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(account));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1220 if (plug) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1221 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
1222 if (prplinfo != NULL &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1223 gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", TRUE) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1224 prplinfo->icon_spec.format) {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1225 char *icon = gaim_gtk_convert_buddy_icon(plug, filename);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1226 gaim_account_set_buddy_icon(account, icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1227 g_free(icon);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1228 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1229 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1230 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1231 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1232 gtk_gaim_status_box_set_buddy_icon(box, filename);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1233 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1234 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1235
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1236 static void
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1237 icon_choose_cb(const char *filename, gpointer data)
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1238 {
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1239 GtkGaimStatusBox *box = data;
14785
36b55cb22bc2 [gaim-migrate @ 17549]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14747
diff changeset
1240 if (box->account == NULL && filename)
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1241 /* The pref-connect callback does the actual work */
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1242 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename);
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1243 else
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1244 buddy_icon_set_cb(filename, data);
14785
36b55cb22bc2 [gaim-migrate @ 17549]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14747
diff changeset
1245
36b55cb22bc2 [gaim-migrate @ 17549]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14747
diff changeset
1246 box->buddy_icon_sel = NULL;
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1247 }
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1248
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1249 static void
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1250 update_buddyicon_cb(const char *name, GaimPrefType type,
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1251 gconstpointer value, gpointer data)
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1252 {
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1253 buddy_icon_set_cb(value, data);
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1254 }
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1255
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1256 static void
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1257 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
1258 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1259 GtkCellRenderer *text_rend;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1260 GtkCellRenderer *icon_rend;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1261 GtkTextBuffer *buffer;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1262
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1263 status_box->imhtml_visible = FALSE;
14705
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1264 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
1265 status_box->connecting = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1266 status_box->typing = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1267 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
1268 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
1269 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
1270 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
1271 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1272
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1273 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
1274 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);
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1275 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1276 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store));
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1277 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1278 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
1279
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1280 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
1281 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
1282 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
1283 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
1284 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
1285 #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
1286 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
1287 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1288
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1289 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
1290 icon_rend = gtk_cell_renderer_pixbuf_new();
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1291 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), icon_rend, FALSE);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1292 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), text_rend, TRUE);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1293 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), icon_rend, "pixbuf", ICON_COLUMN, NULL);
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1294 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(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
1295 #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
1296 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
1297 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1298
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1299 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
1300 status_box->text_rend = gtk_cell_renderer_text_new();
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1301 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
1302 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
1303 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
1304 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
1305 #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
1306 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
1307 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1308
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1309 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
1310 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
1311 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
1312
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1313 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
1314 #if 0
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1315 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
1316 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
1317 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
1318 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
1319 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1320 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
1321 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
1322 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
1323 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
1324 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
1325 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
1326 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
1327 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
1328 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
1329 #ifdef USE_GTKSPELL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1330 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
1331 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
1332 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1333 gtk_widget_set_parent(status_box->vbox, GTK_WIDGET(status_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1334 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
1335 GTK_BIN(status_box)->child = status_box->toggle_button;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1336
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1337 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
1338
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1339 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
1340 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
1341 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1342
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1343 #if GTK_CHECK_VERSION(2,6,0)
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1344 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), 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
1345 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1346
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1347 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
1348
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1349 cache_pixbufs(status_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1350 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
1351
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1352 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
1353 status_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1354 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
1355 status_box);
14641
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1356 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
1357 GAIM_CALLBACK(account_enabled_cb),
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1358 status_box);
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1359 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
1360 GAIM_CALLBACK(account_enabled_cb),
f0646e3c1c05 [gaim-migrate @ 17387]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14636
diff changeset
1361 status_box);
14742
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
1362 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
1363 GAIM_CALLBACK(account_status_changed_cb),
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
1364 status_box);
f453cc774882 [gaim-migrate @ 17499]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14739
diff changeset
1365
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1366 gaim_prefs_connect_callback(status_box, "/gaim/gtk/blist/show_buddy_icons",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1367 buddy_list_details_pref_changed_cb, status_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1368 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
1369 spellcheck_prefs_cb, status_box);
14636
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1370 gaim_prefs_connect_callback(status_box, "/gaim/gtk/accounts/buddyicon",
2c09131fffa5 [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14599
diff changeset
1371 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
1372 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1373
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1374 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1375 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
1376 GtkRequisition *requisition)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1377 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1378 GtkRequisition box_req;
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1379 combo_box_size_request(widget, requisition);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1380 requisition->height += 3;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1381
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1382 /* 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
1383 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
1384 if (box_req.height > 1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1385 requisition->height += box_req.height + 3;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1386
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1387 requisition->width = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1388
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1389
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1390 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1391
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1392 /* From gnome-panel */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1393 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1394 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
1395 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1396 gint i, j;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1397 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
1398 guchar *target_pixels;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1399 guchar *original_pixels;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1400 guchar *pixsrc;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1401 guchar *pixdest;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1402 int val;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1403 guchar r,g,b;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1404
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1405 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
1406 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
1407 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
1408 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
1409 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
1410 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
1411 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
1412
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1413 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
1414 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
1415 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
1416 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
1417 r = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1418 g = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1419 b = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1420 val = r + shift;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1421 *(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
1422 val = g + shift;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1423 *(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
1424 val = b + shift;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1425 *(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
1426 if (has_alpha)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1427 *(pixdest++) = *(pixsrc++);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1428 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1429 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1430 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1431
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1432 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1433 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
1434 GtkAllocation *allocation)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1435 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1436 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
1437 GtkRequisition req = {0,0};
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1438 GtkAllocation parent_alc, box_alc, icon_alc;
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1439 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
1440
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1441 combo_box_size_request(widget, &req);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1442
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1443 box_alc = *allocation;
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1444
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1445 box_alc.width -= (border_width * 2);
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1446 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
1447 box_alc.x += border_width;
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1448 box_alc.y += req.height + border_width;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1449 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->vbox, &box_alc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1450
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1451 parent_alc = *allocation;
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1452 parent_alc.height = MAX(1,req.height - (border_width ));
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1453 parent_alc.width -= (border_width * 2);
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1454 parent_alc.x += border_width;
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1455 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
1456
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1457 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
1458 {
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1459 GtkTextDirection dir = gtk_widget_get_direction(widget);
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1460 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
1461 icon_alc = *allocation;
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1462 icon_alc.height = MAX(1,req.height) - (border_width);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1463 icon_alc.width = icon_alc.height;
14561
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1464 if (dir == GTK_TEXT_DIR_RTL) {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1465 icon_alc.x = parent_alc.x;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1466 parent_alc.x += icon_alc.width + border_width;
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1467 } else {
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1468 icon_alc.x = allocation->width - (icon_alc.width + border_width);
3ff55ec8203a [gaim-migrate @ 17284]
Sean Egan <seanegan@gmail.com>
parents: 14546
diff changeset
1469 }
14546
776975f2c550 [gaim-migrate @ 17269]
Sean Egan <seanegan@gmail.com>
parents: 14254
diff changeset
1470 icon_alc.y += border_width;
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1471
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1472 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
1473 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1474 status_box->icon_size = icon_alc.height;
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1475 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
1476 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1477 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
1478 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1479
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1480 combo_box_size_allocate(widget, &parent_alc);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1481 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
1482 widget->allocation = *allocation;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1483 }
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 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1486 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
1487 GdkEventExpose *event)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1488 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1489 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
1490 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
1491 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
1492 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
1493 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
1494 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1495 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1496
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1497 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1498 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
1499 gboolean include_internals,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1500 GtkCallback callback,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1501 gpointer callback_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1502 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1503 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
1504
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1505 if (include_internals)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1506 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1507 (* callback) (status_box->vbox, callback_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1508 (* 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
1509 (* 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
1510 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
1511 (* 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
1512 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1513
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1514 combo_box_forall(container, include_internals, callback, callback_data);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1515 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1516
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1517 GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1518 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
1519 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1520 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
1521 "iconsel", TRUE, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1522 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1523
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1524 GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1525 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
1526 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1527 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
1528 "iconsel", TRUE, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1529 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1530
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1531 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1532 * 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
1533 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1534 * @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
1535 * @param type A GtkGaimStatusBoxItemType.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1536 * @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
1537 * @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
1538 * 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
1539 * 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
1540 * "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
1541 * 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
1542 * @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
1543 * 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
1544 * 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
1545 * (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
1546 * @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
1547 * 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
1548 * 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
1549 * creation timestamp.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1550 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1551 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1552 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
1553 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1554 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1555 char *text;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1556
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1557 if (desc == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1558 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1559 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
1560 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1561 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1562 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1563 gboolean show_buddy_icons;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1564 GtkStyle *style;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1565 char aa_color[8];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1566 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
1567
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1568 show_buddy_icons = gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1569 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
1570 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
1571 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
1572 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
1573 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
1574
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1575 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
1576 escaped_desc = g_markup_escape_text(desc, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1577 text = g_strdup_printf("%s%s<span color=\"%s\" size=\"smaller\">%s</span>",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1578 escaped_title,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1579 show_buddy_icons ? "\n" : " - ",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1580 aa_color, escaped_desc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1581 g_free(escaped_title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1582 g_free(escaped_desc);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1583 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1584
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1585 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
1586 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
1587 TYPE_COLUMN, type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1588 ICON_COLUMN, pixbuf,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1589 TEXT_COLUMN, text,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1590 TITLE_COLUMN, title,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1591 DESC_COLUMN, desc,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1592 DATA_COLUMN, data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1593 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1594 g_free(text);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1595 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1596
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1597 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1598 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
1599 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1600 /* 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
1601 * 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
1602 #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
1603 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1604
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1605 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
1606 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
1607 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
1608 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1609 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1610 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1611
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1612 void
14705
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1613 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
1614 {
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1615 if (!status_box)
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1616 return;
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1617 status_box->network_available = available;
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1618 gtk_gaim_status_box_refresh(status_box);
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1619 }
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1620
05c34aabdcc3 [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14676
diff changeset
1621 void
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1622 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
1623 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1624 if (!status_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1625 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1626 status_box->connecting = connecting;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1627 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
1628 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1629
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1630 static void
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1631 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
1632 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1633
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1634 /* 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
1635 if (status_box->icon_size <= 0)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1636 return;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1637
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1638 if (status_box->buddy_icon)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1639 g_object_unref(status_box->buddy_icon);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1640 if (status_box->buddy_icon_hover)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1641 g_object_unref(status_box->buddy_icon_hover);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1642 status_box->buddy_icon = NULL;
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1643 status_box->buddy_icon_hover = NULL;
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1644
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1645 if ((status_box->buddy_icon_path != NULL) &&
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1646 (*status_box->buddy_icon_path != '\0'))
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1647 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
1648 status_box->icon_size, status_box->icon_size, FALSE, NULL);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1649
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1650 if (status_box->buddy_icon == NULL)
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1651 {
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1652 /* Show a placeholder icon */
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1653 gchar *filename;
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1654 filename = g_build_filename(DATADIR, "pixmaps",
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1655 "gaim", "insert-image.png", NULL);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1656 status_box->buddy_icon = gdk_pixbuf_new_from_file(filename, NULL);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1657 g_free(filename);
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1658 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1659
14599
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1660 if (status_box->buddy_icon != NULL) {
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1661 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
1662 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
1663 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
1664 }
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1665 }
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1666
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1667 void
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1668 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
1669 {
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1670 g_free(status_box->buddy_icon_path);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1671 status_box->buddy_icon_path = g_strdup(filename);
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1672
26e7d03d40c5 [gaim-migrate @ 17326]
Mark Doliner <mark@kingant.net>
parents: 14561
diff changeset
1673 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
1674 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1675
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1676 const char*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1677 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
1678 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1679 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
1680 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1681
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1682 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1683 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
1684 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1685 if (!status_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1686 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1687 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
1688 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
1689 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1690 status_box->connecting_index++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1691 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
1692 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1693
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1694 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1695 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
1696 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1697 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
1698 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
1699 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1700 status_box->typing_index++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1701 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
1702 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1703
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1704 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1705 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
1706 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1707 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
1708 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1709
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1710 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
1711 return TRUE;
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 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
1714 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1715
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1716 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1717 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
1718 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1719 GtkGaimStatusBoxItemType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1720 gpointer data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1721 gchar *title;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1722 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1723 char *message;
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1724 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
1725 gboolean changed = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1726
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1727 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter))
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1728 return;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1729
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1730 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
1731 TYPE_COLUMN, &type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1732 DATA_COLUMN, &data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1733 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1734
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 * 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
1737 * "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
1738 * Popular statuses are
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1739 * 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
1740 * 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
1741 * 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
1742 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1743 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
1744 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1745
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1746 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
1747 TITLE_COLUMN, &title, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1748
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1749 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
1750 if (!message || !*message)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1751 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1752 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
1753 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
1754 if (message != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1755 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1756 g_free(message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1757 message = NULL;
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 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1760
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1761 if (status_box->account == NULL) {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1762 GaimStatusType *acct_status_type = NULL;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1763 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
1764 /* Global */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1765 /* 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
1766
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1767 /* Has the status really been changed? */
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1768 if (status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1769 gint active;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1770 GaimStatus *status;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1771 const char *id = NULL;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1772
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1773 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
1774 g_object_get(G_OBJECT(status_box), "active", &active, NULL);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1775
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1776 acct_status_type = find_status_type_by_index(status_box->token_status_account, active);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1777 id = gaim_status_type_get_id(acct_status_type);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1778
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1779 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
1780 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1781 /* Selected status and previous status is the same */
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1782 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
1783 {
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1784 GaimSavedStatus *ss = gaim_savedstatus_get_current();
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1785 /* Make sure that statusbox displays the correct thing.
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1786 * 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
1787 * saved status that wasn't supported by this account */
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1788 if ((gaim_savedstatus_get_type(ss) == primitive)
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1789 && gaim_savedstatus_is_transient(ss)
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1790 && gaim_savedstatus_has_substatuses(ss))
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1791 changed = FALSE;
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1792 }
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1793 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1794 } else {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1795 saved_status = gaim_savedstatus_get_current();
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1796 if (gaim_savedstatus_get_type(saved_status) == primitive &&
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1797 !gaim_savedstatus_has_substatuses(saved_status))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1798 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1799 if (!message_changed(gaim_savedstatus_get_message(saved_status), message))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1800 changed = FALSE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1801 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1802 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1803
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1804 if (changed)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1805 {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1806 /* Manually find the appropriate transient acct */
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1807 if (status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1808 const GList *iter = gaim_savedstatuses_get_all();
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1809 GList *tmp, *active_accts = gaim_accounts_get_all_active();
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1810
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1811 for (; iter != NULL; iter = iter->next) {
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1812 GaimSavedStatus *ss = iter->data;
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1813 const char *ss_msg = gaim_savedstatus_get_message(ss);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1814 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
1815 gaim_savedstatus_has_substatuses(ss) && /* Must have substatuses */
14747
091b6ce6372e [gaim-migrate @ 17504]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14744
diff changeset
1816 !message_changed(ss_msg, message))
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1817 {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1818 gboolean found = FALSE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1819 /* 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
1820 for(tmp = active_accts; tmp != NULL; tmp = tmp->next) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1821 GaimAccount *acct = tmp->data;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1822 GaimSavedStatusSub *sub = gaim_savedstatus_get_substatus(ss, acct);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1823 if (sub) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1824 const GaimStatusType *sub_type = gaim_savedstatus_substatus_get_type(sub);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1825 if (!strcmp(gaim_status_type_get_id(sub_type),
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1826 gaim_status_type_get_id(acct_status_type)))
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1827 found = TRUE;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1828 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1829 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1830 if (!found)
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1831 continue;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1832 saved_status = ss;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1833 break;
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1834 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1835 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1836
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1837 g_list_free(active_accts);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1838
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1839 } else {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1840 /* 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
1841 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
1842 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1843
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1844 /* 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
1845 if (saved_status == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1846 {
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1847 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
1848 gaim_savedstatus_set_message(saved_status, message);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1849 if (status_box->token_status_account) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1850 GList *tmp, *active_accts = gaim_accounts_get_all_active();
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1851 for (tmp = active_accts; tmp != NULL; tmp = tmp->next) {
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1852 gaim_savedstatus_set_substatus(saved_status,
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1853 (GaimAccount*) tmp->data, acct_status_type, message);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1854 }
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1855 g_list_free(active_accts);
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
1856 }
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1857 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1858
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1859 /* 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
1860 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
1861 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1862 } else {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1863 /* Per-account */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1864 gint active;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1865 GaimStatusType *status_type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1866 GaimStatus *status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1867 const char *id = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1868
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1869 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
1870
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1871 g_object_get(G_OBJECT(status_box), "active", &active, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1872
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1873 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
1874 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
1875
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1876 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
1877 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1878 /* 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
1879 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
1880 changed = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1881 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1882
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1883 if (changed)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1884 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1885 if (message)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1886 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
1887 TRUE, "message", message, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1888 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1889 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
1890 TRUE, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1891 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1892 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1893
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1894 g_free(title);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1895 g_free(message);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1896 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1897
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1898 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
1899 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1900 GtkTextBuffer *buffer;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1901 GtkTextIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1902 int wrapped_lines;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1903 int lines;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1904 GdkRectangle oneline;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1905 int height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1906 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
1907
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1908 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
1909 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1910 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
1911 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
1912 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1913 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1914
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1915 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
1916
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1917 wrapped_lines = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1918 gtk_text_buffer_get_start_iter(buffer, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1919 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
1920 wrapped_lines++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1921
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1922 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
1923
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1924 /* 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
1925 lines = MIN(lines, 4);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1926 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
1927
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1928 gtk_text_buffer_get_start_iter(buffer, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1929 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->imhtml), &iter, &oneline);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1930
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1931 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
1932 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
1933 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
1934
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1935 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
1936 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
1937
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1938 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
1939 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1940
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1941 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
1942 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1943 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
1944 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1945 /* 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
1946 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
1947 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1948 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1949
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1950 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
1951 status_box->typing = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1952
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1953 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
1954 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
1955 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1956
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1957 static void gtk_gaim_status_box_changed(GtkComboBox *box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1958 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1959 GtkGaimStatusBox *status_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1960 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1961 GtkGaimStatusBoxItemType type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1962 gpointer data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1963 GList *accounts = NULL, *node;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1964
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1965 status_box = GTK_GAIM_STATUS_BOX(box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1966
14803
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1967 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter))
967c39d78bc4 [gaim-migrate @ 17568]
Sean Egan <seanegan@gmail.com>
parents: 14802
diff changeset
1968 return;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1969 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
1970 TYPE_COLUMN, &type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1971 DATA_COLUMN, &data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1972 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1973 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
1974 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
1975 status_box->typing = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1976
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1977 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
1978 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1979 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
1980 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1981 GaimSavedStatus *saved;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1982 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
1983 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
1984 gaim_savedstatus_activate(saved);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1985 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1986 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1987
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1988 if (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
1989 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1990 GaimSavedStatus *saved_status;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1991 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
1992 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
1993 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
1994 ? saved_status : NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1995 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
1996 return;
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
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1999 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
2000 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2001 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
2002 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
2003 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2004 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2005 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2006
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2007 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2008 * 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
2009 * 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
2010 * 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
2011 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2012 if (status_box->account)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2013 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
2014 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2015 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
2016 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
2017 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
2018 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2019 GaimAccount *account;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2020 GaimStatusType *status_type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2021
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2022 account = node->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2023 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
2024 if ((status_type != NULL) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2025 (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
2026 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2027 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
2028 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2029 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2030 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2031 g_list_free(accounts);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2032
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2033 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
2034 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2035 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
2036 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2037 gtk_widget_show_all(status_box->vbox);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2038 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
2039 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
2040 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
2041 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2042 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2043 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2044 gtk_widget_hide_all(status_box->vbox);
14663
587268c9c6d7 [gaim-migrate @ 17409]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 14641
diff changeset
2045 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
2046 return;
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2047 }
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 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
2050 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2051
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2052 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2053 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
2054 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2055 gint index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2056
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2057 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
2058 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2059 case GAIM_STATUS_AVAILABLE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2060 index = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2061 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2062 case GAIM_STATUS_AWAY:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2063 index = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2064 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2065 case GAIM_STATUS_INVISIBLE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2066 index = 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2067 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2068 case GAIM_STATUS_OFFLINE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2069 index = 3;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2070 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2071 default:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2072 index = -1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2073 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2074 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2075
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2076 return index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2077 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2078
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2079 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
2080 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2081 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
2082 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
2083 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2084 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
2085 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
2086 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
2087 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2088 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
2089 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2090 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
2091 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2092
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2093 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
2094 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2095 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
2096 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2097
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2098 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
2099 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2100 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
2101 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
2102 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2103 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2104 }