annotate src/gtkstatusbox.c @ 12820:cb3cbd69284d

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