annotate src/gtkstatusbox.c @ 13048:80c2a2c4772f

[gaim-migrate @ 15409] I think this is what was probably intended? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 26 Jan 2006 23:43:18 +0000
parents 704dc95d0198
children fb607b2d4ff2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gtkstatusbox.c GTK+ Status Selection Widget
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup gtkui
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * gaim
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * source distribution.
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 */
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
26 /*
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
27 * The status box is made up of two main pieces:
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
28 * - The box that displays the current status, which is made
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
29 * of a GtkListStore ("status_box->store") and GtkCellView
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
30 * ("status_box->cell_view"). There is always exactly 1 row
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
31 * in this list store. Only the TYPE_ICON and TYPE_TEXT
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
32 * columns are used in this list store.
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
33 * - The dropdown menu that lets users select a status, which
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
34 * is made of a GtkComboBox ("status_box") and GtkListStore
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
35 * ("status_box->dropdown_store"). This dropdown is shown
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
36 * when the user clicks on the box that displays the current
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
37 * status. This list store contains one row for Available,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
38 * one row for Away, etc., a few rows for popular statuses,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
39 * and the "New..." and "Saved..." options.
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
40 */
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
41
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
42 #include <gdk/gdkkeysyms.h>
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
43
11627
5dbefebb20cb [gaim-migrate @ 13902]
Tim Ringenbach <marv@pidgin.im>
parents: 11593
diff changeset
44 #include "account.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "internal.h"
11627
5dbefebb20cb [gaim-migrate @ 13902]
Tim Ringenbach <marv@pidgin.im>
parents: 11593
diff changeset
46 #include "savedstatuses.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #include "status.h"
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
48 #include "debug.h"
11627
5dbefebb20cb [gaim-migrate @ 13902]
Tim Ringenbach <marv@pidgin.im>
parents: 11593
diff changeset
49
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "gtkgaim.h"
11729
8a981a601242 [gaim-migrate @ 14020]
Mark Doliner <mark@kingant.net>
parents: 11724
diff changeset
51 #include "gtksavedstatuses.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "gtkstock.h"
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 #include "gtkstatusbox.h"
12080
3b52d94437f3 [gaim-migrate @ 14377]
Mark Doliner <mark@kingant.net>
parents: 12076
diff changeset
54 #include "gtkutils.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
56 #ifdef USE_GTKSPELL
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
57 # include <gtkspell/gtkspell.h>
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
58 # ifdef _WIN32
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
59 # include "wspell.h"
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
60 # endif
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
61 #endif
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
62
12309
b3385115815c [gaim-migrate @ 14613]
Mark Doliner <mark@kingant.net>
parents: 12294
diff changeset
63 #define TYPING_TIMEOUT 4000
b3385115815c [gaim-migrate @ 14613]
Mark Doliner <mark@kingant.net>
parents: 12294
diff changeset
64
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data);
12460
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
66 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data);
11562
9f521a61ef58 [gaim-migrate @ 13828]
Sean Egan <seanegan@gmail.com>
parents: 11523
diff changeset
67 static void remove_typing_cb(GtkGaimStatusBox *box);
12597
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
68 static void update_size (GtkGaimStatusBox *box);
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
69 static gint get_statusbox_index(GtkGaimStatusBox *box, GaimSavedStatus *saved_status);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
71 static void gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box);
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
72 static void gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
73 static void gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 static void gtk_gaim_status_box_changed(GtkComboBox *box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 static void gtk_gaim_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 static void gtk_gaim_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 static gboolean gtk_gaim_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
83
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 enum {
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
85 /** A GtkGaimStatusBoxItemType */
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
86 TYPE_COLUMN,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
87
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
88 /**
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
89 * This is a GdkPixbuf (the other columns are strings).
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
90 * This column is visible.
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
91 */
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
92 ICON_COLUMN,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
93
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
94 /** The text displayed on the status box. This column is visible. */
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
95 TEXT_COLUMN,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
96
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
97 /** The plain-English title of this item */
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
98 TITLE_COLUMN,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
99
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
100 /** A plain-English description of this item */
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
101 DESC_COLUMN,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
102
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
103 /*
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
104 * This value depends on TYPE_COLUMN. For POPULAR types,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
105 * this is the creation time. For PRIMITIVE types,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
106 * this is the GaimStatusPrimitive.
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
107 */
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
108 DATA_COLUMN,
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
109
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 NUM_COLUMNS
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 };
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
113 enum {
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
114 PROP_0,
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
115 PROP_ACCOUNT
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
116 };
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
117
12379
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
118 GtkComboBoxClass *parent_class = NULL;
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
119
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 GType
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 gtk_gaim_status_box_get_type (void)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 {
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
126 static GType status_box_type = 0;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
128 if (!status_box_type)
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
129 {
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
130 static const GTypeInfo status_box_info =
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
131 {
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
132 sizeof (GtkGaimStatusBoxClass),
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
133 NULL, /* base_init */
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
134 NULL, /* base_finalize */
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
135 (GClassInitFunc) gtk_gaim_status_box_class_init,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
136 NULL, /* class_finalize */
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
137 NULL, /* class_data */
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
138 sizeof (GtkGaimStatusBox),
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
139 0,
12221
152748df85cf [gaim-migrate @ 14523]
Richard Laager <rlaager@wiktel.com>
parents: 12125
diff changeset
140 (GInstanceInitFunc) gtk_gaim_status_box_init,
152748df85cf [gaim-migrate @ 14523]
Richard Laager <rlaager@wiktel.com>
parents: 12125
diff changeset
141 NULL /* value_table */
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
142 };
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
144 status_box_type = g_type_register_static(GTK_TYPE_COMBO_BOX,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
145 "GtkGaimStatusBox",
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
146 &status_box_info,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
147 0);
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
148 }
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
150 return status_box_type;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 static void
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
154 gtk_gaim_status_box_get_property(GObject *object, guint param_id,
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
155 GValue *value, GParamSpec *psec)
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
156 {
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
157 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object);
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
158
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
159 switch (param_id) {
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
160 case PROP_ACCOUNT:
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
161 g_value_set_pointer(value, statusbox->account);
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
162 break;
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
163 default:
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
164 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, psec);
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
165 break;
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
166 }
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
167 }
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
168
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
169 static void
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
170 update_to_reflect_account_status(GtkGaimStatusBox *status_box, GaimAccount *account, GaimStatus *newstatus)
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
171 {
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
172 const GList *l;
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
173 int status_no = -1;
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
174 const GaimStatusType *statustype = NULL;
12060
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
175 const char *message;
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
176
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
177 statustype = gaim_status_type_find_with_id((GList *)gaim_account_get_status_types(account),
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
178 (char *)gaim_status_type_get_id(gaim_status_get_type(newstatus)));
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
179
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
180 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) {
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
181 GaimStatusType *status_type = (GaimStatusType *)l->data;
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
182
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
183 if (!gaim_status_type_is_user_settable(status_type))
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
184 continue;
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
185 status_no++;
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
186 if (statustype == status_type)
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
187 break;
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
188 }
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
189
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
190 if (status_no != -1) {
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
191 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
192 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no);
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
193
12060
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
194 message = gaim_status_get_attr_string(newstatus, "message");
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
195
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
196 if (!message || !*message)
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
197 {
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
198 gtk_widget_hide_all(status_box->vbox);
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
199 status_box->imhtml_visible = FALSE;
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
200 }
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
201 else
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
202 {
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
203 gtk_widget_show_all(status_box->vbox);
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
204 status_box->imhtml_visible = TRUE;
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
205 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml));
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
206 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml));
12060
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
207 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0);
f7d2f637ff03 [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
208 }
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
209 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
210 gtk_gaim_status_box_refresh(status_box);
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
211 }
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
212 }
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
213
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
214 static void
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
215 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, GtkGaimStatusBox *status_box)
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
216 {
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
217 if (status_box->account == account)
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
218 update_to_reflect_account_status(status_box, account, newstatus);
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
219 }
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
220
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
221 static void
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
222 gtk_gaim_status_box_set_property(GObject *object, guint param_id,
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
223 const GValue *value, GParamSpec *pspec)
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
224 {
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
225 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object);
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
226
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
227 switch (param_id) {
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
228 case PROP_ACCOUNT:
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
229 statusbox->account = g_value_get_pointer(value);
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
230
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
231 if (statusbox->status_changed_signal) {
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
232 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed",
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
233 statusbox, GAIM_CALLBACK(account_status_changed_cb));
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
234 statusbox->status_changed_signal = 0;
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
235 }
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
236
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
237 if (statusbox->account)
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
238 statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
239 statusbox, GAIM_CALLBACK(account_status_changed_cb),
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
240 statusbox);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
241 gtk_gaim_status_box_regenerate(statusbox);
12256
0eed625872f7 [gaim-migrate @ 14558]
Sean Egan <seanegan@gmail.com>
parents: 12244
diff changeset
242
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
243 break;
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
244 default:
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
245 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
246 break;
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
247 }
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
248 }
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
249
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
250 static void
12379
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
251 gtk_gaim_status_box_finalize(GObject *obj)
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
252 {
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
253 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(obj);
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
254
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
255 if (statusbox->status_changed_signal) {
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
256 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed",
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
257 statusbox, GAIM_CALLBACK(account_status_changed_cb));
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
258 statusbox->status_changed_signal = 0;
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
259 }
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
260 gaim_prefs_disconnect_by_handle(statusbox);
12379
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
261
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
262 G_OBJECT_CLASS(parent_class)->finalize(obj);
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
263 }
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
264
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
265 static void
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 {
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
268 GObjectClass *object_class;
12379
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
269 GtkComboBoxClass *combo_class;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
270 GtkWidgetClass *widget_class;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
271 GtkContainerClass *container_class = (GtkContainerClass*)klass;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272
12379
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
273 parent_class = g_type_class_peek_parent(klass);
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
274
12379
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
275 combo_class = (GtkComboBoxClass*)klass;
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
276 combo_class->changed = gtk_gaim_status_box_changed;
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
277
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
278 widget_class = (GtkWidgetClass*)klass;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
279 combo_box_size_request = widget_class->size_request;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
280 widget_class->size_request = gtk_gaim_status_box_size_request;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
281 combo_box_size_allocate = widget_class->size_allocate;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
282 widget_class->size_allocate = gtk_gaim_status_box_size_allocate;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
283 widget_class->expose_event = gtk_gaim_status_box_expose_event;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
285 combo_box_forall = container_class->forall;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
286 container_class->forall = gtk_gaim_status_box_forall;
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
287
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
288 object_class = (GObjectClass *)klass;
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
289
12379
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
290 object_class->finalize = gtk_gaim_status_box_finalize;
24c5fbfca306 [gaim-migrate @ 14683]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12320
diff changeset
291
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
292 object_class->get_property = gtk_gaim_status_box_get_property;
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
293 object_class->set_property = gtk_gaim_status_box_set_property;
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
294
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
295 g_object_class_install_property(object_class,
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
296 PROP_ACCOUNT,
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
297 g_param_spec_pointer("account",
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
298 "Account",
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
299 "The account, or NULL for all accounts",
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
300 G_PARAM_READWRITE
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
301 )
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
302 );
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
305 /**
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
306 * This updates the text displayed on the status box so that it shows
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
307 * the current status.
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
308 */
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 static void
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 {
12228
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
312 char *text = NULL, *title;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 char aa_color[8];
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 GdkPixbuf *pixbuf;
10702
f51e040affc6 [gaim-migrate @ 12284]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10672
diff changeset
315 GtkTreePath *path;
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
316 GtkStyle *style;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
318 style = gtk_widget_get_style(GTK_WIDGET(status_box));
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x",
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 style->text_aa[GTK_STATE_NORMAL].red >> 8,
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 style->text_aa[GTK_STATE_NORMAL].green >> 8,
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
10672
0925c898b73c [gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10661
diff changeset
323
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
324 if (status_box->title != NULL)
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
325 title = g_markup_escape_text(status_box->title, -1);
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
326 else
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
327 title = g_strdup("");
10672
0925c898b73c [gaim-migrate @ 12212]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10661
diff changeset
328
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 if (status_box->error) {
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
330 gchar *tmp = g_markup_escape_text(status_box->error, -1);
12228
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
331 text = g_strdup_printf("<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>",
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
332 tmp);
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
333 g_free(tmp);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 } else if (status_box->typing) {
12228
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
335 text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>",
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
336 aa_color, _("Typing"));
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 } else if (status_box->connecting) {
12228
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
338 text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>",
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
339 aa_color, _("Connecting"));
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
340 } else if (status_box->desc) {
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
341 gchar *tmp = g_markup_escape_text(status_box->desc, -1);
12228
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
342 text = g_strdup_printf("<span size=\"smaller\" color=\"%s\">%s</span>",
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
343 aa_color, tmp);
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
344 g_free(tmp);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 }
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
346
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
347 if (status_box->account) {
12228
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
348 char *text2 = g_strdup_printf("%s\n<span size=\"smaller\">%s</span>",
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
349 gaim_account_get_username(status_box->account),
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
350 text ? text : title);
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
351 g_free(text);
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
352 text = text2;
12228
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
353 } else if (text) {
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
354 char *text2 = g_strdup_printf("%s\n%s", title, text);
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
355 g_free(text);
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
356 text = text2;
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
357 } else {
f28e51bf9be8 [gaim-migrate @ 14530]
Tim Ringenbach <marv@pidgin.im>
parents: 12221
diff changeset
358 text = g_strdup(title);
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
359 }
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
360 g_free(title);
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
361
11523
1116993aadd2 [gaim-migrate @ 13771]
Sean Egan <seanegan@gmail.com>
parents: 11499
diff changeset
362 if (status_box->connecting)
1116993aadd2 [gaim-migrate @ 13771]
Sean Egan <seanegan@gmail.com>
parents: 11499
diff changeset
363 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index];
1116993aadd2 [gaim-migrate @ 13771]
Sean Egan <seanegan@gmail.com>
parents: 11499
diff changeset
364 else if (status_box->error)
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 pixbuf = status_box->error_pixbuf;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 else if (status_box->typing)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 pixbuf = status_box->typing_pixbufs[status_box->typing_index];
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 else
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 pixbuf = status_box->pixbuf;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
371 /*
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
372 * Only two columns are used in this list store (does it
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
373 * really need to be a list store?)
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
374 */
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 gtk_list_store_set(status_box->store, &(status_box->iter),
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 ICON_COLUMN, pixbuf,
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
377 TEXT_COLUMN, text,
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
378 -1);
10702
f51e040affc6 [gaim-migrate @ 12284]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10672
diff changeset
379 path = gtk_tree_path_new_from_string("0");
f51e040affc6 [gaim-migrate @ 12284]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10672
diff changeset
380 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path);
f51e040affc6 [gaim-migrate @ 12284]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10672
diff changeset
381 gtk_tree_path_free(path);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 g_free(text);
12597
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
384 update_size(status_box);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
387 /**
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
388 * This updates the GtkTreeView so that it correctly shows the state
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
389 * we are currently using. It is used when the current state is
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
390 * updated from somewhere other than the GtkStatusBox (from a plugin,
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
391 * or when signing on with the "-n" option, for example). It is
13025
7d39e6c73dc3 [gaim-migrate @ 15378]
Mark Doliner <mark@kingant.net>
parents: 13023
diff changeset
392 * also used when the user selects the "New..." option.
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
393 *
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
394 * Maybe we could accomplish this by triggering off the mouse and
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
395 * keyboard signals instead of the changed signal?
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
396 */
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
397 static void
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
398 update_to_reflect_current_status(GtkGaimStatusBox *status_box)
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
399 {
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
400 GaimSavedStatus *saved_status;
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
401 gint index;
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
402 const char *message;
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
403 GList *list;
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
404
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
405 /* this function is inappropriate for ones with accounts */
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
406 if (status_box->account)
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
407 return;
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
408
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
409 saved_status = gaim_savedstatus_get_current();
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
410
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
411 /*
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
412 * Suppress the "changed" signal because the status
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
413 * was changed programmatically.
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
414 */
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
415 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
416
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
417 list = gaim_savedstatuses_get_popular(6);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
418 if ((index = g_list_index(list, saved_status)) > -1)
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
419 index += 5;
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
420 else
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
421 {
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
422 if (gaim_savedstatus_has_substatuses(saved_status))
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
423 index = GTK_LIST_STORE(status_box->dropdown_store)->length - 2;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
424 else
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
425 {
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
426 index = get_statusbox_index(status_box, saved_status);
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
427 }
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
428 }
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
429 g_list_free(list);
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
430 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index);
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
431
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
432 message = gaim_savedstatus_get_message(saved_status);
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
433 if (!message || !*message)
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
434 {
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
435 status_box->imhtml_visible = FALSE;
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
436 gtk_widget_hide_all(status_box->vbox);
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
437 }
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
438 else
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
439 {
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
440 status_box->imhtml_visible = TRUE;
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
441 gtk_widget_show_all(status_box->vbox);
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
442
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
443 /*
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
444 * Suppress the "changed" signal because the status
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
445 * was changed programmatically.
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
446 */
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
447 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE);
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
448
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
449 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml));
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
450 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml));
12125
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
451 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0);
3c1bac709234 [gaim-migrate @ 14425]
Mark Doliner <mark@kingant.net>
parents: 12123
diff changeset
452 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE);
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
453 }
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
454
12634
8512c990967b [gaim-migrate @ 14970]
Richard Laager <rlaager@wiktel.com>
parents: 12619
diff changeset
455 update_size(status_box);
8512c990967b [gaim-migrate @ 14970]
Richard Laager <rlaager@wiktel.com>
parents: 12619
diff changeset
456
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
457 /* Stop suppressing the "changed" signal. */
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
458 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
459 }
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
460
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
461 static void
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
462 add_popular_statuses(GtkGaimStatusBox *statusbox)
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
463 {
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
464 GList *list, *cur;
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
465 GtkIconSize icon_size;
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
466 GdkPixbuf *away_pix, *avl_pix, *pixbuf;
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
467
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
468 list = gaim_savedstatuses_get_popular(6);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
469 if (list == NULL)
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
470 /* Odd... oh well, nothing we can do about it. */
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
471 return;
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
472
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
473 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
474 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
475 else
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
476 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
477
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
478 away_pix = gtk_widget_render_icon(GTK_WIDGET(statusbox->vbox), GAIM_STOCK_STATUS_AWAY,
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
479 icon_size, "GtkGaimStatusBox");
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
480 avl_pix = gtk_widget_render_icon(GTK_WIDGET(statusbox->vbox), GAIM_STOCK_STATUS_ONLINE,
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
481 icon_size, "GtkGaimStatusBox");
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
482
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
483 gtk_gaim_status_box_add_separator(statusbox);
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
484
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
485 for (cur = list; cur != NULL; cur = cur->next)
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
486 {
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
487 GaimSavedStatus *saved = cur->data;
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
488
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
489 switch (gaim_savedstatus_get_type(saved))
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
490 {
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
491 case GAIM_STATUS_AVAILABLE:
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
492 pixbuf = avl_pix;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
493 break;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
494 default:
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
495 pixbuf = away_pix;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
496 break;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
497 }
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
498 gtk_gaim_status_box_add(statusbox, GTK_GAIM_STATUS_BOX_TYPE_POPULAR,
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
499 pixbuf, gaim_savedstatus_get_title(saved), NULL,
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
500 GINT_TO_POINTER(gaim_savedstatus_get_creation_time(saved)));
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
501 }
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
502
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
503 g_list_free(list);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
504 }
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
505
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
506 static void
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
507 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box)
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
508 {
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
509 GaimAccount *account;
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
510 GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4;
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
511 GtkIconSize icon_size;
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
512
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
513 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
514 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
515 else
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
516 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
517
12256
0eed625872f7 [gaim-migrate @ 14558]
Sean Egan <seanegan@gmail.com>
parents: 12244
diff changeset
518 /* Unset the model while clearing it */
0eed625872f7 [gaim-migrate @ 14558]
Sean Egan <seanegan@gmail.com>
parents: 12244
diff changeset
519 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), NULL);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
520 gtk_list_store_clear(status_box->dropdown_store);
12256
0eed625872f7 [gaim-migrate @ 14558]
Sean Egan <seanegan@gmail.com>
parents: 12244
diff changeset
521 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
522
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
523 account = GTK_GAIM_STATUS_BOX(status_box)->account;
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
524 if (account == NULL)
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
525 {
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
526 /* Global */
11756
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
527 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_ONLINE,
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
528 icon_size, "GtkGaimStatusBox");
11756
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
529 pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_AWAY,
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
530 icon_size, "GtkGaimStatusBox");
11756
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
531 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE,
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
532 icon_size, "GtkGaimStatusBox");
11756
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
533 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_INVISIBLE,
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
534 icon_size, "GtkGaimStatusBox");
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
535
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
536 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));
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
537 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));
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
538 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));
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
539 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));
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
540
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
541 add_popular_statuses(status_box);
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
542
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
543 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box));
13025
7d39e6c73dc3 [gaim-migrate @ 15378]
Mark Doliner <mark@kingant.net>
parents: 13023
diff changeset
544 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL);
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
545 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
546
11870
678ef9ad7a0d [gaim-migrate @ 14161]
Mark Doliner <mark@kingant.net>
parents: 11850
diff changeset
547 update_to_reflect_current_status(status_box);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
548
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
549 } else {
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
550 /* Per-account */
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
551 const GList *l;
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
552
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
553 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next)
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
554 {
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
555 GaimStatusType *status_type = (GaimStatusType *)l->data;
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
556
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
557 if (!gaim_status_type_is_user_settable(status_type))
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
558 continue;
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
559
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
560 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box),
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
561 gaim_status_type_get_primitive(status_type),
12080
3b52d94437f3 [gaim-migrate @ 14377]
Mark Doliner <mark@kingant.net>
parents: 12076
diff changeset
562 gaim_gtk_create_prpl_icon_with_status(account, status_type),
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
563 gaim_status_type_get_name(status_type),
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
564 NULL, NULL);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
565 }
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
566
11967
225e1b274033 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
567 update_to_reflect_account_status(status_box, account, gaim_account_get_active_status(account));
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
568 }
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
569 }
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
570
12827
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
571 static gboolean combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml)
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
572 {
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
573 gtk_combo_box_popup(GTK_COMBO_BOX(w));
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
574 return TRUE;
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
575 }
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
576
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
577 static gboolean imhtml_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml)
12075
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
578 {
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
579 if (event->direction == GDK_SCROLL_UP)
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
580 gtk_imhtml_page_up(imhtml);
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
581 else if (event->direction == GDK_SCROLL_DOWN)
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
582 gtk_imhtml_page_down(imhtml);
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
583 return TRUE;
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
584 }
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
585
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
586 static int imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, GtkGaimStatusBox *box)
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
587 {
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
588 if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab)
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
589 {
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
590 /* If last inserted character is a tab, then remove the focus from here */
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
591 GtkWidget *top = gtk_widget_get_toplevel(w);
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
592 g_signal_emit_by_name(G_OBJECT(top), "move_focus",
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
593 (event->state & GDK_SHIFT_MASK) ?
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
594 GTK_DIR_TAB_BACKWARD: GTK_DIR_TAB_FORWARD);
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
595 return TRUE;
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
596 }
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
597 if (!box->typing)
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
598 return FALSE;
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
599 gtk_gaim_status_box_pulse_typing(box);
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
600 g_source_remove(box->typing);
12309
b3385115815c [gaim-migrate @ 14613]
Mark Doliner <mark@kingant.net>
parents: 12294
diff changeset
601 box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, box);
12460
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
602
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
603 return FALSE;
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
604 }
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
605
11753
59ae71ae0b7c [gaim-migrate @ 14044]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11739
diff changeset
606 #if GTK_CHECK_VERSION(2,6,0)
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
607 static gboolean
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
608 dropdown_store_row_separator_func(GtkTreeModel *model,
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
609 GtkTreeIter *iter, gpointer data)
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
610 {
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
611 GtkGaimStatusBoxItemType type;
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
612
11885
163104122522 [gaim-migrate @ 14176]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11870
diff changeset
613 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1);
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
614
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
615 if (type == GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR)
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
616 return TRUE;
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
617
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
618 return FALSE;
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
619 }
11753
59ae71ae0b7c [gaim-migrate @ 14044]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11739
diff changeset
620 #endif
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
621
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 static void
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
623 cache_pixbufs(GtkGaimStatusBox *status_box)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
624 {
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
625 GtkIconSize icon_size;
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
626
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
627 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
628 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_TWO_LINE);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
629 else
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
630 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL_TWO_LINE);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
631
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
632 if (status_box->error_pixbuf != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
633 gdk_pixbuf_unref(status_box->error_pixbuf);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
634
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
635 status_box->error_pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
636 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
637 if (status_box->connecting_pixbufs[0] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
638 gdk_pixbuf_unref(status_box->connecting_pixbufs[0]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
639 if (status_box->connecting_pixbufs[1] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
640 gdk_pixbuf_unref(status_box->connecting_pixbufs[1]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
641 if (status_box->connecting_pixbufs[2] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
642 gdk_pixbuf_unref(status_box->connecting_pixbufs[2]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
643 if (status_box->connecting_pixbufs[3] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
644 gdk_pixbuf_unref(status_box->connecting_pixbufs[3]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
645
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
646 status_box->connecting_index = 0;
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
647 status_box->connecting_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT0,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
648 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
649 status_box->connecting_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT1,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
650 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
651 status_box->connecting_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT2,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
652 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
653 status_box->connecting_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_CONNECT3,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
654 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
655
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
656 if (status_box->typing_pixbufs[0] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
657 gdk_pixbuf_unref(status_box->typing_pixbufs[0]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
658 if (status_box->typing_pixbufs[1] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
659 gdk_pixbuf_unref(status_box->typing_pixbufs[1]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
660 if (status_box->typing_pixbufs[2] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
661 gdk_pixbuf_unref(status_box->typing_pixbufs[2]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
662 if (status_box->typing_pixbufs[3] != NULL)
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
663 gdk_pixbuf_unref(status_box->typing_pixbufs[3]);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
664
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
665 status_box->typing_index = 0;
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
666 status_box->typing_pixbufs[0] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING0,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
667 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
668 status_box->typing_pixbufs[1] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING1,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
669 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
670 status_box->typing_pixbufs[2] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING2,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
671 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
672 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_TYPING3,
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
673 icon_size, "GtkGaimStatusBox");
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
674 }
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
675
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
676 static void
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
677 current_status_pref_changed_cb(const char *name, GaimPrefType type,
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12782
diff changeset
678 gconstpointer val, gpointer data)
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
679 {
12244
65477e67a712 [gaim-migrate @ 14546]
Tim Ringenbach <marv@pidgin.im>
parents: 12228
diff changeset
680 GtkGaimStatusBox *box = data;
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
681
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
682 /* Make sure our current status is added to the list of popular statuses */
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
683 gtk_gaim_status_box_regenerate(box);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
684
12244
65477e67a712 [gaim-migrate @ 14546]
Tim Ringenbach <marv@pidgin.im>
parents: 12228
diff changeset
685 if (box->account)
65477e67a712 [gaim-migrate @ 14546]
Tim Ringenbach <marv@pidgin.im>
parents: 12228
diff changeset
686 update_to_reflect_account_status(box, box->account,
65477e67a712 [gaim-migrate @ 14546]
Tim Ringenbach <marv@pidgin.im>
parents: 12228
diff changeset
687 gaim_account_get_active_status(box->account));
65477e67a712 [gaim-migrate @ 14546]
Tim Ringenbach <marv@pidgin.im>
parents: 12228
diff changeset
688 else
65477e67a712 [gaim-migrate @ 14546]
Tim Ringenbach <marv@pidgin.im>
parents: 12228
diff changeset
689 update_to_reflect_current_status(box);
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
690 }
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
691
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
692 static void
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
693 buddy_list_details_pref_changed_cb(const char *name, GaimPrefType type,
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12782
diff changeset
694 gconstpointer val, gpointer data)
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
695 {
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
696 GtkGaimStatusBox *status_box = (GtkGaimStatusBox *)data;
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
697
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
698 cache_pixbufs(status_box);
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
699 gtk_gaim_status_box_regenerate(status_box);
12606
51b0ce9d45d9 [gaim-migrate @ 14942]
Richard Laager <rlaager@wiktel.com>
parents: 12598
diff changeset
700 update_size(status_box);
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
701 }
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
702
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
703 static void
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
704 spellcheck_prefs_cb(const char *name, GaimPrefType type,
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12782
diff changeset
705 gconstpointer value, gpointer data)
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
706 {
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
707 #ifdef USE_GTKSPELL
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
708 GtkGaimStatusBox *status_box = (GtkGaimStatusBox *)data;
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
709
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
710 if (value)
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
711 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml));
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
712 else
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
713 {
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
714 GtkSpell *spell;
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
715 spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(status_box->imhtml));
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
716 gtkspell_detach(spell);
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
717 }
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
718 #endif
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
719 }
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
720
12294
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
721 #if 0
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
722 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box)
12074
950acb2bc835 [gaim-migrate @ 14370]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12060
diff changeset
723 {
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
724
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
725 if (event->button != 1)
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
726 return FALSE;
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
727 gtk_combo_box_popdown(GTK_COMBO_BOX(box));
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
728 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
729 if (!box->imhtml_visible)
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
730 g_signal_emit_by_name(G_OBJECT(box), "changed", NULL, NULL);
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
731 return TRUE;
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
732 }
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
733
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
734 static gboolean button_pressed_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box)
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
735 {
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
736 if (event->button != 1)
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
737 return FALSE;
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
738 gtk_combo_box_popup(GTK_COMBO_BOX(box));
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
739 // Disabled until button_released_cb works
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
740 // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), TRUE);
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
741 return TRUE;
12074
950acb2bc835 [gaim-migrate @ 14370]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12060
diff changeset
742 }
12294
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
743 #endif
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
744
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
745 static void
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
746 toggled_cb(GtkWidget *widget, GtkGaimStatusBox *box)
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
747 {
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
748 gtk_combo_box_popup(GTK_COMBO_BOX(box));
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
749 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
750 }
12074
950acb2bc835 [gaim-migrate @ 14370]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12060
diff changeset
751
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
752 static void
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 {
11400
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
755 GtkCellRenderer *text_rend;
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
756 GtkCellRenderer *icon_rend;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 GtkTextBuffer *buffer;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 status_box->imhtml_visible = FALSE;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 status_box->connecting = FALSE;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 status_box->typing = FALSE;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 status_box->title = NULL;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
763 status_box->pixbuf = NULL;
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
764 status_box->toggle_button = gtk_toggle_button_new();
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
765 status_box->hbox = gtk_hbox_new(FALSE, 6);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 status_box->cell_view = gtk_cell_view_new();
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
767 status_box->vsep = gtk_vseparator_new();
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
768 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
769
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
770 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);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
771 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);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store));
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 gtk_list_store_append(status_box->store, &(status_box->iter));
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 gtk_gaim_status_box_refresh(status_box);
12074
950acb2bc835 [gaim-migrate @ 14370]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12060
diff changeset
777
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
778 gtk_container_add(GTK_CONTAINER(status_box->toggle_button), status_box->hbox);
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
779 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->cell_view, TRUE, TRUE, 0);
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
780 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->vsep, FALSE, FALSE, 0);
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
781 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->arrow, FALSE, FALSE, 0);
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
782 gtk_widget_show_all(status_box->toggle_button);
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
783 #if GTK_CHECK_VERSION(2,4,0)
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
784 gtk_button_set_focus_on_click(GTK_BUTTON(status_box->toggle_button), FALSE);
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
785 #endif
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
787 text_rend = gtk_cell_renderer_text_new();
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
788 icon_rend = gtk_cell_renderer_pixbuf_new();
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), icon_rend, FALSE);
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
790 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), text_rend, TRUE);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), icon_rend, "pixbuf", ICON_COLUMN, NULL);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), text_rend, "markup", TEXT_COLUMN, NULL);
13045
704dc95d0198 [gaim-migrate @ 15404]
Mark Doliner <mark@kingant.net>
parents: 13044
diff changeset
793 #if GTK_CHECK_VERSION(2, 6, 0)
704dc95d0198 [gaim-migrate @ 15404]
Mark Doliner <mark@kingant.net>
parents: 13044
diff changeset
794 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
704dc95d0198 [gaim-migrate @ 15404]
Mark Doliner <mark@kingant.net>
parents: 13044
diff changeset
795 #endif
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
797 status_box->icon_rend = gtk_cell_renderer_pixbuf_new();
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
798 status_box->text_rend = gtk_cell_renderer_text_new();
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE);
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
800 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "pixbuf", ICON_COLUMN, NULL);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL);
13045
704dc95d0198 [gaim-migrate @ 15404]
Mark Doliner <mark@kingant.net>
parents: 13044
diff changeset
803 #if GTK_CHECK_VERSION(2, 6, 0)
704dc95d0198 [gaim-migrate @ 15404]
Mark Doliner <mark@kingant.net>
parents: 13044
diff changeset
804 g_object_set(status_box->text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
704dc95d0198 [gaim-migrate @ 15404]
Mark Doliner <mark@kingant.net>
parents: 13044
diff changeset
805 #endif
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
807 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 6, NULL);
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
808
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 status_box->vbox = gtk_vbox_new(0, FALSE);
12879
f8748df5c17a [gaim-migrate @ 15231]
Gary Kramlich <grim@reaperworld.com>
parents: 12827
diff changeset
810 status_box->sw = gaim_gtk_create_imhtml(FALSE, &status_box->imhtml, NULL);
f8748df5c17a [gaim-migrate @ 15231]
Gary Kramlich <grim@reaperworld.com>
parents: 12827
diff changeset
811 gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE);
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
812
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml));
12294
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
814 #if 0
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
815 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event",
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
816 G_CALLBACK(button_pressed_cb), status_box);
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
817 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event",
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
818 G_CALLBACK(button_released_cb), status_box);
12294
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
819 #endif
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
820 g_signal_connect(G_OBJECT(status_box->toggle_button), "toggled",
d6b5373948f9 [gaim-migrate @ 14598]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12286
diff changeset
821 G_CALLBACK(toggled_cb), status_box);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(imhtml_changed_cb), status_box);
12460
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
823 g_signal_connect(G_OBJECT(status_box->imhtml), "format_function_toggle",
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
824 G_CALLBACK(imhtml_format_changed_cb), status_box);
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
825 g_signal_connect(G_OBJECT(status_box->imhtml), "key_press_event",
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
826 G_CALLBACK(imhtml_remove_focus), status_box);
11562
9f521a61ef58 [gaim-migrate @ 13828]
Sean Egan <seanegan@gmail.com>
parents: 11523
diff changeset
827 g_signal_connect_swapped(G_OBJECT(status_box->imhtml), "message_send", G_CALLBACK(remove_typing_cb), status_box);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE);
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
829 #ifdef USE_GTKSPELL
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
830 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
831 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml));
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
832 #endif
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 gtk_widget_set_parent(status_box->vbox, GTK_WIDGET(status_box));
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
834 gtk_widget_set_parent(status_box->toggle_button, GTK_WIDGET(status_box));
12275
0d6aeb831975 [gaim-migrate @ 14579]
Sean Egan <seanegan@gmail.com>
parents: 12274
diff changeset
835 GTK_BIN(status_box)->child = status_box->toggle_button;
12269
f1515af27443 [gaim-migrate @ 14571]
Sean Egan <seanegan@gmail.com>
parents: 12262
diff changeset
836
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0);
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
838
12827
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
839 g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL);
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
840 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event",
12827
0f40c44348f4 [gaim-migrate @ 15175]
Richard Laager <rlaager@wiktel.com>
parents: 12816
diff changeset
841 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml);
12075
f62022e07351 [gaim-migrate @ 14372]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12074
diff changeset
842
11850
0d793b594a23 [gaim-migrate @ 14141]
Nathan Walp <nwalp@pidgin.im>
parents: 11836
diff changeset
843 #if GTK_CHECK_VERSION(2,6,0)
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
844 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL);
11850
0d793b594a23 [gaim-migrate @ 14141]
Nathan Walp <nwalp@pidgin.im>
parents: 11836
diff changeset
845 #endif
0d793b594a23 [gaim-migrate @ 14141]
Nathan Walp <nwalp@pidgin.im>
parents: 11836
diff changeset
846
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
847 cache_pixbufs(status_box);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
848 gtk_gaim_status_box_regenerate(status_box);
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
849
12123
355c7acbb61d [gaim-migrate @ 14423]
Mark Doliner <mark@kingant.net>
parents: 12103
diff changeset
850 gaim_prefs_connect_callback(status_box, "/core/savedstatus/current",
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
851 current_status_pref_changed_cb, status_box);
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
852 gaim_prefs_connect_callback(status_box, "/gaim/gtk/blist/show_buddy_icons",
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12585
diff changeset
853 buddy_list_details_pref_changed_cb, status_box);
12651
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
854 gaim_prefs_connect_callback(status_box, "/gaim/gtk/conversations/spellcheck",
a74cb5952db4 [gaim-migrate @ 14992]
Mark Doliner <mark@kingant.net>
parents: 12634
diff changeset
855 spellcheck_prefs_cb, status_box);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 static void
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
859 gtk_gaim_status_box_size_request(GtkWidget *widget,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
860 GtkRequisition *requisition)
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
862 GtkRequisition box_req;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
863 combo_box_size_request(widget, requisition);
12596
037a673ba862 [gaim-migrate @ 14926]
Richard Laager <rlaager@wiktel.com>
parents: 12595
diff changeset
864 requisition->height += 3;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
865
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 if (box_req.height > 1)
12596
037a673ba862 [gaim-migrate @ 14926]
Richard Laager <rlaager@wiktel.com>
parents: 12595
diff changeset
868 requisition->height = requisition->height + box_req.height + 3;
12286
255e6912607b [gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12275
diff changeset
869
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 requisition->width = 1;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 static void
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
874 gtk_gaim_status_box_size_allocate(GtkWidget *widget,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
875 GtkAllocation *allocation)
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877 GtkRequisition req = {0,0};
11400
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
878 GtkAllocation parent_alc, box_alc;
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
879
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
880 parent_alc = *allocation;
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
881 box_alc = *allocation;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 combo_box_size_request(widget, &req);
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
883
12596
037a673ba862 [gaim-migrate @ 14926]
Richard Laager <rlaager@wiktel.com>
parents: 12595
diff changeset
884 box_alc.height = MAX(1, (allocation->height - req.height - 6));
037a673ba862 [gaim-migrate @ 14926]
Richard Laager <rlaager@wiktel.com>
parents: 12595
diff changeset
885 box_alc.y = box_alc.y + req.height + 6;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
886
12102
8df87db79bad [gaim-migrate @ 14399]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12100
diff changeset
887 box_alc.width -= 6;
8df87db79bad [gaim-migrate @ 14399]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12100
diff changeset
888 box_alc.x += 3;
12100
383226e075f2 [gaim-migrate @ 14397]
Mark Doliner <mark@kingant.net>
parents: 12080
diff changeset
889
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->vbox, &box_alc);
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
891
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 parent_alc.height = MAX(1,req.height);
12102
8df87db79bad [gaim-migrate @ 14399]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12100
diff changeset
893 parent_alc.width -= 6;
8df87db79bad [gaim-migrate @ 14399]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12100
diff changeset
894 parent_alc.x += 3;
8df87db79bad [gaim-migrate @ 14399]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12100
diff changeset
895 parent_alc.y += 3;
12100
383226e075f2 [gaim-migrate @ 14397]
Mark Doliner <mark@kingant.net>
parents: 12080
diff changeset
896
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 combo_box_size_allocate(widget, &parent_alc);
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
898 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->toggle_button, &parent_alc);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 widget->allocation = *allocation;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 static gboolean
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
903 gtk_gaim_status_box_expose_event(GtkWidget *widget,
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
904 GdkEventExpose *event)
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 {
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
906 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget);
12262
6e55515e4b39 [gaim-migrate @ 14564]
Sean Egan <seanegan@gmail.com>
parents: 12256
diff changeset
907 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event);
12275
0d6aeb831975 [gaim-migrate @ 14579]
Sean Egan <seanegan@gmail.com>
parents: 12274
diff changeset
908 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event);
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
909 return FALSE;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 static void
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
913 gtk_gaim_status_box_forall(GtkContainer *container,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
914 gboolean include_internals,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
915 GtkCallback callback,
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
916 gpointer callback_data)
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 {
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
918 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX (container);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
920 if (include_internals)
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
921 {
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
922 (* callback) (status_box->vbox, callback_data);
12275
0d6aeb831975 [gaim-migrate @ 14579]
Sean Egan <seanegan@gmail.com>
parents: 12274
diff changeset
923 (* callback) (status_box->toggle_button, callback_data);
0d6aeb831975 [gaim-migrate @ 14579]
Sean Egan <seanegan@gmail.com>
parents: 12274
diff changeset
924 (* callback) (status_box->arrow, callback_data);
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
925 }
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
927 combo_box_forall(container, include_internals, callback, callback_data);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 GtkWidget *
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 gtk_gaim_status_box_new()
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, NULL);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935
11499
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
936 GtkWidget *
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
937 gtk_gaim_status_box_new_with_account(GaimAccount *account)
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
938 {
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
939 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", account, NULL);
6f9fc83ee25c [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
940 }
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 void
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
943 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data)
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 GtkTreeIter iter;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 char *t;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
947
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 if (sec_text) {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 char aa_color[8];
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
950 gchar *escaped;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(status_box));
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x",
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 style->text_aa[GTK_STATE_NORMAL].red >> 8,
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 style->text_aa[GTK_STATE_NORMAL].green >> 8,
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
955 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
956 escaped = g_markup_escape_text(sec_text, -1);
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
957 t = g_strdup_printf("%s\n<span color=\"%s\">%s</span>", text, aa_color, escaped);
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
958 g_free(escaped);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 } else {
13044
18fc2a679e38 [gaim-migrate @ 15403]
Mark Doliner <mark@kingant.net>
parents: 13025
diff changeset
960 t = g_markup_escape_text(text, -1);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961 }
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
962
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 gtk_list_store_append(status_box->dropdown_store, &iter);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 gtk_list_store_set(status_box->dropdown_store, &iter,
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
965 TYPE_COLUMN, type,
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 ICON_COLUMN, pixbuf,
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
967 TEXT_COLUMN, t,
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 TITLE_COLUMN, text,
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
969 DESC_COLUMN, sec_text,
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
970 DATA_COLUMN, data,
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
971 -1);
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
972 g_free(t);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 void
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
976 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box)
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
977 {
11756
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
978 /* Don't do anything unless GTK actually supports
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
979 * gtk_combo_box_set_row_separator_func */
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
980 #if GTK_CHECK_VERSION(2,6,0)
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
981 GtkTreeIter iter;
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
982
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
983 gtk_list_store_append(status_box->dropdown_store, &iter);
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
984 gtk_list_store_set(status_box->dropdown_store, &iter,
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
985 TYPE_COLUMN, GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR,
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
986 -1);
11756
f54c680d835c [gaim-migrate @ 14047]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11755
diff changeset
987 #endif
11738
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
988 }
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
989
992d49cf2b92 [gaim-migrate @ 14029]
Mark Doliner <mark@kingant.net>
parents: 11732
diff changeset
990 void
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 {
11523
1116993aadd2 [gaim-migrate @ 13771]
Sean Egan <seanegan@gmail.com>
parents: 11499
diff changeset
993 if (status_box->error)
1116993aadd2 [gaim-migrate @ 13771]
Sean Egan <seanegan@gmail.com>
parents: 11499
diff changeset
994 g_free(status_box->error);
11891
f1ada7870fae [gaim-migrate @ 14182]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11885
diff changeset
995 status_box->error = NULL;
13023
e8adf8183cf4 [gaim-migrate @ 15376]
Mark Doliner <mark@kingant.net>
parents: 13012
diff changeset
996 #if 0
11891
f1ada7870fae [gaim-migrate @ 14182]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11885
diff changeset
997 if (error != NULL)
f1ada7870fae [gaim-migrate @ 14182]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11885
diff changeset
998 status_box->error = g_strdup(error);
13023
e8adf8183cf4 [gaim-migrate @ 15376]
Mark Doliner <mark@kingant.net>
parents: 13012
diff changeset
999 #endif
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 gtk_gaim_status_box_refresh(status_box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 void
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 if (!status_box)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 return;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 status_box->connecting = connecting;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 gtk_gaim_status_box_refresh(status_box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 void
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 if (!status_box)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 return;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 if (status_box->connecting_index == 3)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 status_box->connecting_index = 0;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
1019 else
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 status_box->connecting_index++;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 gtk_gaim_status_box_refresh(status_box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
1024 static void
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025 gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 if (status_box->typing_index == 3)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 status_box->typing_index = 0;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
1029 else
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030 status_box->typing_index++;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 gtk_gaim_status_box_refresh(status_box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033
11993
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1034 static GaimStatusType
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1035 *find_status_type_by_index(const GaimAccount *account, gint active)
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1036 {
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1037 const GList *l = gaim_account_get_status_types(account);
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1038 gint i;
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1039
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1040 for (i = 0; l; l = l->next) {
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1041 GaimStatusType *status_type = l->data;
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1042 if (!gaim_status_type_is_user_settable(status_type))
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1043 continue;
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1044
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1045 if (active == i)
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1046 return status_type;
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1047 i++;
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1048 }
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1049
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1050 return NULL;
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1051 }
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1052
12076
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1053 static gboolean
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1054 message_changed(const char *one, const char *two)
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1055 {
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1056 if (one == NULL && two == NULL)
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1057 return FALSE;
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1058
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1059 if (one == NULL || two == NULL)
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1060 return TRUE;
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1061
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1062 return (g_utf8_collate(one, two) != 0);
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1063 }
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1064
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1065 static void
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1066 activate_currently_selected_status(GtkGaimStatusBox *status_box)
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 {
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1068 GtkGaimStatusBoxItemType type;
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1069 gpointer data;
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1070 gchar *title;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 GtkTreeIter iter;
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1072 char *message;
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1073 GaimSavedStatus *saved_status;
12076
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1074 gboolean changed = TRUE;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1076 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter))
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1077 return;
12659
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1078
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1079 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1080 TYPE_COLUMN, &type,
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1081 DATA_COLUMN, &data,
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1082 -1);
12074
950acb2bc835 [gaim-migrate @ 14370]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12060
diff changeset
1083
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1084 /*
13025
7d39e6c73dc3 [gaim-migrate @ 15378]
Mark Doliner <mark@kingant.net>
parents: 13023
diff changeset
1085 * If the currently selected status is "New..." or
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1086 * "Saved..." or a popular status then do nothing.
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1087 * Custom statuses are
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
1088 * activated elsewhere, and we update the status_box
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
1089 * accordingly by monitoring the preference
12123
355c7acbb61d [gaim-migrate @ 14423]
Mark Doliner <mark@kingant.net>
parents: 12103
diff changeset
1090 * "/core/savedstatus/current" and then calling
11954
351f4dd75718 [gaim-migrate @ 14245]
Mark Doliner <mark@kingant.net>
parents: 11951
diff changeset
1091 * update_to_reflect_current_status()
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1092 */
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1093 if (type != GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE)
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1094 return;
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1095
12659
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1096 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1097 TITLE_COLUMN, &title, -1);
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1098
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1099 message = gtk_gaim_status_box_get_message(status_box);
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1100 if (!message || !*message)
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1101 {
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1102 gtk_widget_hide_all(status_box->vbox);
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1103 status_box->imhtml_visible = FALSE;
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1104 }
4c50dd655c30 [gaim-migrate @ 15002]
Mark Doliner <mark@kingant.net>
parents: 12651
diff changeset
1105
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1106 if (status_box->account == NULL) {
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1107 /* Global */
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1108 /* Save the newly selected status to prefs.xml and status.xml */
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1109
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1110 /* Has the status been really changed? */
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1111 saved_status = gaim_savedstatus_get_current();
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1112 if (gaim_savedstatus_get_type(saved_status) == GPOINTER_TO_INT(data))
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1113 {
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1114 if (!message_changed(gaim_savedstatus_get_message(saved_status), message))
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1115 changed = FALSE;
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1116 }
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1117
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1118 if (changed)
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1119 {
13012
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1120 /* If we've used this type+message before, lookup the transient status */
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1121 saved_status = gaim_savedstatus_find_by_type_and_message(
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1122 GPOINTER_TO_INT(data), message);
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1123
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1124
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1125 /* If this type+message is unique then create a new transient saved status */
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1126 if (saved_status == NULL)
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1127 {
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1128 saved_status = gaim_savedstatus_new(NULL, GPOINTER_TO_INT(data));
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1129 gaim_savedstatus_set_message(saved_status, message);
e3b9c6c7bcf6 [gaim-migrate @ 15365]
Mark Doliner <mark@kingant.net>
parents: 12932
diff changeset
1130 }
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1131
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1132 /* Set the status for each account */
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1133 gaim_savedstatus_activate(saved_status);
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1134 }
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1135 } else {
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1136 /* Per-account */
11981
053bb5ad040b [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1137 gint active;
053bb5ad040b [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1138 GaimStatusType *status_type;
12076
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1139 GaimStatus *status;
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1140 const char *id = NULL;
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1141
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1142 status = gaim_account_get_active_status(status_box->account);
11981
053bb5ad040b [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1143
053bb5ad040b [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1144 g_object_get(G_OBJECT(status_box), "active", &active, NULL);
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1145
11993
aa77da6c7f21 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1146 status_type = find_status_type_by_index(status_box->account, active);
12076
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1147 id = gaim_status_type_get_id(status_type);
11981
053bb5ad040b [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1148
12076
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1149 if (strncmp(id, gaim_status_get_id(status), strlen(id)) == 0)
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1150 {
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1151 /* Selected status and previous status is the same */
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1152 if (!message_changed(message, gaim_status_get_attr_string(status, "message")))
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1153 changed = FALSE;
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1154 }
12123
355c7acbb61d [gaim-migrate @ 14423]
Mark Doliner <mark@kingant.net>
parents: 12103
diff changeset
1155
12076
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1156 if (changed)
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1157 {
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1158 if (message)
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1159 gaim_account_set_status(status_box->account, id,
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1160 TRUE, "message", message, NULL);
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1161 else
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1162 gaim_account_set_status(status_box->account, id,
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1163 TRUE, NULL);
4fb1edd43f45 [gaim-migrate @ 14373]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12075
diff changeset
1164 }
11981
053bb5ad040b [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1165 }
11627
5dbefebb20cb [gaim-migrate @ 13902]
Tim Ringenbach <marv@pidgin.im>
parents: 11593
diff changeset
1166
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1167 g_free(title);
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1168 g_free(message);
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1169 }
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1170
12597
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1171 static void update_size(GtkGaimStatusBox *status_box)
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1172 {
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1173 GtkTextBuffer *buffer;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1174 GtkTextIter iter;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1175 int wrapped_lines;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1176 int lines;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1177 GdkRectangle oneline;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1178 int height;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1179 int pad_top, pad_inside, pad_bottom;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1180
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1181 if (!status_box->imhtml_visible)
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1182 {
12598
1c122dbc8e9e [gaim-migrate @ 14928]
Richard Laager <rlaager@wiktel.com>
parents: 12597
diff changeset
1183 if (status_box->vbox != NULL)
1c122dbc8e9e [gaim-migrate @ 14928]
Richard Laager <rlaager@wiktel.com>
parents: 12597
diff changeset
1184 gtk_widget_set_size_request(status_box->vbox, -1, -1);
12597
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1185 return;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1186 }
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1187
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1188 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml));
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1189
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1190 wrapped_lines = 1;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1191 gtk_text_buffer_get_start_iter(buffer, &iter);
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1192 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(status_box->imhtml), &iter))
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1193 wrapped_lines++;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1194
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1195 lines = gtk_text_buffer_get_line_count(buffer);
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1196
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1197 /* Show a maximum of 4 lines */
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1198 lines = MIN(lines, 4);
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1199 wrapped_lines = MIN(wrapped_lines, 4);
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1200
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1201 gtk_text_buffer_get_start_iter(buffer, &iter);
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1202 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->imhtml), &iter, &oneline);
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1203
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1204 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(status_box->imhtml));
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1205 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(status_box->imhtml));
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1206 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(status_box->imhtml));
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1207
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1208 height = (oneline.height + pad_top + pad_bottom) * lines;
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1209 height += (oneline.height + pad_inside) * (wrapped_lines - lines);
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1210
12905
ee0c8c446eef [gaim-migrate @ 15258]
Richard Laager <rlaager@wiktel.com>
parents: 12879
diff changeset
1211 gtk_widget_set_size_request(status_box->vbox, -1, height + GAIM_HIG_BOX_SPACE);
12597
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1212 }
842b3b897cde [gaim-migrate @ 14927]
Richard Laager <rlaager@wiktel.com>
parents: 12596
diff changeset
1213
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1214 static void remove_typing_cb(GtkGaimStatusBox *status_box)
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1215 {
12782
57d94c725dbc [gaim-migrate @ 15129]
Mark Doliner <mark@kingant.net>
parents: 12779
diff changeset
1216 if (status_box->typing == 0)
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1217 {
12782
57d94c725dbc [gaim-migrate @ 15129]
Mark Doliner <mark@kingant.net>
parents: 12779
diff changeset
1218 /* Nothing has changed, so we don't need to do anything */
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1219 update_to_reflect_current_status(status_box);
12782
57d94c725dbc [gaim-migrate @ 15129]
Mark Doliner <mark@kingant.net>
parents: 12779
diff changeset
1220 return;
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1221 }
12782
57d94c725dbc [gaim-migrate @ 15129]
Mark Doliner <mark@kingant.net>
parents: 12779
diff changeset
1222
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1223 activate_currently_selected_status(status_box);
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1224
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1225 g_source_remove(status_box->typing);
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1226 status_box->typing = 0;
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1227 gtk_gaim_status_box_refresh(status_box);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230 static void gtk_gaim_status_box_changed(GtkComboBox *box)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231 {
11400
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
1232 GtkGaimStatusBox *status_box;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1233 GtkTreeIter iter;
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1234 GtkGaimStatusBoxItemType type;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235 char *text, *sec_text;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 GdkPixbuf *pixbuf;
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1237 gpointer data;
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1238 GList *accounts = NULL, *node;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239
11400
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
1240 status_box = GTK_GAIM_STATUS_BOX(box);
62db025d3eb0 [gaim-migrate @ 13635]
Mark Doliner <mark@kingant.net>
parents: 11347
diff changeset
1241
12074
950acb2bc835 [gaim-migrate @ 14370]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12060
diff changeset
1242 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter))
950acb2bc835 [gaim-migrate @ 14370]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12060
diff changeset
1243 return;
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1244 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1245 TYPE_COLUMN, &type,
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1246 TITLE_COLUMN, &text,
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1247 DESC_COLUMN, &sec_text,
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1248 ICON_COLUMN, &pixbuf,
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1249 DATA_COLUMN, &data,
11739
a25be0e70a67 [gaim-migrate @ 14030]
Mark Doliner <mark@kingant.net>
parents: 11738
diff changeset
1250 -1);
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 if (status_box->title)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252 g_free(status_box->title);
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1253 status_box->title = text;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254 if (status_box->desc && sec_text)
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1255 g_free(status_box->desc);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1256 status_box->desc = sec_text;
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 if (status_box->pixbuf)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258 g_object_unref(status_box->pixbuf);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 status_box->pixbuf = pixbuf;
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1260 if (status_box->typing)
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1261 g_source_remove(status_box->typing);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1262 status_box->typing = 0;
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
1263
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1264 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
11729
8a981a601242 [gaim-migrate @ 14020]
Mark Doliner <mark@kingant.net>
parents: 11724
diff changeset
1265 {
12778
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1266 if (type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR)
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1267 {
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1268 GaimSavedStatus *saved;
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1269 saved = gaim_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1270 g_return_if_fail(saved != NULL);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1271 gaim_savedstatus_activate(saved);
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1272 return;
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1273 }
a36eec90c604 [gaim-migrate @ 15125]
Mark Doliner <mark@kingant.net>
parents: 12731
diff changeset
1274
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1275 if (type == GTK_GAIM_STATUS_BOX_TYPE_CUSTOM)
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1276 {
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1277 gaim_gtk_status_editor_show(NULL);
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1278 update_to_reflect_current_status(status_box);
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1279 return;
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1280 }
11729
8a981a601242 [gaim-migrate @ 14020]
Mark Doliner <mark@kingant.net>
parents: 11724
diff changeset
1281
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1282 if (type == GTK_GAIM_STATUS_BOX_TYPE_SAVED)
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1283 {
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1284 gaim_gtk_status_window_show();
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1285 update_to_reflect_current_status(status_box);
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1286 return;
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1287 }
11729
8a981a601242 [gaim-migrate @ 14020]
Mark Doliner <mark@kingant.net>
parents: 11724
diff changeset
1288 }
8a981a601242 [gaim-migrate @ 14020]
Mark Doliner <mark@kingant.net>
parents: 11724
diff changeset
1289
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1290 /*
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1291 * Show the message box whenever the primitive allows for a
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1292 * message attribute on any protocol that is enabled,
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1293 * or our protocol, if we have account set
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1294 */
11960
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1295 if (status_box->account)
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1296 accounts = g_list_prepend(accounts, status_box->account);
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1297 else
082a2a9aa998 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1298 accounts = gaim_accounts_get_all_active();
11755
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1299 status_box->imhtml_visible = FALSE;
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1300 for (node = accounts; node != NULL; node = node->next)
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1301 {
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1302 GaimAccount *account;
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1303 GaimStatusType *status_type;
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1304
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1305 account = node->data;
12779
a09027e9d159 [gaim-migrate @ 15126]
Mark Doliner <mark@kingant.net>
parents: 12778
diff changeset
1306 status_type = gaim_account_get_status_type_with_primitive(account, GPOINTER_TO_INT(data));
11755
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1307 if ((status_type != NULL) &&
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1308 (gaim_status_type_get_attr(status_type, "message") != NULL))
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1309 {
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1310 status_box->imhtml_visible = TRUE;
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1311 break;
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1312 }
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1313 }
50496ebef401 [gaim-migrate @ 14046]
Mark Doliner <mark@kingant.net>
parents: 11753
diff changeset
1314 g_list_free(accounts);
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1315
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1316 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
11654
bf6ba37db13b [gaim-migrate @ 13938]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
1317 {
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1318 if (status_box->imhtml_visible)
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1319 {
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1320 GtkTextBuffer *buf;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1321 GtkTextIter start, end;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1322 gtk_widget_show_all(status_box->vbox);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1323 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) {
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1324 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1325 }
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1326 gtk_widget_grab_focus(status_box->imhtml);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1327 buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml));
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1328 gtk_text_buffer_get_start_iter(buf, &start);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1329 gtk_text_buffer_get_end_iter(buf, &end);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1330 gtk_text_buffer_move_mark_by_name(buf, "insert", &end);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1331 gtk_text_buffer_move_mark_by_name(buf, "selection_bound", &start);
12274
3d9ef8a98074 [gaim-migrate @ 14578]
Sean Egan <seanegan@gmail.com>
parents: 12269
diff changeset
1332 }
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1333 else
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1334 {
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1335 gtk_widget_hide_all(status_box->vbox);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1336 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1337 activate_currently_selected_status(status_box); /* This is where we actually set the status */
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1338 }
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1339 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1340 gtk_gaim_status_box_refresh(status_box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1343 static gint
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1344 get_statusbox_index(GtkGaimStatusBox *box, GaimSavedStatus *saved_status)
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1345 {
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1346 gint index;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1347
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1348 switch (gaim_savedstatus_get_type(saved_status))
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1349 {
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1350 case GAIM_STATUS_AVAILABLE:
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1351 index = 0;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1352 break;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1353 case GAIM_STATUS_AWAY:
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1354 index = 1;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1355 break;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1356 case GAIM_STATUS_INVISIBLE:
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1357 index = 2;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1358 break;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1359 case GAIM_STATUS_OFFLINE:
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1360 index = 3;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1361 break;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1362 default:
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1363 index = GTK_LIST_STORE(box->dropdown_store)->length - 2;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1364 break;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1365 }
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1366
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1367 return index;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1368 }
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1369
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data)
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1372 GtkGaimStatusBox *box = (GtkGaimStatusBox*)data;
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1373 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(box)))
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1374 {
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1375 if (box->typing) {
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1376 gtk_gaim_status_box_pulse_typing(box);
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1377 g_source_remove(box->typing);
12932
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1378 } else {
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1379 gint index;
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1380 GaimSavedStatus *saved = gaim_savedstatus_get_current();
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1381
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1382 index = get_statusbox_index(box, saved);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1383
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1384 gtk_widget_set_sensitive(GTK_WIDGET(box), FALSE);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1385 gtk_combo_box_set_active(GTK_COMBO_BOX(box), index);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1386 gtk_widget_set_sensitive(GTK_WIDGET(box), TRUE);
d7b9fa3b7baf [gaim-migrate @ 15285]
Luke Schierer <lschiere@pidgin.im>
parents: 12905
diff changeset
1387 gtk_widget_grab_focus(box->imhtml);
11951
b6fa01513d76 [gaim-migrate @ 14242]
Mark Doliner <mark@kingant.net>
parents: 11891
diff changeset
1388 }
12309
b3385115815c [gaim-migrate @ 14613]
Mark Doliner <mark@kingant.net>
parents: 12294
diff changeset
1389 box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, box);
10861
42c16b293867 [gaim-migrate @ 12544]
Mark Doliner <mark@kingant.net>
parents: 10749
diff changeset
1390 }
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1391 gtk_gaim_status_box_refresh(box);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392 }
10649
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10643
diff changeset
1393
12460
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
1394 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data)
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
1395 {
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
1396 imhtml_changed_cb(NULL, data);
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
1397 }
3d999a4d4892 [gaim-migrate @ 14770]
Richard Laager <rlaager@wiktel.com>
parents: 12379
diff changeset
1398
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11627
diff changeset
1399 char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box)
10649
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10643
diff changeset
1400 {
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10643
diff changeset
1401 if (status_box->imhtml_visible)
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10643
diff changeset
1402 return gtk_imhtml_get_markup(GTK_IMHTML(status_box->imhtml));
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10643
diff changeset
1403 else
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10643
diff changeset
1404 return NULL;
3353656c119e [gaim-migrate @ 12167]
Sean Egan <seanegan@gmail.com>
parents: 10643
diff changeset
1405 }