annotate src/gtkstatusbox.c @ 13124:a0cdde3b06cf

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