pidgin/gtkstatusbox.c

Tue, 08 May 2018 05:31:09 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Tue, 08 May 2018 05:31:09 -0400
changeset 39014
1060a53d09e8
parent 38712
ea49cd76cf47
child 39568
f4714f1de6d0
permissions
-rw-r--r--

Fix build with plugins disabled.

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
1 /* pidgin
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15885
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
5 * source distribution.
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
6 *
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 *
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 *
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19659
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 */
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
22 /*
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
23 * The status box is made up of two main pieces:
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
24 * - The box that displays the current status, which is made
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
25 * of a GtkListStore ("status_box->store") and GtkCellView
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
26 * ("status_box->cell_view"). There is always exactly 1 row
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
27 * in this list store. Only the TYPE_ICON and TYPE_TEXT
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
28 * columns are used in this list store.
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
29 * - The dropdown menu that lets users select a status, which
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
30 * is made of a GtkComboBox ("status_box") and GtkListStore
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
31 * ("status_box->dropdown_store"). This dropdown is shown
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
32 * when the user clicks on the box that displays the current
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
33 * status. This list store contains one row for Available,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
34 * one row for Away, etc., a few rows for popular statuses,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
35 * and the "New..." and "Saved..." options.
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
36 */
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
37
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
38 #include <gdk/gdkkeysyms.h>
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
39
18273
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18261
diff changeset
40 #include "internal.h"
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18261
diff changeset
41
11627
07feb58977aa [gaim-migrate @ 13902]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11593
diff changeset
42 #include "account.h"
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
43 #include "buddyicon.h"
15885
01f2c945c63c who knew that --disable-plugins still worked?! Also, some completely untested support for aim:buddyicon, which I'll look at more tomorrow
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
44 #include "core.h"
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
45 #include "network.h"
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
46 #include "request.h"
11627
07feb58977aa [gaim-migrate @ 13902]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11593
diff changeset
47 #include "savedstatuses.h"
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
48 #include "status.h"
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
49 #include "debug.h"
11627
07feb58977aa [gaim-migrate @ 13902]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11593
diff changeset
50
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
51 #include "pidgin.h"
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
52 #include "gtksavedstatuses.h"
15883
969b74a3e27a According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
53 #include "pidginstock.h"
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
54 #include "gtkstatusbox.h"
12080
2aaca2265a51 [gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12076
diff changeset
55 #include "gtkutils.h"
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
56
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33162
diff changeset
57 #include "gtk3compat.h"
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
58
26753
a8dca8faae69 A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents: 25903
diff changeset
59 /* Timeout for typing notifications in seconds */
a8dca8faae69 A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents: 25903
diff changeset
60 #define TYPING_TIMEOUT 4
12309
e42cff3223a3 [gaim-migrate @ 14613]
Mark Doliner <markdoliner@pidgin.im>
parents: 12294
diff changeset
61
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
62 static void webview_changed_cb(PidginWebView *webview, void *data);
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
63 static void webview_format_changed_cb(PidginWebView *webview, PidginWebViewButtons buttons, void *data);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
64 static void remove_typing_cb(PidginStatusBox *box);
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
65 static void update_size (PidginStatusBox *box);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
66 static gint get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status);
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
67 static PurpleAccount* check_active_accounts_for_identical_statuses(void);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
68
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
69 static void pidgin_status_box_pulse_typing(PidginStatusBox *status_box);
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
70 static void pidgin_status_box_refresh(PidginStatusBox *status_box);
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
71 static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed);
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
72 static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
73 static void pidgin_status_box_changed(PidginStatusBox *box);
32404
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
74 static void pidgin_status_box_get_preferred_height (GtkWidget *widget,
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
75 gint *minimum_height, gint *natural_height);
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33162
diff changeset
76 static gboolean pidgin_status_box_draw (GtkWidget *widget, cairo_t *cr);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
77 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
78 static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box);
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
79 static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
80 static void pidgin_status_box_popup(PidginStatusBox *box, GdkEvent *event);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
81 static void pidgin_status_box_popdown(PidginStatusBox *box, GdkEvent *event);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
82
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
83 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
84 static void icon_choose_cb(const char *filename, gpointer data);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
85 static void remove_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box);
27117
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
86 static void choose_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box);
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
87
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
88 enum {
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
89 /* A PidginStatusBoxItemType */
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
90 TYPE_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
91
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
92 /* This is the stock-id for the icon. */
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
93 ICON_STOCK_COLUMN,
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
94
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
95 /*
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
96 * This is a GdkPixbuf (the other columns are strings).
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
97 * This column is visible.
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
98 */
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
99 ICON_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
100
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
101 /* The text displayed on the status box. This column is visible. */
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
102 TEXT_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
103
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
104 /* The plain-English title of this item */
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
105 TITLE_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
106
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
107 /* A plain-English description of this item */
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
108 DESC_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
109
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
110 /*
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
111 * This value depends on TYPE_COLUMN. For POPULAR types,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
112 * this is the creation time. For PRIMITIVE types,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
113 * this is the PurpleStatusPrimitive.
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
114 */
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
115 DATA_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
116
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
117 /*
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
118 * This column stores the GdkPixbuf for the status emblem. Currently only 'saved' is stored.
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
119 * In the GtkTreeModel for the dropdown, this is the stock-id (gchararray), and for the
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
120 * GtkTreeModel for the cell_view (for the account-specific statusbox), this is the protocol icon
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
121 * (GdkPixbuf) of the account.
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
122 */
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
123 EMBLEM_COLUMN,
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
124
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
125 /*
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
126 * This column stores whether to show the emblem.
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
127 */
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
128 EMBLEM_VISIBLE_COLUMN,
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
129
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
130 NUM_COLUMNS
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
131 };
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
132
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
133 enum {
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
134 PROP_0,
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
135 PROP_ACCOUNT,
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
136 PROP_ICON_SEL,
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
137 };
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
138
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
139 static char *typing_stock_ids[7] = {
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
140 PIDGIN_STOCK_ANIMATION_TYPING0,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
141 PIDGIN_STOCK_ANIMATION_TYPING1,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
142 PIDGIN_STOCK_ANIMATION_TYPING2,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
143 PIDGIN_STOCK_ANIMATION_TYPING3,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
144 PIDGIN_STOCK_ANIMATION_TYPING4,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
145 NULL
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
146 };
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
147
26887
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
148 static char *connecting_stock_ids[] = {
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
149 PIDGIN_STOCK_ANIMATION_CONNECT0,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
150 PIDGIN_STOCK_ANIMATION_CONNECT1,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
151 PIDGIN_STOCK_ANIMATION_CONNECT2,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
152 PIDGIN_STOCK_ANIMATION_CONNECT3,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
153 PIDGIN_STOCK_ANIMATION_CONNECT4,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
154 PIDGIN_STOCK_ANIMATION_CONNECT5,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
155 PIDGIN_STOCK_ANIMATION_CONNECT6,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
156 PIDGIN_STOCK_ANIMATION_CONNECT7,
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
157 PIDGIN_STOCK_ANIMATION_CONNECT8,
26887
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
158 PIDGIN_STOCK_ANIMATION_CONNECT9,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
159 PIDGIN_STOCK_ANIMATION_CONNECT10,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
160 PIDGIN_STOCK_ANIMATION_CONNECT11,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
161 PIDGIN_STOCK_ANIMATION_CONNECT12,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
162 PIDGIN_STOCK_ANIMATION_CONNECT13,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
163 PIDGIN_STOCK_ANIMATION_CONNECT14,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
164 PIDGIN_STOCK_ANIMATION_CONNECT15,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
165 PIDGIN_STOCK_ANIMATION_CONNECT16,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
166 PIDGIN_STOCK_ANIMATION_CONNECT17,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
167 PIDGIN_STOCK_ANIMATION_CONNECT18,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
168 PIDGIN_STOCK_ANIMATION_CONNECT19,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
169 PIDGIN_STOCK_ANIMATION_CONNECT20,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
170 PIDGIN_STOCK_ANIMATION_CONNECT21,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
171 PIDGIN_STOCK_ANIMATION_CONNECT22,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
172 PIDGIN_STOCK_ANIMATION_CONNECT23,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
173 PIDGIN_STOCK_ANIMATION_CONNECT24,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
174 PIDGIN_STOCK_ANIMATION_CONNECT25,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
175 PIDGIN_STOCK_ANIMATION_CONNECT26,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
176 PIDGIN_STOCK_ANIMATION_CONNECT27,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
177 PIDGIN_STOCK_ANIMATION_CONNECT28,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
178 PIDGIN_STOCK_ANIMATION_CONNECT29,
42bb7a83f5d3 Use a all the icons hbons had created for 'connecting' animation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26886
diff changeset
179 PIDGIN_STOCK_ANIMATION_CONNECT30,
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
180 NULL
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
181 };
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
182
26886
e071638184b6 Don't expose the parent class.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26885
diff changeset
183 static GtkContainerClass *parent_class = NULL;
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
184
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
185 static void pidgin_status_box_class_init (PidginStatusBoxClass *klass);
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
186 static void pidgin_status_box_init (PidginStatusBox *status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
187
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
188 GType
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
189 pidgin_status_box_get_type (void)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
190 {
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
191 static GType status_box_type = 0;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
192
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
193 if (!status_box_type)
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
194 {
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
195 static const GTypeInfo status_box_info =
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
196 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
197 sizeof (PidginStatusBoxClass),
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
198 NULL, /* base_init */
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
199 NULL, /* base_finalize */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
200 (GClassInitFunc) pidgin_status_box_class_init,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
201 NULL, /* class_finalize */
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
202 NULL, /* class_data */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
203 sizeof (PidginStatusBox),
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
204 0,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
205 (GInstanceInitFunc) pidgin_status_box_init,
12221
49832990a0a4 [gaim-migrate @ 14523]
Richard Laager <rlaager@pidgin.im>
parents: 12125
diff changeset
206 NULL /* value_table */
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
207 };
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
208
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
209 status_box_type = g_type_register_static(GTK_TYPE_CONTAINER,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
210 "PidginStatusBox",
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
211 &status_box_info,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
212 0);
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
213 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
214
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
215 return status_box_type;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
216 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
217
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
219 pidgin_status_box_get_property(GObject *object, guint param_id,
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
220 GValue *value, GParamSpec *psec)
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
221 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
222 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(object);
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
223
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
224 switch (param_id) {
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
225 case PROP_ACCOUNT:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
226 g_value_set_pointer(value, statusbox->account);
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
227 break;
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
228 case PROP_ICON_SEL:
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
229 g_value_set_boolean(value, statusbox->icon_box != NULL);
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
230 break;
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
231 default:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
232 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, psec);
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
233 break;
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
234 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
235 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
236
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
237 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
238 update_to_reflect_account_status(PidginStatusBox *status_box, PurpleAccount *account, PurpleStatus *newstatus)
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
239 {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
240 GList *l;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
241 int status_no = -1;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
242 const PurpleStatusType *statustype = NULL;
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
243 const char *message;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
244
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
245 statustype = purple_status_type_find_with_id((GList *)purple_account_get_status_types(account),
34855
9c289149eed4 Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents: 34225
diff changeset
246 (char *)purple_status_type_get_id(purple_status_get_status_type(newstatus)));
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
247
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
248 for (l = purple_account_get_status_types(account); l != NULL; l = l->next) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
249 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
250
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
251 if (!purple_status_type_is_user_settable(status_type) ||
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
252 purple_status_type_is_independent(status_type))
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
253 continue;
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
254 status_no++;
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
255 if (statustype == status_type)
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
256 break;
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
257 }
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
258
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
259 #if 0
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
260 /* TODO WebKit: Doesn't do this? */
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
261 pidgin_webview_set_populate_primary_clipboard(
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
262 PIDGIN_WEBVIEW(status_box->webview), TRUE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
263 #endif
27032
991e2899be82 Avoid overwriting the PRIMARY clipboard when we select-on-focus the status text for easy editing. Fixes #8781.
Daniel Atallah <datallah@pidgin.im>
parents: 26887
diff changeset
264
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
265 if (status_no != -1) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
266 GtkTreePath *path;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
267 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
268 path = gtk_tree_path_new_from_indices(status_no, -1);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
269 if (status_box->active_row)
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
270 gtk_tree_row_reference_free(status_box->active_row);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
271 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
272 gtk_tree_path_free(path);
12286
08d994091c36 [gaim-migrate @ 14590]
Etan Reisner <deryni@pidgin.im>
parents: 12275
diff changeset
273
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
274 message = purple_status_get_attr_string(newstatus, "message");
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
275
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
276 if (!message || !*message)
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
277 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
278 gtk_widget_hide(status_box->vbox);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
279 status_box->webview_visible = FALSE;
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
280 }
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
281 else
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
282 {
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
283 gtk_widget_show_all(status_box->vbox);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
284 status_box->webview_visible = TRUE;
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
285 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(status_box->webview), message);
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
286 }
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
287 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
288 pidgin_status_box_refresh(status_box);
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
289 }
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
290 }
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
291
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
292 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
293 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus, PurpleStatus *newstatus, PidginStatusBox *status_box)
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
294 {
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
295 if (status_box->account == account)
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
296 update_to_reflect_account_status(status_box, account, newstatus);
14804
8c79ca123c25 [gaim-migrate @ 17499]
Daniel Atallah <datallah@pidgin.im>
parents: 14801
diff changeset
297 else if (status_box->token_status_account == account)
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
298 status_menu_refresh_iter(status_box, TRUE);
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
299 }
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
300
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
301 static gboolean
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
302 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
303 {
38705
62a7a975251a Use gdk_event_triggers_context_menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38433
diff changeset
304 if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
305 GtkWidget *menu_item;
28781
aa9d7de793fb Disable 'Remove' when no icon set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28752
diff changeset
306 const char *path;
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
307
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
308 if (box->icon_box_menu)
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
309 gtk_widget_destroy(box->icon_box_menu);
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
310
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
311 box->icon_box_menu = gtk_menu_new();
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
312
37879
38eebb7c9019 Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37619
diff changeset
313 pidgin_new_menu_item(box->icon_box_menu,
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
314 _("Select Buddy Icon"), GTK_STOCK_ADD,
37879
38eebb7c9019 Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37619
diff changeset
315 G_CALLBACK(choose_buddy_icon_cb), box);
38eebb7c9019 Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37619
diff changeset
316
38eebb7c9019 Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37619
diff changeset
317 menu_item = pidgin_new_menu_item(box->icon_box_menu, _("Remove"), GTK_STOCK_REMOVE,
38eebb7c9019 Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents: 37619
diff changeset
318 G_CALLBACK(remove_buddy_icon_cb), box);
28781
aa9d7de793fb Disable 'Remove' when no icon set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28752
diff changeset
319 if (!(path = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"))
aa9d7de793fb Disable 'Remove' when no icon set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28752
diff changeset
320 || !*path)
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
321 gtk_widget_set_sensitive(menu_item, FALSE);
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
322
38707
6f4d3ab2f2ed Use gtk_menu_popup_at_pointer instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38705
diff changeset
323 gtk_menu_popup_at_pointer(GTK_MENU(box->icon_box_menu), (GdkEvent *)event);
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
324
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
325 } else {
27117
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
326 choose_buddy_icon_cb(widget, box);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
327 }
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
328 return FALSE;
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
329 }
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
330
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
331 static void
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
332 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
333 GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box)
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
334 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
335 gchar *name = (gchar *) gtk_selection_data_get_data(sd);
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
336
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
337 if ((gtk_selection_data_get_length(sd) >= 0)
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
338 && (gtk_selection_data_get_format(sd) == 8)) {
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
339 /* Well, it looks like the drag event was cool.
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
340 * Let's do something with it */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
341 if (!g_ascii_strncasecmp(name, "file://", 7)) {
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
342 GError *converr = NULL;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
343 gchar *tmp, *rtmp;
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
344
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
345 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
346 purple_debug(PURPLE_DEBUG_ERROR, "buddyicon", "%s\n",
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
347 (converr ? converr->message :
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
348 "g_filename_from_uri error"));
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
349 return;
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
350 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
351 if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
352 *rtmp = '\0';
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
353 icon_choose_cb(tmp, box);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
354 g_free(tmp);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
355 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
356 gtk_drag_finish(dc, TRUE, FALSE, t);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
357 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
358 gtk_drag_finish(dc, FALSE, FALSE, t);
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
359 }
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
360
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
361 static gboolean
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
362 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
363 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
364 gdk_window_set_cursor(gtk_widget_get_window(widget), box->hand_cursor);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
365 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover);
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
366 return FALSE;
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
367 }
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
368
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
369 static gboolean
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
370 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
371 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
372 gdk_window_set_cursor(gtk_widget_get_window(widget), box->arrow_cursor);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
373 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ;
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
374 return FALSE;
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
375 }
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
376
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
377
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
378 static const GtkTargetEntry dnd_targets[] = {
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
379 {"text/plain", 0, 0},
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
380 {"text/uri-list", 0, 1},
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
381 {"STRING", 0, 2}
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
382 };
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
383
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
384 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
385 setup_icon_box(PidginStatusBox *status_box)
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
386 {
37997
7b62a2153898 Use gdk_cursor_new_for_display over gdk_cursor_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37996
diff changeset
387 GdkDisplay *display;
7b62a2153898 Use gdk_cursor_new_for_display over gdk_cursor_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37996
diff changeset
388
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
389 if (status_box->icon_box != NULL)
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
390 return;
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
391
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
392 status_box->icon = gtk_image_new();
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
393 status_box->icon_box = gtk_event_box_new();
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
394 gtk_widget_set_parent(status_box->icon_box, GTK_WIDGET(status_box));
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
395 gtk_widget_show(status_box->icon_box);
24508
dc1840d35fd7 gtk_widget_set_tooltip_text() is GTK+ >= 2.12
Daniel Atallah <datallah@pidgin.im>
parents: 24507
diff changeset
396
24434
618f36bdbfd0 Unbreak ABI.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24291
diff changeset
397 gtk_widget_set_tooltip_text(status_box->icon_box,
618f36bdbfd0 Unbreak ABI.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24291
diff changeset
398 status_box->account ? _("Click to change your buddyicon for this account.") :
618f36bdbfd0 Unbreak ABI.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24291
diff changeset
399 _("Click to change your buddyicon for all accounts."));
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
400
14216
ef4c360d75c9 [gaim-migrate @ 16799]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14215
diff changeset
401 if (status_box->account &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
402 !purple_account_get_bool(status_box->account, "use-global-buddyicon", TRUE))
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
403 {
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
404 PurpleImage *img = purple_buddy_icons_find_account_icon(status_box->account);
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
405 pidgin_status_box_set_buddy_icon(status_box, img);
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
406 g_object_unref(img);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
407 }
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
408 else
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
409 {
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
410 const char *filename = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon");
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
411 PurpleImage *img = NULL;
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
412
28087
9e95271a4276 statusbox: Avoid an assertion failure from ""
Paul Aurich <darkrain42@pidgin.im>
parents: 27365
diff changeset
413 if (filename && *filename)
38285
72824d3b7190 Update pidgin for the PurpleImage and PurpleSmiley changes
Gary Kramlich <grim@reaperworld.com>
parents: 38277
diff changeset
414 img = purple_image_new_from_file(filename, NULL);
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
415
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
416 pidgin_status_box_set_buddy_icon(status_box, img);
25745
48b7ebd7fcc7 Fix the crash/leaks in statusbox
Paul Aurich <darkrain42@pidgin.im>
parents: 24508
diff changeset
417 if (img)
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
418 g_object_unref(img);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
419 }
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
420
37997
7b62a2153898 Use gdk_cursor_new_for_display over gdk_cursor_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37996
diff changeset
421 display = gtk_widget_get_display(status_box->icon_box);
7b62a2153898 Use gdk_cursor_new_for_display over gdk_cursor_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37996
diff changeset
422 status_box->hand_cursor = gdk_cursor_new_for_display(display, GDK_HAND2);
7b62a2153898 Use gdk_cursor_new_for_display over gdk_cursor_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37996
diff changeset
423 status_box->arrow_cursor = gdk_cursor_new_for_display(display, GDK_LEFT_PTR);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
424
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
425 /* Set up DND */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
426 gtk_drag_dest_set(status_box->icon_box,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
427 GTK_DEST_DEFAULT_MOTION |
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
428 GTK_DEST_DEFAULT_DROP,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
429 dnd_targets,
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
430 sizeof(dnd_targets) / sizeof(GtkTargetEntry),
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
431 GDK_ACTION_COPY);
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
432
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14608
diff changeset
433 g_signal_connect(G_OBJECT(status_box->icon_box), "drag_data_received", G_CALLBACK(icon_box_dnd_cb), status_box);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
434 g_signal_connect(G_OBJECT(status_box->icon_box), "enter-notify-event", G_CALLBACK(icon_box_enter_cb), status_box);
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
435 g_signal_connect(G_OBJECT(status_box->icon_box), "leave-notify-event", G_CALLBACK(icon_box_leave_cb), status_box);
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
436 g_signal_connect(G_OBJECT(status_box->icon_box), "button-press-event", G_CALLBACK(icon_box_press_cb), status_box);
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
437
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
438 gtk_container_add(GTK_CONTAINER(status_box->icon_box), status_box->icon);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
439 gtk_widget_show(status_box->icon);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
440 }
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
441
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
442 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
443 destroy_icon_box(PidginStatusBox *statusbox)
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
444 {
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
445 if (statusbox->icon_box == NULL)
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
446 return;
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
447
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
448 gtk_widget_destroy(statusbox->icon_box);
35533
8ca83abbc248 Fix some crashes and bugs introduced by recent deprecation fixes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35532
diff changeset
449
35532
2c802bb77720 Fix most of warnings for gtk 3.4
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
450 g_object_unref(statusbox->hand_cursor);
2c802bb77720 Fix most of warnings for gtk 3.4
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35528
diff changeset
451 g_object_unref(statusbox->arrow_cursor);
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
452
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
453 if (statusbox->buddy_icon_img)
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
454 g_object_unref(statusbox->buddy_icon_img);
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
455
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
456 g_object_unref(G_OBJECT(statusbox->buddy_icon));
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
457 g_object_unref(G_OBJECT(statusbox->buddy_icon_hover));
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
458
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
459 if (statusbox->buddy_icon_sel)
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
460 gtk_widget_destroy(statusbox->buddy_icon_sel);
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
461
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
462 if (statusbox->icon_box_menu)
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
463 gtk_widget_destroy(statusbox->icon_box_menu);
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
464
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
465 statusbox->icon = NULL;
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
466 statusbox->icon_box = NULL;
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
467 statusbox->icon_box_menu = NULL;
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
468 statusbox->buddy_icon_img = NULL;
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
469 statusbox->buddy_icon = NULL;
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
470 statusbox->buddy_icon_hover = NULL;
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
471 statusbox->hand_cursor = NULL;
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
472 statusbox->arrow_cursor = NULL;
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
473 }
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
474
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
475 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
476 pidgin_status_box_set_property(GObject *object, guint param_id,
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
477 const GValue *value, GParamSpec *pspec)
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
478 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
479 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(object);
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
480
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
481 switch (param_id) {
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
482 case PROP_ICON_SEL:
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
483 if (g_value_get_boolean(value)) {
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
484 if (statusbox->account) {
36633
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
485 PurpleBuddyIconSpec *icon_spec = NULL;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
486 PurpleProtocol *protocol =
36626
18fc361b3704 Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents: 36607
diff changeset
487 purple_protocols_find(purple_account_get_protocol_id(statusbox->account));
36633
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
488 if (protocol)
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
489 icon_spec = purple_protocol_get_icon_spec(protocol);
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
490 if (icon_spec && icon_spec->format != NULL)
36424
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
491 setup_icon_box(statusbox);
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
492 } else {
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
493 setup_icon_box(statusbox);
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
494 }
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
495 } else {
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
496 destroy_icon_box(statusbox);
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
497 }
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
498 break;
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
499 case PROP_ACCOUNT:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
500 statusbox->account = g_value_get_pointer(value);
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
501 if (statusbox->account)
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
502 statusbox->token_status_account = NULL;
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
503 else
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
504 statusbox->token_status_account = check_active_accounts_for_identical_statuses();
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
505
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
506 pidgin_status_box_regenerate(statusbox, TRUE);
12256
2ad29826207a [gaim-migrate @ 14558]
Sean Egan <seanegan@pidgin.im>
parents: 12244
diff changeset
507
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
508 break;
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
509 default:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
510 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
511 break;
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
512 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
513 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
514
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
515 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
516 pidgin_status_box_finalize(GObject *obj)
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
517 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
518 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(obj);
36256
a437550a9308 Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35998
diff changeset
519 gsize i;
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
520
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
521 purple_signals_disconnect_by_handle(statusbox);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
522 purple_prefs_disconnect_by_handle(statusbox);
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
523
22216
c4b8738c471c Destroy the icon box only when there's one. This gets rid of a runtime warning for statusboxes without a buddy-icon selector (e.g., for an IRC account).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22214
diff changeset
524 destroy_icon_box(statusbox);
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
525
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
526 if (statusbox->active_row)
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
527 gtk_tree_row_reference_free(statusbox->active_row);
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
528
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
529 for (i = 0; i < G_N_ELEMENTS(statusbox->connecting_pixbufs); i++) {
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
530 if (statusbox->connecting_pixbufs[i] != NULL)
26820
76f90ca8f6f2 Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26753
diff changeset
531 g_object_unref(G_OBJECT(statusbox->connecting_pixbufs[i]));
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
532 }
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
533
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
534 for (i = 0; i < G_N_ELEMENTS(statusbox->typing_pixbufs); i++) {
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
535 if (statusbox->typing_pixbufs[i] != NULL)
26820
76f90ca8f6f2 Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26753
diff changeset
536 g_object_unref(G_OBJECT(statusbox->typing_pixbufs[i]));
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
537 }
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
538
22214
e8a9916cb99e It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
539 g_object_unref(G_OBJECT(statusbox->store));
e8a9916cb99e It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
540 g_object_unref(G_OBJECT(statusbox->dropdown_store));
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
541 G_OBJECT_CLASS(parent_class)->finalize(obj);
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
542 }
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
543
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
544 static GType
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
545 pidgin_status_box_child_type (GtkContainer *container)
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
546 {
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
547 return GTK_TYPE_WIDGET;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
548 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
549
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
550 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
551 pidgin_status_box_class_init (PidginStatusBoxClass *klass)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
552 {
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
553 GObjectClass *object_class;
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
554 GtkWidgetClass *widget_class;
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
555 GtkContainerClass *container_class = (GtkContainerClass*)klass;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
556
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
557 parent_class = g_type_class_peek_parent(klass);
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
558
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
559 widget_class = (GtkWidgetClass*)klass;
32404
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
560 widget_class->get_preferred_height = pidgin_status_box_get_preferred_height;
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33162
diff changeset
561 widget_class->draw = pidgin_status_box_draw;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
562 widget_class->size_allocate = pidgin_status_box_size_allocate;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
563
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
564 container_class->child_type = pidgin_status_box_child_type;
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
565 container_class->forall = pidgin_status_box_forall;
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
566 container_class->remove = NULL;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
567
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
568 object_class = (GObjectClass *)klass;
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
569
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
570 object_class->finalize = pidgin_status_box_finalize;
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
571
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
572 object_class->get_property = pidgin_status_box_get_property;
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
573 object_class->set_property = pidgin_status_box_set_property;
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
574
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
575 g_object_class_install_property(object_class,
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
576 PROP_ACCOUNT,
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
577 g_param_spec_pointer("account",
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
578 "Account",
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
579 "The account, or NULL for all accounts",
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34940
diff changeset
580 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
581 )
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
582 );
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
583 g_object_class_install_property(object_class,
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
584 PROP_ICON_SEL,
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
585 g_param_spec_boolean("iconsel",
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
586 "Icon Selector",
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
587 "Whether the icon selector should be displayed or not.",
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
588 FALSE,
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34940
diff changeset
589 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
590 )
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
591 );
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
592 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
593
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
594 /*
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
595 * This updates the text displayed on the status box so that it shows
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
596 * the current status. This is the only function in this file that
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
597 * should modify status_box->store
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
598 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
599 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
600 pidgin_status_box_refresh(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
601 {
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
602 const char *aa_color;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
603 PurpleSavedStatus *saved_status;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
604 char *primary, *secondary, *text;
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
605 const char *stock = NULL;
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
606 GdkPixbuf *emblem = NULL;
10702
55a43c79fd6f [gaim-migrate @ 12284]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10672
diff changeset
607 GtkTreePath *path;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
608 gboolean account_status = FALSE;
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
609 PurpleAccount *acct = (status_box->account) ? status_box->account : status_box->token_status_account;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
610
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
611 saved_status = purple_savedstatus_get_current();
13122
85136c011157 [gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents: 13112
diff changeset
612
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
613 if (status_box->account || (status_box->token_status_account
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
614 && purple_savedstatus_is_transient(saved_status)))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
615 account_status = TRUE;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
616
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
617 /* Primary */
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
618 if (status_box->typing != 0)
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
619 {
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
620 GtkTreeIter iter;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
621 PidginStatusBoxItemType type;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
622 gpointer data;
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
623
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
624 /* Primary (get the status selected in the dropdown) */
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
625 path = gtk_tree_row_reference_get_path(status_box->active_row);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
626 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
627 return;
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
628 gtk_tree_path_free(path);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
629
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
630 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
631 TYPE_COLUMN, &type,
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
632 DATA_COLUMN, &data,
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
633 -1);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
634 if (type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
635 primary = g_strdup(purple_primitive_get_name_from_type(GPOINTER_TO_INT(data)));
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
636 else
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
637 /* This should never happen, but just in case... */
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
638 primary = g_strdup("New status");
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
639 }
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
640 else if (account_status)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
641 primary = g_strdup(purple_status_get_name(purple_account_get_active_status(acct)));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
642 else if (purple_savedstatus_is_transient(saved_status))
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
643 primary = g_strdup(purple_primitive_get_name_from_type(purple_savedstatus_get_primitive_type(saved_status)));
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
644 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
645 primary = g_markup_escape_text(purple_savedstatus_get_title(saved_status), -1);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
646
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
647 /* Secondary */
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
648 if (status_box->typing != 0)
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
649 secondary = g_strdup(_("Typing"));
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
650 else if (status_box->connecting)
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
651 secondary = g_strdup(_("Connecting"));
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
652 else if (!status_box->network_available)
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
653 secondary = g_strdup(_("Waiting for network connection"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
654 else if (purple_savedstatus_is_transient(saved_status))
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
655 secondary = NULL;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
656 else
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
657 {
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
658 const char *message;
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
659 char *tmp;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
660 message = purple_savedstatus_get_message(saved_status);
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
661 if (message != NULL)
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
662 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
663 tmp = purple_markup_strip_html(message);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
664 purple_util_chrreplace(tmp, '\n', ' ');
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
665 secondary = g_markup_escape_text(tmp, -1);
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
666 g_free(tmp);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
667 }
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
668 else
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
669 secondary = NULL;
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
670 }
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
671
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
672 /* Pixbuf */
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
673 if (status_box->typing != 0)
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
674 stock = typing_stock_ids[status_box->typing_index];
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
675 else if (status_box->connecting)
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
676 stock = connecting_stock_ids[status_box->connecting_index];
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
677 else
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
678 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
679 PurpleStatusType *status_type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
680 PurpleStatusPrimitive prim;
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
681 if (account_status) {
34855
9c289149eed4 Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents: 34225
diff changeset
682 status_type = purple_status_get_status_type(purple_account_get_active_status(acct));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
683 prim = purple_status_type_get_primitive(status_type);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
684 } else {
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
685 prim = purple_savedstatus_get_primitive_type(saved_status);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
686 }
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
687
26846
d5546da39e44 Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26845
diff changeset
688 stock = pidgin_stock_id_from_status_primitive(prim);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
689 }
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
690
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
691 aa_color = pidgin_get_dim_grey_string(GTK_WIDGET(status_box));
13122
85136c011157 [gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents: 13112
diff changeset
692 if (status_box->account != NULL) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
693 text = g_strdup_printf("%s - <span size=\"smaller\" color=\"%s\">%s</span>",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
694 purple_account_get_username(status_box->account),
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
695 aa_color, secondary ? secondary : primary);
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
696 emblem = pidgin_create_protocol_icon(status_box->account, PIDGIN_PROTOCOL_ICON_SMALL);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
697 } else if (secondary != NULL) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
698 text = g_strdup_printf("%s<span size=\"smaller\" color=\"%s\"> - %s</span>",
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
699 primary, aa_color, secondary);
12228
448ba4f01ac6 [gaim-migrate @ 14530]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12221
diff changeset
700 } else {
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
701 text = g_strdup(primary);
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
702 }
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
703 g_free(primary);
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
704 g_free(secondary);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
705
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
706 /*
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
707 * Only two columns are used in this list store (does it
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
708 * really need to be a list store?)
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
709 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
710 gtk_list_store_set(status_box->store, &(status_box->iter),
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
711 ICON_STOCK_COLUMN, (gpointer)stock,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
712 TEXT_COLUMN, text,
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
713 EMBLEM_COLUMN, emblem,
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
714 EMBLEM_VISIBLE_COLUMN, (emblem != NULL),
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
715 -1);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
716 g_free(text);
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
717 if (emblem)
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
718 g_object_unref(emblem);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
719
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
720 /* Make sure to activate the only row in the tree view */
10702
55a43c79fd6f [gaim-migrate @ 12284]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10672
diff changeset
721 path = gtk_tree_path_new_from_string("0");
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
722 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path);
10702
55a43c79fd6f [gaim-migrate @ 12284]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10672
diff changeset
723 gtk_tree_path_free(path);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
724
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
725 update_size(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
726 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
727
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
728 static PurpleStatusType *
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
729 find_status_type_by_index(const PurpleAccount *account, gint active)
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
730 {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
731 GList *l = purple_account_get_status_types(account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
732 gint i;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
733
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
734 for (i = 0; l; l = l->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
735 PurpleStatusType *status_type = l->data;
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
736 if (!purple_status_type_is_user_settable(status_type) ||
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
737 purple_status_type_is_independent(status_type))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
738 continue;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
739
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
740 if (active == i)
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
741 return status_type;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
742 i++;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
743 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
744
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
745 return NULL;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
746 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
747
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
748 /*
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
749 * This updates the GtkTreeView so that it correctly shows the state
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
750 * we are currently using. It is used when the current state is
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
751 * updated from somewhere other than the GtkStatusBox (from a plugin,
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
752 * or when signing on with the "-n" option, for example). It is
13025
824f4aef4e33 [gaim-migrate @ 15378]
Mark Doliner <markdoliner@pidgin.im>
parents: 13023
diff changeset
753 * also used when the user selects the "New..." option.
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
754 *
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
755 * Maybe we could accomplish this by triggering off the mouse and
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
756 * keyboard signals instead of the changed signal?
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
757 */
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
758 static void
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
759 status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed)
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
760 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
761 PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
762 PurpleStatusPrimitive primitive;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
763 gint index;
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
764 const char *message;
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
765 GtkTreePath *path = NULL;
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
766
11983
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
767 /* this function is inappropriate for ones with accounts */
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
768 if (status_box->account)
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
769 return;
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
770
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
771 saved_status = purple_savedstatus_get_current();
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
772
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
773 /*
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
774 * Suppress the "changed" signal because the status
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
775 * was changed programmatically.
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
776 */
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
777 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
778
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
779 /*
14801
6554d4d17db8 [gaim-migrate @ 17495]
Etan Reisner <deryni@pidgin.im>
parents: 14767
diff changeset
780 * If there is a token-account, then select the primitive from the
6554d4d17db8 [gaim-migrate @ 17495]
Etan Reisner <deryni@pidgin.im>
parents: 14767
diff changeset
781 * dropdown using a loop. Otherwise select from the default list.
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
782 */
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
783 primitive = purple_savedstatus_get_primitive_type(saved_status);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
784 if (!status_box->token_status_account && purple_savedstatus_is_transient(saved_status) &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
785 ((primitive == PURPLE_STATUS_AVAILABLE) || (primitive == PURPLE_STATUS_AWAY) ||
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
786 (primitive == PURPLE_STATUS_INVISIBLE) || (primitive == PURPLE_STATUS_OFFLINE) ||
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
787 (primitive == PURPLE_STATUS_UNAVAILABLE)) &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
788 (!purple_savedstatus_has_substatuses(saved_status)))
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
789 {
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
790 index = get_statusbox_index(status_box, saved_status);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
791 path = gtk_tree_path_new_from_indices(index, -1);
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
792 }
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
793 else
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
794 {
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
795 GtkTreeIter iter;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
796 PidginStatusBoxItemType type;
13112
d2c4ff0321e1 [gaim-migrate @ 15473]
Mark Doliner <markdoliner@pidgin.im>
parents: 13099
diff changeset
797 gpointer data;
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
798
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
799 /* If this saved status is in the list store, then set it as the active item */
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
800 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter))
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
801 {
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
802 do
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
803 {
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
804 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
13112
d2c4ff0321e1 [gaim-migrate @ 15473]
Mark Doliner <markdoliner@pidgin.im>
parents: 13099
diff changeset
805 TYPE_COLUMN, &type,
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
806 DATA_COLUMN, &data,
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
807 -1);
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
808
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
809 /* This is a special case because Primitives for the token_status_account are actually
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
810 * saved statuses with substatuses for the enabled accounts */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
811 if (status_box->token_status_account && purple_savedstatus_is_transient(saved_status)
36256
a437550a9308 Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35998
diff changeset
812 && type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE && primitive == (PurpleStatusPrimitive)GPOINTER_TO_INT(data))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
813 {
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
814 char *name;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
815 const char *acct_status_name = purple_status_get_name(
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
816 purple_account_get_active_status(status_box->token_status_account));
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
817
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
818 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
819 TEXT_COLUMN, &name, -1);
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
820
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
821 if (!purple_savedstatus_has_substatuses(saved_status)
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
822 || purple_strequal(name, acct_status_name))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
823 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
824 /* Found! */
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
825 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter);
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
826 g_free(name);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
827 break;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
828 }
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
829 g_free(name);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
830
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
831 } else if ((type == PIDGIN_STATUS_BOX_TYPE_POPULAR) &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
832 (GPOINTER_TO_INT(data) == purple_savedstatus_get_creation_time(saved_status)))
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
833 {
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
834 /* Found! */
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
835 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter);
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
836 break;
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
837 }
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
838 } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter));
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
839 }
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
840 }
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
841
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
842 if (status_box->active_row)
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
843 gtk_tree_row_reference_free(status_box->active_row);
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
844 if (path) { /* path should never be NULL */
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
845 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path);
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
846 gtk_tree_path_free(path);
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
847 } else
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
848 status_box->active_row = NULL;
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
849
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
850 if (status_changed) {
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
851 message = purple_savedstatus_get_message(saved_status);
28752
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
852
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
853 /*
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
854 * If we are going to hide the webview, don't retain the
28752
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
855 * message because showing the old message later is
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
856 * confusing. If we are going to set the message to a pre-set,
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
857 * then we need to do this anyway
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
858 *
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
859 * Suppress the "changed" signal because the status
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
860 * was changed programmatically.
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
861 */
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
862 gtk_widget_set_sensitive(GTK_WIDGET(status_box->webview), FALSE);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
863
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
864 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(status_box->webview), "");
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
865 pidgin_webview_clear_formatting(PIDGIN_WEBVIEW(status_box->webview));
28752
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
866
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
867 if (!purple_savedstatus_is_transient(saved_status) || !message || !*message)
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
868 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
869 status_box->webview_visible = FALSE;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
870 gtk_widget_hide(status_box->vbox);
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
871 }
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
872 else
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
873 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
874 status_box->webview_visible = TRUE;
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
875 gtk_widget_show_all(status_box->vbox);
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
876
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
877 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(status_box->webview), message);
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
878 }
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
879
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
880 gtk_widget_set_sensitive(GTK_WIDGET(status_box->webview), TRUE);
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
881 update_size(status_box);
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
882 }
12634
943954b63b48 [gaim-migrate @ 14970]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12619
diff changeset
883
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
884 /* Stop suppressing the "changed" signal. */
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
885 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
886 }
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
887
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
888 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
889 add_popular_statuses(PidginStatusBox *statusbox)
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
890 {
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
891 GList *list, *cur;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
892
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
893 list = purple_savedstatuses_get_popular(6);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
894 if (list == NULL)
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
895 /* Odd... oh well, nothing we can do about it. */
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
896 return;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
897
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
898 pidgin_status_box_add_separator(statusbox);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
899
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
900 for (cur = list; cur != NULL; cur = cur->next)
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
901 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
902 PurpleSavedStatus *saved = cur->data;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
903 const gchar *message;
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
904 gchar *stripped = NULL;
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
905 PidginStatusBoxItemType type;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
906
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
907 if (purple_savedstatus_is_transient(saved))
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
908 {
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
909 /*
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
910 * Transient statuses do not have a title, so the savedstatus
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
911 * API returns the message when purple_savedstatus_get_title() is
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
912 * called, so we don't need to get the message a second time.
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
913 */
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
914 type = PIDGIN_STATUS_BOX_TYPE_POPULAR;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
915 }
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
916 else
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
917 {
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
918 type = PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR;
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
919
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
920 message = purple_savedstatus_get_message(saved);
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
921 if (message != NULL)
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
922 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
923 stripped = purple_markup_strip_html(message);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
924 purple_util_chrreplace(stripped, '\n', ' ');
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
925 }
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
926 }
13091
b5ed878998dd [gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents: 13080
diff changeset
927
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
928 pidgin_status_box_add(statusbox, type,
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
929 NULL, purple_savedstatus_get_title(saved), stripped,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
930 GINT_TO_POINTER(purple_savedstatus_get_creation_time(saved)));
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
931 g_free(stripped);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
932 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
933
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
934 g_list_free(list);
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
935 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
936
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
937 /* This returns NULL if the active accounts don't have identical
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
938 * statuses and a token account if they do */
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22086
diff changeset
939 static PurpleAccount* check_active_accounts_for_identical_statuses(void)
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
940 {
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
941 GList *iter, *active_accts = purple_accounts_get_all_active();
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
942 PurpleAccount *acct1 = NULL;
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
943 const char *proto1 = NULL;
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
944
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
945 if (active_accts) {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
946 acct1 = active_accts->data;
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
947 proto1 = purple_account_get_protocol_id(acct1);
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
948 } else {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
949 /* there's no enabled account */
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
950 return NULL;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
951 }
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
952
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
953 /* start at the second account */
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
954 for (iter = active_accts->next; iter; iter = iter->next) {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
955 PurpleAccount *acct2 = iter->data;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
956 GList *s1, *s2;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
957
38358
30ba44276e74 Merge release-2.x.y into default
dx <dx@dxzone.com.ar>
parents: 38298 38259
diff changeset
958 if (!purple_strequal(proto1, purple_account_get_protocol_id(acct2))) {
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
959 acct1 = NULL;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
960 break;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
961 }
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
962
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
963 for (s1 = purple_account_get_status_types(acct1),
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
964 s2 = purple_account_get_status_types(acct2); s1 && s2;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
965 s1 = s1->next, s2 = s2->next) {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
966 PurpleStatusType *st1 = s1->data, *st2 = s2->data;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
967 /* TODO: Are these enough to consider the statuses identical? */
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
968 if (purple_status_type_get_primitive(st1) != purple_status_type_get_primitive(st2)
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
969 || !purple_strequal(purple_status_type_get_id(st1), purple_status_type_get_id(st2))
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
970 || !purple_strequal(purple_status_type_get_name(st1), purple_status_type_get_name(st2))) {
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
971 acct1 = NULL;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
972 break;
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
973 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
974 }
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
975
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
976 if (s1 != s2) {/* Will both be NULL if matched */
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
977 acct1 = NULL;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
978 break;
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
979 }
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
980 }
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
981
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
982 g_list_free(active_accts);
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
983
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
984 return acct1;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
985 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
986
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
987 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
988 add_account_statuses(PidginStatusBox *status_box, PurpleAccount *account)
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
989 {
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
990 /* Per-account */
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
991 GList *l;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
992
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
993 for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
994 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
995 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
996 PurpleStatusPrimitive prim;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
997
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
998 if (!purple_status_type_is_user_settable(status_type) ||
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
999 purple_status_type_is_independent(status_type))
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1000 continue;
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1001
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
1002 prim = purple_status_type_get_primitive(status_type);
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
1003
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1004 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box),
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1005 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1006 purple_status_type_get_name(status_type),
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1007 NULL,
30706
612b36b49058 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29689
diff changeset
1008 GINT_TO_POINTER(prim));
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1009 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1010 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1011
18319
e5f4aef72165 disapproval of revision '146d6831fc3d1fdf025c5ae60bc4976eaed5c987'
Sean Egan <seanegan@pidgin.im>
parents: 18318
diff changeset
1012 static void
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1013 pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed)
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
1014 {
12256
2ad29826207a [gaim-migrate @ 14558]
Sean Egan <seanegan@pidgin.im>
parents: 12244
diff changeset
1015 /* Unset the model while clearing it */
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1016 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), NULL);
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
1017 gtk_list_store_clear(status_box->dropdown_store);
13242
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
1018 /* Don't set the model until the new statuses have been added to the box.
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
1019 * What is presumably a bug in Gtk < 2.4 causes things to get all confused
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
1020 * if we do this here. */
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
1021 /* gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); */
12286
08d994091c36 [gaim-migrate @ 14590]
Etan Reisner <deryni@pidgin.im>
parents: 12275
diff changeset
1022
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1023 if (status_box->account == NULL)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1024 {
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1025 /* Do all the currently enabled accounts have the same statuses?
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1026 * If so, display them instead of our global list.
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1027 */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1028 if (status_box->token_status_account) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1029 add_account_statuses(status_box, status_box->token_status_account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1030 } else {
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1031 /* Global */
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1032 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL, _("Available"), NULL, GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE));
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1033 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL, _("Away"), NULL, GINT_TO_POINTER(PURPLE_STATUS_AWAY));
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1034 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL, _("Do not disturb"), NULL, GINT_TO_POINTER(PURPLE_STATUS_UNAVAILABLE));
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1035 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL, _("Invisible"), NULL, GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE));
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1036 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL, _("Offline"), NULL, GINT_TO_POINTER(PURPLE_STATUS_OFFLINE));
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1037 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1038
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1039 add_popular_statuses(status_box);
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1040
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1041 pidgin_status_box_add_separator(PIDGIN_STATUS_BOX(status_box));
20293
81d324f460bd applied changes from 1f57ebe4e6d16159c74db823ecff2ec0f4c46936
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20289
diff changeset
1042 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, NULL, _("New status..."), NULL, NULL);
81d324f460bd applied changes from 1f57ebe4e6d16159c74db823ecff2ec0f4c46936
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20289
diff changeset
1043 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, NULL, _("Saved statuses..."), NULL, NULL);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1044
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1045 status_menu_refresh_iter(status_box, status_changed);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1046 pidgin_status_box_refresh(status_box);
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
1047
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
1048 } else {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1049 add_account_statuses(status_box, status_box->account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1050 update_to_reflect_account_status(status_box, status_box->account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1051 purple_account_get_active_status(status_box->account));
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
1052 }
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1053 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), GTK_TREE_MODEL(status_box->dropdown_store));
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1054 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN);
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
1055 }
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
1056
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1057 static gboolean
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1058 combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, PidginWebView *webview)
12827
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
1059 {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1060 pidgin_status_box_popup(PIDGIN_STATUS_BOX(w), (GdkEvent *)event);
12827
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
1061 return TRUE;
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
1062 }
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
1063
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1064 static gboolean
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1065 webview_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, PidginWebView *webview)
12075
6e9784c94721 [gaim-migrate @ 14372]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12074
diff changeset
1066 {
6e9784c94721 [gaim-migrate @ 14372]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12074
diff changeset
1067 if (event->direction == GDK_SCROLL_UP)
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1068 pidgin_webview_page_up(webview);
12075
6e9784c94721 [gaim-migrate @ 14372]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12074
diff changeset
1069 else if (event->direction == GDK_SCROLL_DOWN)
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1070 pidgin_webview_page_down(webview);
12075
6e9784c94721 [gaim-migrate @ 14372]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12074
diff changeset
1071 return TRUE;
6e9784c94721 [gaim-migrate @ 14372]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12074
diff changeset
1072 }
6e9784c94721 [gaim-migrate @ 14372]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12074
diff changeset
1073
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1074 static gboolean
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1075 webview_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box)
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1076 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1077 if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) {
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1078 remove_typing_cb(status_box);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1079 return TRUE;
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1080 }
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1081 else if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_KP_Tab || event->keyval == GDK_KEY_ISO_Left_Tab)
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1082 {
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1083 /* If last inserted character is a tab, then remove the focus from here */
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1084 GtkWidget *top = gtk_widget_get_toplevel(w);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1085 g_signal_emit_by_name(G_OBJECT(top), "move-focus",
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1086 (event->state & GDK_SHIFT_MASK) ?
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1087 GTK_DIR_TAB_BACKWARD: GTK_DIR_TAB_FORWARD);
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1088 return TRUE;
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1089 }
22882
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1090 if (status_box->typing == 0)
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1091 return FALSE;
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
1092
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
1093 /* Reset the status if Escape was pressed */
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1094 if (event->keyval == GDK_KEY_Escape)
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
1095 {
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
1096 g_source_remove(status_box->typing);
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
1097 status_box->typing = 0;
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1098 #if 0
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1099 /* TODO WebKit: Doesn't do this? */
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1100 pidgin_webview_set_populate_primary_clipboard(
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1101 PIDGIN_WEBVIEW(status_box->webview), TRUE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1102 #endif
13832
2719e29e6e9e [gaim-migrate @ 16279]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13805
diff changeset
1103 if (status_box->account != NULL)
2719e29e6e9e [gaim-migrate @ 16279]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13805
diff changeset
1104 update_to_reflect_account_status(status_box, status_box->account,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1105 purple_account_get_active_status(status_box->account));
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1106 else {
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1107 status_menu_refresh_iter(status_box, TRUE);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1108 pidgin_status_box_refresh(status_box);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1109 }
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
1110 return TRUE;
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
1111 }
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13832
diff changeset
1112
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1113 pidgin_status_box_pulse_typing(status_box);
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
1114 g_source_remove(status_box->typing);
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
1115 status_box->typing = g_timeout_add_seconds(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box);
12460
12066438d0c2 [gaim-migrate @ 14770]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12379
diff changeset
1116
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1117 return FALSE;
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1118 }
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1119
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1120 static gboolean
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1121 dropdown_store_row_separator_func(GtkTreeModel *model,
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1122 GtkTreeIter *iter, gpointer data)
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1123 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1124 PidginStatusBoxItemType type;
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1125
11885
0c447c0ced93 [gaim-migrate @ 14176]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11870
diff changeset
1126 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1);
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1127
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1128 if (type == PIDGIN_STATUS_BOX_TYPE_SEPARATOR)
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1129 return TRUE;
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1130
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1131 return FALSE;
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1132 }
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1133
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1134 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1135 cache_pixbufs(PidginStatusBox *status_box)
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1136 {
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1137 GtkIconSize icon_size;
36256
a437550a9308 Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35998
diff changeset
1138 gsize i;
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1139
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1140 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL);
15497
92f02f4bd5ee Dialog icon changes
Sean Egan <seanegan@pidgin.im>
parents: 15474
diff changeset
1141 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1142
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
1143 for (i = 0; i < G_N_ELEMENTS(status_box->connecting_pixbufs); i++) {
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
1144 if (status_box->connecting_pixbufs[i] != NULL)
26828
ca76e7ad0d4b Oops, I must have been tired. I only replaced the first occurrence of these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26820
diff changeset
1145 g_object_unref(G_OBJECT(status_box->connecting_pixbufs[i]));
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1146 if (connecting_stock_ids[i])
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1147 status_box->connecting_pixbufs[i] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox),
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1148 connecting_stock_ids[i], icon_size, "PidginStatusBox");
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1149 else
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1150 status_box->connecting_pixbufs[i] = NULL;
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
1151 }
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1152 status_box->connecting_index = 0;
24434
618f36bdbfd0 Unbreak ABI.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24291
diff changeset
1153
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1154
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
1155 for (i = 0; i < G_N_ELEMENTS(status_box->typing_pixbufs); i++) {
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
1156 if (status_box->typing_pixbufs[i] != NULL)
26828
ca76e7ad0d4b Oops, I must have been tired. I only replaced the first occurrence of these
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26820
diff changeset
1157 g_object_unref(G_OBJECT(status_box->typing_pixbufs[i]));
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1158 if (typing_stock_ids[i])
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1159 status_box->typing_pixbufs[i] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox),
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1160 typing_stock_ids[i], icon_size, "PidginStatusBox");
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1161 else
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1162 status_box->typing_pixbufs[i] = NULL;
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
1163 }
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1164 status_box->typing_index = 0;
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1165 }
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1166
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
1167 static void account_enabled_cb(PurpleAccount *acct, PidginStatusBox *status_box)
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
1168 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1169 PurpleAccount *initial_token_acct = status_box->token_status_account;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1170
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
1171 if (status_box->account)
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
1172 return;
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
1173
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1174 status_box->token_status_account = check_active_accounts_for_identical_statuses();
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1175
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1176 /* Regenerate the list if it has changed */
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1177 if (initial_token_acct != status_box->token_status_account) {
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1178 pidgin_status_box_regenerate(status_box, TRUE);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1179 }
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1180
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1181 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
1182
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1183 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1184 current_savedstatus_changed_cb(PurpleSavedStatus *now, PurpleSavedStatus *old, PidginStatusBox *status_box)
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1185 {
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1186 /* Make sure our current status is added to the list of popular statuses */
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1187 pidgin_status_box_regenerate(status_box, TRUE);
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1188 }
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1189
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1190 static void
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1191 saved_status_updated_cb(PurpleSavedStatus *status, PidginStatusBox *status_box)
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1192 {
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1193 pidgin_status_box_regenerate(status_box,
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1194 purple_savedstatus_get_current() == status);
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1195 }
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1196
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1197 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1198 spellcheck_prefs_cb(const char *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12782
diff changeset
1199 gconstpointer value, gpointer data)
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
1200 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1201 PidginStatusBox *status_box = (PidginStatusBox *)data;
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
1202
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1203 pidgin_webview_set_spellcheck(PIDGIN_WEBVIEW(status_box->webview),
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1204 (gboolean)GPOINTER_TO_INT(value));
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
1205 }
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
1206
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1207 #if 0
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1208 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1209 {
12286
08d994091c36 [gaim-migrate @ 14590]
Etan Reisner <deryni@pidgin.im>
parents: 12275
diff changeset
1210
38712
ea49cd76cf47 Use GDK button constants instead of magic numbers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38707
diff changeset
1211 if (event->button != GDK_BUTTOM_PRIMARY)
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1212 return FALSE;
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1213 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1214 if (!box->webview_visible)
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1215 g_signal_emit_by_name(G_OBJECT(box), "changed", NULL, NULL);
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1216 return TRUE;
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1217 }
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1218
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1219 static gboolean button_pressed_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1220 {
38712
ea49cd76cf47 Use GDK button constants instead of magic numbers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38707
diff changeset
1221 if (event->button != GDK_BUTTOM_PRIMARY)
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1222 return FALSE;
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1223 gtk_combo_box_popup(GTK_COMBO_BOX(box));
16413
7fae6f309bd7 Death to // comments.
Richard Laager <rlaager@pidgin.im>
parents: 16402
diff changeset
1224 /* Disabled until button_released_cb works */
7fae6f309bd7 Death to // comments.
Richard Laager <rlaager@pidgin.im>
parents: 16402
diff changeset
1225 #if 0
7fae6f309bd7 Death to // comments.
Richard Laager <rlaager@pidgin.im>
parents: 16402
diff changeset
1226 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), TRUE);
7fae6f309bd7 Death to // comments.
Richard Laager <rlaager@pidgin.im>
parents: 16402
diff changeset
1227 #endif
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1228 return TRUE;
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1229 }
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1230 #endif
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1231
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1232 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1233 pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, int *width, int *height)
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1234 {
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1235 GdkScreen *screen;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1236 gint monitor_num;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1237 GdkRectangle monitor;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1238 GtkRequisition popup_req;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1239 GtkPolicyType hpolicy, vpolicy;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1240 GtkAllocation allocation;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1241
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1242 gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1243 gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(status_box)), x, y);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1244
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1245 *x += allocation.x;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1246 *y += allocation.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1247
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1248 *width = allocation.width;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1249
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1250 hpolicy = vpolicy = GTK_POLICY_NEVER;
31321
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 30707
diff changeset
1251 g_object_set(G_OBJECT(status_box->scrolled_window),
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1252 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1253 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1254 NULL);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
1255 gtk_widget_get_preferred_size(status_box->popup_frame, NULL, &popup_req);
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1256
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1257 if (popup_req.width > *width) {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1258 hpolicy = GTK_POLICY_ALWAYS;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1259 g_object_set(G_OBJECT(status_box->scrolled_window),
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1260 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1261 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1262 NULL);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
1263 gtk_widget_get_preferred_size(status_box->popup_frame, NULL, &popup_req);
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1264 }
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1265
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1266 *height = popup_req.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1267
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1268 screen = gtk_widget_get_screen(GTK_WIDGET(status_box));
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1269 monitor_num = gdk_screen_get_monitor_at_window(screen,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1270 gtk_widget_get_window(GTK_WIDGET(status_box)));
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1271 gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1272
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1273 if (*x < monitor.x)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1274 *x = monitor.x;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1275 else if (*x + *width > monitor.x + monitor.width)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1276 *x = monitor.x + monitor.width - *width;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1277
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1278 if (*y + allocation.height + *height <= monitor.y + monitor.height)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1279 *y += allocation.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1280 else if (*y - *height >= monitor.y)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1281 *y -= *height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1282 else if (monitor.y + monitor.height - (*y + allocation.height) > *y - monitor.y)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1283 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1284 *y += allocation.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1285 *height = monitor.y + monitor.height - *y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1286 }
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1287 else
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1288 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1289 *height = *y - monitor.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1290 *y = monitor.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1291 }
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1292
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1293 if (popup_req.height > *height)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1294 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1295 vpolicy = GTK_POLICY_ALWAYS;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1296
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1297 g_object_set(G_OBJECT(status_box->scrolled_window),
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1298 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1299 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1300 NULL);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1301 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1302 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1303
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1304 static gboolean
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1305 popup_grab_on_window(GdkWindow *window, GdkEvent *event)
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1306 {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1307 guint32 activate_time = gdk_event_get_time(event);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1308 GdkDevice *device = gdk_event_get_device(event);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1309 GdkGrabStatus status;
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1310
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1311 status = gdk_device_grab(device, window, GDK_OWNERSHIP_WINDOW, TRUE,
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1312 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1313 GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK |
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1314 GDK_KEY_RELEASE_MASK, NULL, activate_time);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1315 if (status == GDK_GRAB_SUCCESS) {
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1316 status = gdk_device_grab(gdk_device_get_associated_device(device),
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1317 window, GDK_OWNERSHIP_WINDOW, TRUE,
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1318 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1319 GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK |
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1320 GDK_KEY_RELEASE_MASK, NULL, activate_time);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1321 if (status == GDK_GRAB_SUCCESS)
29496
8807ee3e55c5 Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28087
diff changeset
1322 return TRUE;
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1323 else
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1324 gdk_device_ungrab(device, activate_time);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1325 }
29496
8807ee3e55c5 Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28087
diff changeset
1326
8807ee3e55c5 Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28087
diff changeset
1327 return FALSE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1328 }
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1329
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1330
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1331 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1332 pidgin_status_box_popup(PidginStatusBox *box, GdkEvent *event)
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1333 {
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1334 int width, height, x, y;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1335 pidgin_status_box_list_position (box, &x, &y, &width, &height);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1336
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1337 gtk_widget_set_size_request (box->popup_window, width, height);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1338 gtk_window_move (GTK_WINDOW (box->popup_window), x, y);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1339 gtk_widget_show(box->popup_window);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1340 gtk_widget_grab_focus (box->tree_view);
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1341 if (!popup_grab_on_window(gtk_widget_get_window(box->popup_window), event)) {
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1342 gtk_widget_hide (box->popup_window);
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1343 return;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1344 }
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1345 gtk_grab_add (box->popup_window);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1346 /*box->popup_in_progress = TRUE;*/
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1347 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1348 TRUE);
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1349
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1350 if (box->active_row) {
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1351 GtkTreePath *path = gtk_tree_row_reference_get_path(box->active_row);
15335
be7b92050bad [gaim-migrate @ 18063]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15320
diff changeset
1352 gtk_tree_view_set_cursor(GTK_TREE_VIEW(box->tree_view), path, NULL, FALSE);
15224
41128f894bbe [gaim-migrate @ 17948]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15216
diff changeset
1353 gtk_tree_path_free(path);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1354 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1355 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1356
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1357 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1358 pidgin_status_box_popdown(PidginStatusBox *box, GdkEvent *event)
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1359 {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1360 guint32 time;
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1361 GdkDevice *device;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1362 gtk_widget_hide(box->popup_window);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1363 box->popup_in_progress = FALSE;
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1364 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1365 gtk_grab_remove(box->popup_window);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1366 time = gdk_event_get_time(event);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1367 device = gdk_event_get_device(event);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1368 gdk_device_ungrab(device, time);
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1369 gdk_device_ungrab(gdk_device_get_associated_device(device), time);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1370 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1371
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1372 static gboolean
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1373 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box)
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1374 {
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1375 switch (event->keyval) {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1376 case GDK_KEY_Return:
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1377 case GDK_KEY_KP_Enter:
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1378 case GDK_KEY_KP_Space:
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1379 case GDK_KEY_space:
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1380 if (!box->popup_in_progress) {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1381 pidgin_status_box_popup(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1382 box->popup_in_progress = TRUE;
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1383 } else {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1384 pidgin_status_box_popdown(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1385 }
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1386 return TRUE;
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1387 default:
23032
0acae5b01488 Patch from QuLogic to fix tab-navigation in the statusbox. And a few
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22882
diff changeset
1388 return FALSE;
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1389 }
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1390 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1391
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1392 static gboolean
19576
09a205dd2fea Bring up statusbox menu on button-down instead of button-up. Fixes #1437
Sean Egan <seanegan@pidgin.im>
parents: 19455
diff changeset
1393 toggled_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1394 {
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1395 if (!box->popup_in_progress)
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1396 pidgin_status_box_popup(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1397 else
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1398 pidgin_status_box_popdown(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1399 return TRUE;
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1400 }
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1401
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1402 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1403 buddy_icon_set_cb(const char *filename, PidginStatusBox *box)
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1404 {
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
1405 PurpleImage *img = NULL;
36633
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1406 PurpleBuddyIconSpec *icon_spec = NULL;
14203
f3a50c328ddc [gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents: 14196
diff changeset
1407
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1408 if (box->account) {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
1409 PurpleProtocol *protocol =
36626
18fc361b3704 Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents: 36607
diff changeset
1410 purple_protocols_find(purple_account_get_protocol_id(box->account));
36633
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1411 if (protocol)
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1412 icon_spec = purple_protocol_get_icon_spec(protocol);
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1413 if (icon_spec && icon_spec->format) {
36424
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1414 gpointer data = NULL;
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1415 size_t len = 0;
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1416 if (filename)
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
1417 data = pidgin_convert_buddy_icon(protocol, filename, &len);
36424
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1418 img = purple_buddy_icons_set_account_icon(box->account, data, len);
37134
07746c9a04bf Merged default branch
Ankit Vani <a@nevitus.org>
parents: 37133 35818
diff changeset
1419 if (img) {
36424
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1420 /*
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1421 * set_account_icon doesn't give us a reference, but we
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1422 * unref one below (for the other code path)
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1423 */
37134
07746c9a04bf Merged default branch
Ankit Vani <a@nevitus.org>
parents: 37133 35818
diff changeset
1424 g_object_ref(img);
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1425 }
36424
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1426
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1427 purple_account_set_buddy_icon_path(box->account, filename);
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1428
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1429 purple_account_set_bool(box->account, "use-global-buddyicon", (filename != NULL));
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1430 }
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1431 } else {
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
1432 GList *accounts;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1433 for (accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1434 PurpleAccount *account = accounts->data;
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
1435 PurpleProtocol *protocol =
36626
18fc361b3704 Renamed purple_find_protocol_info to purple_protocols_find
Ankit Vani <a@nevitus.org>
parents: 36607
diff changeset
1436 purple_protocols_find(purple_account_get_protocol_id(account));
36633
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1437 if (protocol)
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1438 icon_spec = purple_protocol_get_icon_spec(protocol);
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1439 if (icon_spec && icon_spec->format &&
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
1440 purple_account_get_bool(account, "use-global-buddyicon", TRUE)) {
36424
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1441 gpointer data = NULL;
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1442 size_t len = 0;
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1443 if (filename)
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
1444 data = pidgin_convert_buddy_icon(protocol, filename, &len);
36424
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1445 purple_buddy_icons_set_account_icon(account, data, len);
477889a0073c Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents: 36361
diff changeset
1446 purple_account_set_buddy_icon_path(account, filename);
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1447 }
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1448 }
16742
4359a1e75fa2 Make the icon show up when you change the global buddy icon pref, even if all the accounts have per-account icons.
Kevin Stange <kstange@pidgin.im>
parents: 16741
diff changeset
1449
4359a1e75fa2 Make the icon show up when you change the global buddy icon pref, even if all the accounts have per-account icons.
Kevin Stange <kstange@pidgin.im>
parents: 16741
diff changeset
1450 /* Even if no accounts were processed, load the icon that was set. */
4359a1e75fa2 Make the icon show up when you change the global buddy icon pref, even if all the accounts have per-account icons.
Kevin Stange <kstange@pidgin.im>
parents: 16741
diff changeset
1451 if (filename != NULL)
38285
72824d3b7190 Update pidgin for the PurpleImage and PurpleSmiley changes
Gary Kramlich <grim@reaperworld.com>
parents: 38277
diff changeset
1452 img = purple_image_new_from_file(filename, NULL);
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1453 }
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
1454
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
1455 pidgin_status_box_set_buddy_icon(box, img);
25745
48b7ebd7fcc7 Fix the crash/leaks in statusbox
Paul Aurich <darkrain42@pidgin.im>
parents: 24508
diff changeset
1456 if (img)
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
1457 g_object_unref(img);
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1458 }
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1459
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1460 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1461 remove_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box)
15082
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1462 {
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1463 if (box->account == NULL)
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1464 /* The pref-connect callback does the actual work */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15999
diff changeset
1465 purple_prefs_set_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon", NULL);
15082
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1466 else
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1467 buddy_icon_set_cb(NULL, box);
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1468
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1469 gtk_widget_destroy(box->icon_box_menu);
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1470 box->icon_box_menu = NULL;
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1471 }
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1472
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1473 static void
27117
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1474 choose_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box)
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1475 {
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1476 if (box->buddy_icon_sel) {
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1477 gtk_window_present(GTK_WINDOW(box->buddy_icon_sel));
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1478 } else {
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1479 box->buddy_icon_sel = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(w)), icon_choose_cb, box);
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1480 gtk_widget_show_all(box->buddy_icon_sel);
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1481 }
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1482 }
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1483
3095ed1fc101 A patch from nops to add a "Select Buddy Icon" (my term, the original patch
Richard Laager <rlaager@pidgin.im>
parents: 27054
diff changeset
1484 static void
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1485 icon_choose_cb(const char *filename, gpointer data)
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1486 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1487 PidginStatusBox *box = data;
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1488 if (filename) {
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1489 if (box->account == NULL)
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1490 /* The pref-connect callback does the actual work */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15999
diff changeset
1491 purple_prefs_set_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon", filename);
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1492 else
15082
ec55357842d3 [gaim-migrate @ 17802]
Daniel Atallah <datallah@pidgin.im>
parents: 15079
diff changeset
1493 buddy_icon_set_cb(filename, box);
15079
835ed45157ce [gaim-migrate @ 17799]
Daniel Atallah <datallah@pidgin.im>
parents: 15064
diff changeset
1494 }
14847
5c766c6e8e3d [gaim-migrate @ 17549]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14809
diff changeset
1495
5c766c6e8e3d [gaim-migrate @ 17549]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14809
diff changeset
1496 box->buddy_icon_sel = NULL;
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1497 }
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1498
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1499 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1500 update_buddyicon_cb(const char *name, PurplePrefType type,
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1501 gconstpointer value, gpointer data)
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1502 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1503 buddy_icon_set_cb(value, (PidginStatusBox*) data);
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1504 }
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1505
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1506 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1507 treeview_activate_current_selection(PidginStatusBox *status_box, GtkTreePath *path, GdkEvent *event)
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1508 {
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1509 if (status_box->active_row)
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1510 gtk_tree_row_reference_free(status_box->active_row);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1511
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1512 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path);
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1513 pidgin_status_box_popdown(status_box, event);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1514 pidgin_status_box_changed(status_box);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1515 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1516
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1517 static void tree_view_delete_current_selection_cb(gpointer data)
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1518 {
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1519 PurpleSavedStatus *saved;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1520
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1521 saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1522 g_return_if_fail(saved != NULL);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1523
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1524 if (purple_savedstatus_get_current() != saved)
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1525 purple_savedstatus_delete_by_status(saved);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1526 }
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1527
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1528 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1529 tree_view_delete_current_selection(PidginStatusBox *status_box, GtkTreePath *path, GdkEvent *event)
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1530 {
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1531 GtkTreeIter iter;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1532 gpointer data;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1533 PurpleSavedStatus *saved;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1534 gchar *msg;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1535
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1536 if (status_box->active_row) {
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1537 /* don't delete active status */
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1538 if (gtk_tree_path_compare(path, gtk_tree_row_reference_get_path(status_box->active_row)) == 0)
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1539 return;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1540 }
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1541
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1542 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1543 return;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1544
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1545 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1546 DATA_COLUMN, &data,
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1547 -1);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1548
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1549 saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1550 g_return_if_fail(saved != NULL);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1551 if (saved == purple_savedstatus_get_current())
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1552 return;
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1553
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1554 msg = g_strdup_printf(_("Are you sure you want to delete %s?"), purple_savedstatus_get_title(saved));
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1555
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1556 purple_request_action(saved, NULL, msg, NULL, 0,
34331
c8486462bb63 Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
1557 NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1558 data, 2,
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1559 _("Delete"), tree_view_delete_current_selection_cb,
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1560 _("Cancel"), NULL);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1561
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1562 g_free(msg);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1563
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1564 pidgin_status_box_popdown(status_box, event);
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1565 }
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1566
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1567 static gboolean
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1568 treeview_button_release_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *status_box)
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1569 {
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1570 GtkTreePath *path = NULL;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1571 int ret;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1572 GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1573
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1574 if (ewidget != status_box->tree_view) {
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1575 if (ewidget == status_box->toggle_button &&
15176
44bc99559266 [gaim-migrate @ 17900]
Sean Egan <seanegan@pidgin.im>
parents: 15174
diff changeset
1576 status_box->popup_in_progress &&
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1577 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (status_box->toggle_button))) {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1578 pidgin_status_box_popdown(status_box, (GdkEvent *)event);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1579 return TRUE;
19659
acdd4962bf80 Allow you to click on statusbox again and keep it open.
Sean Egan <seanegan@pidgin.im>
parents: 19576
diff changeset
1580 } else if (ewidget == status_box->toggle_button) {
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24508
diff changeset
1581 status_box->popup_in_progress = TRUE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1582 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1583
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1584 /* released outside treeview */
19659
acdd4962bf80 Allow you to click on statusbox again and keep it open.
Sean Egan <seanegan@pidgin.im>
parents: 19576
diff changeset
1585 if (ewidget != status_box->toggle_button) {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1586 pidgin_status_box_popdown(status_box, (GdkEvent *)event);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1587 return TRUE;
19659
acdd4962bf80 Allow you to click on statusbox again and keep it open.
Sean Egan <seanegan@pidgin.im>
parents: 19576
diff changeset
1588 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1589
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1590 return FALSE;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1591 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1592
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1593 ret = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (status_box->tree_view),
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1594 event->x, event->y,
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1595 &path,
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1596 NULL, NULL, NULL);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1597
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1598 if (!ret)
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1599 return TRUE; /* clicked outside window? */
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1600
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1601 treeview_activate_current_selection(status_box, path, (GdkEvent *)event);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1602 gtk_tree_path_free (path);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1603
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1604 return TRUE;
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1605 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1606
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1607 static gboolean
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1608 treeview_key_press_event(GtkWidget *widget,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1609 GdkEventKey *event, PidginStatusBox *box)
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1610 {
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1611 if (box->popup_in_progress) {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1612 if (event->keyval == GDK_KEY_Escape) {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1613 pidgin_status_box_popdown(box, (GdkEvent *)event);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1614 return TRUE;
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1615 } else {
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1616 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(box->tree_view));
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1617 GtkTreeIter iter;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1618 GtkTreePath *path;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1619
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1620 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) {
18259
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1621 gboolean ret = TRUE;
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1622 path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter);
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1623 if (event->keyval == GDK_KEY_Return) {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1624 treeview_activate_current_selection(box, path, (GdkEvent *)event);
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1625 } else if (event->keyval == GDK_KEY_Delete) {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1626 tree_view_delete_current_selection(box, path, (GdkEvent *)event);
18259
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1627 } else
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1628 ret = FALSE;
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1629
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1630 gtk_tree_path_free (path);
18259
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1631 return ret;
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1632 }
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24508
diff changeset
1633 }
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1634 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1635 return FALSE;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1636 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1637
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1638 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1639 webview_cursor_moved_cb(gpointer data, PidginWebView *webview)
22882
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1640 {
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1641 /* Restart the typing timeout if arrow keys are pressed while editing the message */
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1642 PidginStatusBox *status_box = data;
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1643 if (status_box->typing == 0)
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1644 return;
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1645 webview_changed_cb(NULL, status_box);
22882
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1646 }
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1647
ee7ba5de2f2d Reset typing timeout if arrow keys are pressed when editing status
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22842
diff changeset
1648 static void
23405
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1649 treeview_cursor_changed_cb(GtkTreeView *treeview, gpointer data)
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1650 {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1651 GtkTreeSelection *sel = gtk_tree_view_get_selection (treeview);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1652 GtkTreeModel *model = GTK_TREE_MODEL (data);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1653 GtkTreeIter iter;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1654 GtkTreePath *cursor;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1655 GtkTreePath *selection;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1656 gint cmp;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1657
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1658 if (gtk_tree_selection_get_selected (sel, NULL, &iter)) {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1659 if ((selection = gtk_tree_model_get_path (model, &iter)) == NULL) {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1660 /* Shouldn't happen, but ignore anyway */
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1661 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1662 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1663 } else {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1664 /* I don't think this can happen, but we'll just ignore it */
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1665 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1666 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1667
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1668 gtk_tree_view_get_cursor (treeview, &cursor, NULL);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1669 if (cursor == NULL) {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1670 /* Probably won't happen in a 'cursor-changed' event? */
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1671 gtk_tree_path_free (selection);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1672 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1673 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1674
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1675 cmp = gtk_tree_path_compare (cursor, selection);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1676 if (cmp < 0) {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1677 /* The cursor moved up without moving the selection, so move it up again */
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1678 gtk_tree_path_prev (cursor);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1679 gtk_tree_view_set_cursor (treeview, cursor, NULL, FALSE);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1680 } else if (cmp > 0) {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1681 /* The cursor moved down without moving the selection, so move it down again */
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1682 gtk_tree_path_next (cursor);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1683 gtk_tree_view_set_cursor (treeview, cursor, NULL, FALSE);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1684 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1685
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1686 gtk_tree_path_free (selection);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1687 gtk_tree_path_free (cursor);
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1688 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1689
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1690 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1691 pidgin_status_box_init (PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1692 {
11400
be2052efada5 [gaim-migrate @ 13635]
Will Thompson <resiak@pidgin.im>
parents: 11347
diff changeset
1693 GtkCellRenderer *text_rend;
be2052efada5 [gaim-migrate @ 13635]
Will Thompson <resiak@pidgin.im>
parents: 11347
diff changeset
1694 GtkCellRenderer *icon_rend;
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1695 GtkCellRenderer *emblem_rend;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1696 GtkWidget *toplevel;
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1697 GtkTreeSelection *sel;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1698
32914
9d3d02829373 Fix calls to GTK_WIDGET_SET_FLAGS, which oddly enough does not seem to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32913
diff changeset
1699 gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1700 status_box->webview_visible = FALSE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1701 status_box->network_available = purple_network_is_available();
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1702 status_box->connecting = FALSE;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
1703 status_box->typing = 0;
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1704 status_box->toggle_button = gtk_toggle_button_new();
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35500
diff changeset
1705 status_box->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1706 status_box->cell_view = gtk_cell_view_new();
35528
e04ba70092e9 Fix the rest of [hv] gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
1707 status_box->vsep = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
38004
2a9e87b2a89c Remove deprecated gtk_arrow_new calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37997
diff changeset
1708 #if GTK_CHECK_VERSION(3,14,0)
2a9e87b2a89c Remove deprecated gtk_arrow_new calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37997
diff changeset
1709 status_box->arrow = gtk_image_new_from_icon_name("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
2a9e87b2a89c Remove deprecated gtk_arrow_new calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37997
diff changeset
1710 #else
2a9e87b2a89c Remove deprecated gtk_arrow_new calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37997
diff changeset
1711 status_box->arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
2a9e87b2a89c Remove deprecated gtk_arrow_new calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37997
diff changeset
1712 #endif
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1713
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1714 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING,
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
1715 G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN);
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1716 status_box->dropdown_store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING,
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1717 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_BOOLEAN);
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1718
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1719 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store));
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1720 gtk_list_store_append(status_box->store, &(status_box->iter));
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1721
22842
48b31ecd153e Give a name to the statusbox button so that it can be accessible by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22836
diff changeset
1722 atk_object_set_name(gtk_widget_get_accessible(status_box->toggle_button), _("Status Selector"));
48b31ecd153e Give a name to the statusbox button so that it can be accessible by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22836
diff changeset
1723
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1724 gtk_container_add(GTK_CONTAINER(status_box->toggle_button), status_box->hbox);
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1725 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->cell_view, TRUE, TRUE, 0);
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1726 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->vsep, FALSE, FALSE, 0);
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1727 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->arrow, FALSE, FALSE, 0);
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1728 gtk_widget_show_all(status_box->toggle_button);
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1729 gtk_button_set_focus_on_click(GTK_BUTTON(status_box->toggle_button), FALSE);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1730
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1731 text_rend = gtk_cell_renderer_text_new();
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1732 icon_rend = gtk_cell_renderer_pixbuf_new();
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1733 emblem_rend = gtk_cell_renderer_pixbuf_new();
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1734 status_box->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1735
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1736 toplevel = gtk_widget_get_toplevel (GTK_WIDGET (status_box));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1737 if (GTK_IS_WINDOW (toplevel)) {
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1738 gtk_window_set_transient_for (GTK_WINDOW (status_box->popup_window),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1739 GTK_WINDOW (toplevel));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1740 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1741
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1742 gtk_window_set_resizable (GTK_WINDOW (status_box->popup_window), FALSE);
22618
4a216b99c56c Danny Baumann pointed out that the status box menu should have the appropriate
Will Thompson <resiak@pidgin.im>
parents: 22305
diff changeset
1743 gtk_window_set_type_hint (GTK_WINDOW (status_box->popup_window),
4a216b99c56c Danny Baumann pointed out that the status box menu should have the appropriate
Will Thompson <resiak@pidgin.im>
parents: 22305
diff changeset
1744 GDK_WINDOW_TYPE_HINT_POPUP_MENU);
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1745 gtk_window_set_screen (GTK_WINDOW (status_box->popup_window),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1746 gtk_widget_get_screen (GTK_WIDGET (status_box)));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1747 status_box->popup_frame = gtk_frame_new (NULL);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1748 gtk_frame_set_shadow_type (GTK_FRAME (status_box->popup_frame),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1749 GTK_SHADOW_ETCHED_IN);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1750 gtk_container_add (GTK_CONTAINER (status_box->popup_window),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1751 status_box->popup_frame);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1752
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1753 gtk_widget_show (status_box->popup_frame);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1754
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1755 status_box->tree_view = gtk_tree_view_new ();
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1756 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (status_box->tree_view));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1757 gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1758 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (status_box->tree_view),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1759 FALSE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1760 gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (status_box->tree_view),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1761 TRUE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1762 gtk_tree_view_set_model (GTK_TREE_VIEW (status_box->tree_view),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1763 GTK_TREE_MODEL(status_box->dropdown_store));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1764 status_box->column = gtk_tree_view_column_new ();
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1765 gtk_tree_view_append_column (GTK_TREE_VIEW (status_box->tree_view),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1766 status_box->column);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1767 gtk_tree_view_column_pack_start(status_box->column, icon_rend, FALSE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1768 gtk_tree_view_column_pack_start(status_box->column, text_rend, TRUE);
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1769 gtk_tree_view_column_pack_start(status_box->column, emblem_rend, FALSE);
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1770 gtk_tree_view_column_set_attributes(status_box->column, icon_rend, "stock-id", ICON_STOCK_COLUMN, NULL);
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1771 gtk_tree_view_column_set_attributes(status_box->column, text_rend, "markup", TEXT_COLUMN, NULL);
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1772 gtk_tree_view_column_set_attributes(status_box->column, emblem_rend, "stock-id", EMBLEM_COLUMN, "visible", EMBLEM_VISIBLE_COLUMN, NULL);
31321
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 30707
diff changeset
1773
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 30707
diff changeset
1774 status_box->scrolled_window = pidgin_make_scrollable(status_box->tree_view, GTK_POLICY_NEVER, GTK_POLICY_NEVER, GTK_SHADOW_NONE, -1, -1);
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 30707
diff changeset
1775 gtk_container_add (GTK_CONTAINER (status_box->popup_frame),
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 30707
diff changeset
1776 status_box->scrolled_window);
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 30707
diff changeset
1777
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1778 gtk_widget_show(status_box->tree_view);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1779 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN);
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1780 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(status_box->tree_view),
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
1781 pidgin_tree_view_search_equal_func, NULL, NULL);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1782
13045
75f38f58edde [gaim-migrate @ 15404]
Mark Doliner <markdoliner@pidgin.im>
parents: 13044
diff changeset
1783 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1784
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1785 status_box->icon_rend = gtk_cell_renderer_pixbuf_new();
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1786 status_box->text_rend = gtk_cell_renderer_text_new();
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
1787 emblem_rend = gtk_cell_renderer_pixbuf_new();
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
1788 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE);
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
1789 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE);
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
1790 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), emblem_rend, FALSE);
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
1791 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "stock-id", ICON_STOCK_COLUMN, NULL);
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
1792 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL);
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
1793 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), emblem_rend, "pixbuf", EMBLEM_COLUMN, "visible", EMBLEM_VISIBLE_COLUMN, NULL);
13045
75f38f58edde [gaim-migrate @ 15404]
Mark Doliner <markdoliner@pidgin.im>
parents: 13044
diff changeset
1794 g_object_set(status_box->text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1795
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35500
diff changeset
1796 status_box->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, FALSE);
34276
2b602f67f875 Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34274
diff changeset
1797 status_box->sw = pidgin_create_webview(TRUE, &status_box->webview, NULL);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1798 pidgin_webview_hide_toolbar(PIDGIN_WEBVIEW(status_box->webview));
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1799
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1800 #if 0
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1801 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event",
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1802 G_CALLBACK(button_pressed_cb), status_box);
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1803 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event",
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1804 G_CALLBACK(button_released_cb), status_box);
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1805 #endif
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1806 g_signal_connect(G_OBJECT(status_box->toggle_button), "key-press-event",
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1807 G_CALLBACK(toggle_key_press_cb), status_box);
19576
09a205dd2fea Bring up statusbox menu on button-down instead of button-up. Fixes #1437
Sean Egan <seanegan@pidgin.im>
parents: 19455
diff changeset
1808 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event",
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1809 G_CALLBACK(toggled_cb), status_box);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1810 g_signal_connect(G_OBJECT(status_box->webview), "changed",
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1811 G_CALLBACK(webview_changed_cb), status_box);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1812 g_signal_connect(G_OBJECT(status_box->webview), "format-toggled",
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1813 G_CALLBACK(webview_format_changed_cb), status_box);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1814 g_signal_connect_swapped(G_OBJECT(status_box->webview), "selection-changed",
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1815 G_CALLBACK(webview_cursor_moved_cb), status_box);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1816 g_signal_connect(G_OBJECT(status_box->webview), "key-press-event",
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1817 G_CALLBACK(webview_remove_focus), status_box);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1818
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15999
diff changeset
1819 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck"))
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
1820 pidgin_webview_set_spellcheck(PIDGIN_WEBVIEW(status_box->webview), TRUE);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1821 gtk_widget_set_parent(status_box->vbox, GTK_WIDGET(status_box));
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1822 gtk_widget_show_all(status_box->vbox);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1823
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1824 gtk_widget_set_parent(status_box->toggle_button, GTK_WIDGET(status_box));
12269
6e0a4c36e9da [gaim-migrate @ 14571]
Sean Egan <seanegan@pidgin.im>
parents: 12262
diff changeset
1825
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1826 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1827
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1828 g_signal_connect(G_OBJECT(status_box), "scroll-event", G_CALLBACK(combo_box_scroll_event_cb), NULL);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1829 g_signal_connect(G_OBJECT(status_box->webview), "scroll-event",
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1830 G_CALLBACK(webview_scroll_event_cb), status_box->webview);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1831 g_signal_connect(G_OBJECT(status_box->popup_window), "button_release_event", G_CALLBACK(treeview_button_release_cb), status_box);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1832 g_signal_connect(G_OBJECT(status_box->popup_window), "key_press_event", G_CALLBACK(treeview_key_press_event), status_box);
23405
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1833 g_signal_connect(G_OBJECT(status_box->tree_view), "cursor-changed",
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1834 G_CALLBACK(treeview_cursor_changed_cb), status_box->dropdown_store);
12075
6e9784c94721 [gaim-migrate @ 14372]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12074
diff changeset
1835
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1836 gtk_tree_view_set_row_separator_func(GTK_TREE_VIEW(status_box->tree_view), dropdown_store_row_separator_func, NULL, NULL);
11850
794e48f305ab [gaim-migrate @ 14141]
Richard Stellingwerff <remenic@gmail.com>
parents: 11836
diff changeset
1837
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1838 status_box->token_status_account = check_active_accounts_for_identical_statuses();
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1839
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
1840 cache_pixbufs(status_box);
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1841 pidgin_status_box_regenerate(status_box, TRUE);
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1842
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1843 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed",
14190
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
1844 status_box,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1845 PURPLE_CALLBACK(current_savedstatus_changed_cb),
14190
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
1846 status_box);
18183
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1847 purple_signal_connect(purple_savedstatuses_get_handle(),
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1848 "savedstatus-added", status_box,
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1849 PURPLE_CALLBACK(saved_status_updated_cb), status_box);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1850 purple_signal_connect(purple_savedstatuses_get_handle(),
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1851 "savedstatus-deleted", status_box,
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1852 PURPLE_CALLBACK(saved_status_updated_cb), status_box);
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1853 purple_signal_connect(purple_savedstatuses_get_handle(),
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1854 "savedstatus-modified", status_box,
31e06ec80111 fixes #590 by allowing one to use the delete key to delete transient status,
Ka-Hing Cheung <khc@pidgin.im>
parents: 18121
diff changeset
1855 PURPLE_CALLBACK(saved_status_updated_cb), status_box);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1856 purple_signal_connect(purple_accounts_get_handle(), "account-enabled", status_box,
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1857 PURPLE_CALLBACK(account_enabled_cb),
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1858 status_box);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1859 purple_signal_connect(purple_accounts_get_handle(), "account-disabled", status_box,
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1860 PURPLE_CALLBACK(account_enabled_cb),
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1861 status_box);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1862 purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", status_box,
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1863 PURPLE_CALLBACK(account_status_changed_cb),
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1864 status_box);
14804
8c79ca123c25 [gaim-migrate @ 17499]
Daniel Atallah <datallah@pidgin.im>
parents: 14801
diff changeset
1865
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15999
diff changeset
1866 purple_prefs_connect_callback(status_box, PIDGIN_PREFS_ROOT "/conversations/spellcheck",
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
1867 spellcheck_prefs_cb, status_box);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15999
diff changeset
1868 purple_prefs_connect_callback(status_box, PIDGIN_PREFS_ROOT "/accounts/buddyicon",
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1869 update_buddyicon_cb, status_box);
15885
01f2c945c63c who knew that --disable-plugins still worked?! Also, some completely untested support for aim:buddyicon, which I'll look at more tomorrow
Sean Egan <seanegan@pidgin.im>
parents: 15884
diff changeset
1870
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1871 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1872
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1873 static void
32404
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1874 pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height,
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1875 gint *natural_height)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1876 {
32404
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1877 gint box_min_height, box_nat_height;
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1878 gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget));
33158
ad941796372e Remove some added trailing spaces.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33152
diff changeset
1879
32404
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1880 gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->toggle_button,
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1881 minimum_height, natural_height);
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1882
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1883 *minimum_height = MAX(*minimum_height, 34) + border_width * 2;
6833b5e3f687 the status box is now visible (and usable). autoexpanding for the in-line status editor is not quite working right...
Marcus Lundblad <malu@pidgin.im>
parents: 32403
diff changeset
1884 *natural_height = MAX(*natural_height, 34) + border_width * 2;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1885
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1886 /* If the gtkwebview is visible, then add some additional padding */
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1887 if (PIDGIN_STATUS_BOX(widget)->webview_visible) {
33152
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1888 gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->vbox,
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1889 &box_min_height, &box_nat_height);
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1890
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1891 if (box_min_height > 1)
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1892 *minimum_height += box_min_height + border_width * 2;
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1893
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1894 if (box_nat_height > 1)
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1895 *natural_height += box_nat_height + border_width * 2;
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1896 }
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1897 }
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1898
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1899 /* From gnome-panel */
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1900 static void
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1901 do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift)
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1902 {
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1903 gint i, j;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1904 gint width, height, has_alpha, srcrowstride, destrowstride;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1905 guchar *target_pixels;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1906 guchar *original_pixels;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1907 guchar *pixsrc;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1908 guchar *pixdest;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1909 int val;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1910 guchar r,g,b;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1911
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1912 has_alpha = gdk_pixbuf_get_has_alpha (src);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1913 width = gdk_pixbuf_get_width (src);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1914 height = gdk_pixbuf_get_height (src);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1915 srcrowstride = gdk_pixbuf_get_rowstride (src);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1916 destrowstride = gdk_pixbuf_get_rowstride (dest);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1917 target_pixels = gdk_pixbuf_get_pixels (dest);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1918 original_pixels = gdk_pixbuf_get_pixels (src);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1919
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1920 for (i = 0; i < height; i++) {
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1921 pixdest = target_pixels + i*destrowstride;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1922 pixsrc = original_pixels + i*srcrowstride;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1923 for (j = 0; j < width; j++) {
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1924 r = *(pixsrc++);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1925 g = *(pixsrc++);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1926 b = *(pixsrc++);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1927 val = r + shift;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1928 *(pixdest++) = CLAMP(val, 0, 255);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1929 val = g + shift;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1930 *(pixdest++) = CLAMP(val, 0, 255);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1931 val = b + shift;
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1932 *(pixdest++) = CLAMP(val, 0, 255);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1933 if (has_alpha)
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1934 *(pixdest++) = *(pixsrc++);
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1935 }
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1936 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1937 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1938
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1939 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1940 pidgin_status_box_size_allocate(GtkWidget *widget,
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1941 GtkAllocation *allocation)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1942 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1943 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1944 GtkRequisition req = {0,0};
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1945 GtkAllocation parent_alc, box_alc, icon_alc;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
1946 gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget));
11400
be2052efada5 [gaim-migrate @ 13635]
Will Thompson <resiak@pidgin.im>
parents: 11347
diff changeset
1947
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
1948 gtk_widget_get_preferred_size(status_box->toggle_button, NULL, &req);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1949 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1950
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1951 req.height = MAX(req.height, 34);
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1952 req.height += border_width * 2;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1953
13065
6ad1cf73ad6b [gaim-migrate @ 15427]
Mark Doliner <markdoliner@pidgin.im>
parents: 13062
diff changeset
1954 box_alc = *allocation;
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
1955
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1956 box_alc.width -= (border_width * 2);
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1957 box_alc.height = MAX(1, ((allocation->height - req.height) - (border_width*2)));
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1958 box_alc.x += border_width;
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1959 box_alc.y += req.height + border_width;
15180
7ed2edcb163b [gaim-migrate @ 17904]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15177
diff changeset
1960 gtk_widget_size_allocate(status_box->vbox, &box_alc);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1961
13065
6ad1cf73ad6b [gaim-migrate @ 15427]
Mark Doliner <markdoliner@pidgin.im>
parents: 13062
diff changeset
1962 parent_alc = *allocation;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1963 parent_alc.height = MAX(1,req.height - (border_width *2));
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1964 parent_alc.width -= (border_width * 2);
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1965 parent_alc.x += border_width;
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1966 parent_alc.y += border_width;
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1967
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1968 if (status_box->icon_box)
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1969 {
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1970 parent_alc.width -= (parent_alc.height + border_width);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1971 icon_alc = parent_alc;
16158
04028f467df0 Death to Binreloc\!
Sean Egan <seanegan@pidgin.im>
parents: 16123
diff changeset
1972 icon_alc.height = MAX(1, icon_alc.height) - 2;
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1973 icon_alc.width = icon_alc.height;
33215
4f8d94fe3913 Fix status box icon positioning.
David Michael <fedora.dm0@gmail.com>
parents: 31889
diff changeset
1974 icon_alc.x += allocation->width - (icon_alc.width + border_width + 1);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1975 icon_alc.y += 1;
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
1976
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1977 if (status_box->icon_size != icon_alc.height)
14206
5a17eb1a2c3e [gaim-migrate @ 16786]
Mark Doliner <markdoliner@pidgin.im>
parents: 14205
diff changeset
1978 {
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1979 status_box->icon_size = icon_alc.height;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1980 pidgin_status_box_redisplay_buddy_icon(status_box);
14206
5a17eb1a2c3e [gaim-migrate @ 16786]
Mark Doliner <markdoliner@pidgin.im>
parents: 14205
diff changeset
1981 }
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1982 gtk_widget_size_allocate(status_box->icon_box, &icon_alc);
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1983 }
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1984 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc);
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1985 gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1986 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1987
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1988 static gboolean
32403
1b8edcd184f0 I think draw should replace expose_event here, but the status selector is still not seen...
Marcus Lundblad <malu@pidgin.im>
parents: 32394
diff changeset
1989 pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1990 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1991 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
32403
1b8edcd184f0 I think draw should replace expose_event here, but the status selector is still not seen...
Marcus Lundblad <malu@pidgin.im>
parents: 32394
diff changeset
1992 gtk_widget_draw(status_box->toggle_button, cr);
1b8edcd184f0 I think draw should replace expose_event here, but the status selector is still not seen...
Marcus Lundblad <malu@pidgin.im>
parents: 32394
diff changeset
1993
37618
33e0bc920834 Fix status box drawing
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37424
diff changeset
1994 gtk_container_propagate_draw(GTK_CONTAINER(widget), status_box->vbox, cr);
33e0bc920834 Fix status box drawing
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37424
diff changeset
1995
37619
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
1996 if (status_box->icon_box) {
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
1997 gtk_container_propagate_draw(GTK_CONTAINER(widget),
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
1998 status_box->icon_box, cr);
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
1999
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2000 if (status_box->icon_opaque) {
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2001 GtkAllocation allocation;
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2002 GtkStyleContext *context;
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2003
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2004 gtk_widget_get_allocation(status_box->icon_box, &allocation);
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2005 context = gtk_widget_get_style_context(widget);
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2006 gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON);
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2007 gtk_render_frame(context, cr, allocation.x-1, allocation.y-1, 34, 34);
911fe254c4fe Prevent sending NULL to gtk_container_propagate_draw()
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37618
diff changeset
2008 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
2009 }
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2010 return FALSE;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2011 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2012
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2013 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2014 pidgin_status_box_forall(GtkContainer *container,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2015 gboolean include_internals,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2016 GtkCallback callback,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2017 gpointer callback_data)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2018 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2019 PidginStatusBox *status_box = PIDGIN_STATUS_BOX (container);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2020
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2021 if (include_internals)
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2022 {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2023 (* callback) (status_box->vbox, callback_data);
12275
c9b030c5819c [gaim-migrate @ 14579]
Sean Egan <seanegan@pidgin.im>
parents: 12274
diff changeset
2024 (* callback) (status_box->toggle_button, callback_data);
c9b030c5819c [gaim-migrate @ 14579]
Sean Egan <seanegan@pidgin.im>
parents: 12274
diff changeset
2025 (* callback) (status_box->arrow, callback_data);
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
2026 if (status_box->icon_box)
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
2027 (* callback) (status_box->icon_box, callback_data);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2028 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2029 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2030
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2031 GtkWidget *
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2032 pidgin_status_box_new()
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2033 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2034 return g_object_new(PIDGIN_TYPE_STATUS_BOX, "account", NULL,
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
2035 "iconsel", TRUE, NULL);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2036 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2037
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
2038 GtkWidget *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2039 pidgin_status_box_new_with_account(PurpleAccount *account)
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
2040 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2041 return g_object_new(PIDGIN_TYPE_STATUS_BOX, "account", account,
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
2042 "iconsel", TRUE, NULL);
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
2043 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2044
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2045 /*
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2046 * pidgin_status_box_add:
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2047 * @status_box: The status box itself.
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2048 * @type: A PidginStatusBoxItemType.
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2049 * @pixbuf: The icon to associate with this row in the menu. The
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2050 * function will try to decide a pixbuf if none is given.
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2051 * @title: The title of this item. For the primitive entries,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2052 * this is something like "Available" or "Away." For
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2053 * the saved statuses, this is something like
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2054 * "My favorite away message!" This should be
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2055 * plaintext (non-markedup) (this function escapes it).
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2056 * @desc: The secondary text for this item. This will be
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2057 * placed on the row below the title, in a dimmer
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2058 * font (generally gray). This text should be plaintext
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2059 * (non-markedup) (this function escapes it).
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2060 * @data: Data to be associated with this row in the dropdown
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2061 * menu. For primitives this is the value of the
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2062 * PurpleStatusPrimitive. For saved statuses this is the
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2063 * creation timestamp.
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2064 *
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
2065 * Add a row to the dropdown menu.
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2066 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2067 void
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2068 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf,
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2069 const char *title, const char *desc, gpointer data)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2070 {
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2071 GtkTreeIter iter;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2072 char *text;
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2073 const char *stock = NULL;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2074
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2075 if (desc == NULL)
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2076 {
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2077 text = g_markup_escape_text(title, -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2078 }
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2079 else
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2080 {
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
2081 const char *aa_color;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2082 gchar *escaped_title, *escaped_desc;
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2083
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
2084 aa_color = pidgin_get_dim_grey_string(GTK_WIDGET(status_box));
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2085
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2086 escaped_title = g_markup_escape_text(title, -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2087 escaped_desc = g_markup_escape_text(desc, -1);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2088 text = g_strdup_printf("%s - <span color=\"%s\" size=\"smaller\">%s</span>",
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
2089 escaped_title,
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
2090 aa_color, escaped_desc);
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2091 g_free(escaped_title);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2092 g_free(escaped_desc);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2093 }
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2094
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2095 if (!pixbuf) {
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
2096 PurpleStatusPrimitive prim = PURPLE_STATUS_UNSET;
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2097 if (type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE) {
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
2098 prim = GPOINTER_TO_INT(data);
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
2099 } else if (type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR ||
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
2100 type == PIDGIN_STATUS_BOX_TYPE_POPULAR) {
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
2101 PurpleSavedStatus *saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
2102 if (saved) {
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2103 prim = purple_savedstatus_get_primitive_type(saved);
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2104 }
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2105 }
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
2106
26847
bcf32ab6ec75 Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26846
diff changeset
2107 stock = pidgin_stock_id_from_status_primitive(prim);
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2108 }
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2109
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2110 gtk_list_store_append(status_box->dropdown_store, &iter);
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2111 gtk_list_store_set(status_box->dropdown_store, &iter,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2112 TYPE_COLUMN, type,
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
2113 ICON_STOCK_COLUMN, stock,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2114 TEXT_COLUMN, text,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2115 TITLE_COLUMN, title,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2116 DESC_COLUMN, desc,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2117 DATA_COLUMN, data,
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
2118 EMBLEM_VISIBLE_COLUMN, type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
2119 EMBLEM_COLUMN, GTK_STOCK_SAVE,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2120 -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
2121 g_free(text);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2122 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2123
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2124 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2125 pidgin_status_box_add_separator(PidginStatusBox *status_box)
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2126 {
11756
c1b8045e540a [gaim-migrate @ 14047]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11755
diff changeset
2127 /* Don't do anything unless GTK actually supports
c1b8045e540a [gaim-migrate @ 14047]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11755
diff changeset
2128 * gtk_combo_box_set_row_separator_func */
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2129 GtkTreeIter iter;
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2130
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2131 gtk_list_store_append(status_box->dropdown_store, &iter);
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2132 gtk_list_store_set(status_box->dropdown_store, &iter,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2133 TYPE_COLUMN, PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2134 -1);
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2135 }
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2136
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
2137 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2138 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available)
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
2139 {
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
2140 if (!status_box)
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
2141 return;
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
2142 status_box->network_available = available;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2143 pidgin_status_box_refresh(status_box);
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
2144 }
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
2145
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
2146 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2147 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2148 {
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2149 if (!status_box)
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2150 return;
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2151 status_box->connecting = connecting;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2152 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2153 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2154
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2155 static void
16624
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2156 pixbuf_size_prepared_cb(GdkPixbufLoader *loader, int width, int height, gpointer data)
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2157 {
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2158 int w, h;
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2159 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM);
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2160 gtk_icon_size_lookup(icon_size, &w, &h);
17491
f5b75e7f425e Maintain aspect ratio on global icon selector. Fixes #454
Sean Egan <seanegan@pidgin.im>
parents: 17190
diff changeset
2161 if (height > width)
f5b75e7f425e Maintain aspect ratio on global icon selector. Fixes #454
Sean Egan <seanegan@pidgin.im>
parents: 17190
diff changeset
2162 w = width * h / height;
f5b75e7f425e Maintain aspect ratio on global icon selector. Fixes #454
Sean Egan <seanegan@pidgin.im>
parents: 17190
diff changeset
2163 else if (width > height)
f5b75e7f425e Maintain aspect ratio on global icon selector. Fixes #454
Sean Egan <seanegan@pidgin.im>
parents: 17190
diff changeset
2164 h = height * w / width;
16624
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2165 gdk_pixbuf_loader_set_size(loader, w, h);
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2166 }
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2167
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2168 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2169 pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box)
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
2170 {
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
2171
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2172 /* This is sometimes called before the box is shown, and we will not have a size */
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2173 if (status_box->icon_size <= 0)
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2174 return;
14238
4c10e0ea7c84 [gaim-migrate @ 16826]
Daniel Atallah <datallah@pidgin.im>
parents: 14234
diff changeset
2175
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2176 if (status_box->buddy_icon)
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2177 g_object_unref(status_box->buddy_icon);
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2178 if (status_box->buddy_icon_hover)
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2179 g_object_unref(status_box->buddy_icon_hover);
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2180 status_box->buddy_icon = NULL;
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2181 status_box->buddy_icon_hover = NULL;
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2182
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
2183 if (status_box->buddy_icon_img != NULL)
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
2184 {
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2185 GdkPixbufLoader *loader;
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2186 GError *error = NULL;
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2187
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2188 loader = gdk_pixbuf_loader_new();
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2189
16624
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2190 g_signal_connect(G_OBJECT(loader), "size-prepared", G_CALLBACK(pixbuf_size_prepared_cb), NULL);
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2191 if (!gdk_pixbuf_loader_write(loader,
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2192 purple_image_get_data(status_box->buddy_icon_img),
38298
f0a8f63f9312 rename purple_image_get_size to purple_image_get_data_size and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents: 38285
diff changeset
2193 purple_image_get_data_size(status_box->buddy_icon_img),
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2194 &error) || error)
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2195 {
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2196 purple_debug_warning("gtkstatusbox",
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2197 "gdk_pixbuf_loader_write() failed with size=%"
38298
f0a8f63f9312 rename purple_image_get_size to purple_image_get_data_size and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents: 38285
diff changeset
2198 G_GSIZE_FORMAT ": %s", purple_image_get_data_size(
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2199 status_box->buddy_icon_img),
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2200 error ? error->message : "(no error message)");
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2201 if (error)
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2202 g_error_free(error);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2203 } else if (!gdk_pixbuf_loader_close(loader, &error) || error) {
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2204 purple_debug_warning("gtkstatusbox",
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2205 "gdk_pixbuf_loader_close() failed for image of "
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2206 "size %" G_GSIZE_FORMAT ": %s",
38298
f0a8f63f9312 rename purple_image_get_size to purple_image_get_data_size and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents: 38285
diff changeset
2207 purple_image_get_data_size(status_box->buddy_icon_img),
35817
ff2869a741da imgstore: gtkstatusbox
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35815
diff changeset
2208 error ? error->message : "(no error message)");
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2209 if (error)
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2210 g_error_free(error);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2211 } else {
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2212 GdkPixbuf *buf, *scale;
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2213 int scale_width, scale_height;
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2214
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2215 buf = gdk_pixbuf_loader_get_pixbuf(loader);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2216 scale_width = gdk_pixbuf_get_width(buf);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2217 scale_height = gdk_pixbuf_get_height(buf);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2218 scale = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_width, scale_height);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2219 gdk_pixbuf_fill(scale, 0x00000000);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2220 gdk_pixbuf_copy_area(buf, 0, 0, scale_width, scale_height, scale, 0, 0);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2221 if (pidgin_gdk_pixbuf_is_opaque(scale))
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2222 pidgin_gdk_pixbuf_make_round(scale);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2223 status_box->buddy_icon = scale;
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2224 }
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31396
diff changeset
2225
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20214
diff changeset
2226 g_object_unref(loader);
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16446
diff changeset
2227 }
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2228
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2229 if (status_box->buddy_icon == NULL)
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2230 {
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2231 /* Show a placeholder icon */
16386
416b510e691e New select-avatar image from hbons
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16376
diff changeset
2232 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL);
16351
1ac1dbbeb665 References #219
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16314
diff changeset
2233 status_box->buddy_icon = gtk_widget_render_icon(GTK_WIDGET(status_box),
16386
416b510e691e New select-avatar image from hbons
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16376
diff changeset
2234 PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR,
16351
1ac1dbbeb665 References #219
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16314
diff changeset
2235 icon_size, "PidginStatusBox");
14205
07dd7adc4a55 [gaim-migrate @ 16785]
Mark Doliner <markdoliner@pidgin.im>
parents: 14203
diff changeset
2236 }
14203
f3a50c328ddc [gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents: 14196
diff changeset
2237
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2238 if (status_box->buddy_icon != NULL) {
16624
7ee896a1c1f7 This is Sadrul's status-rescale.patch from ticket #314. Luke said it
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2239 status_box->icon_opaque = pidgin_gdk_pixbuf_is_opaque(status_box->buddy_icon);
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2240 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon);
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2241 status_box->buddy_icon_hover = gdk_pixbuf_copy(status_box->buddy_icon);
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2242 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 32);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
2243 gtk_widget_queue_resize(GTK_WIDGET(status_box));
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2244 }
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2245 }
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2246
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2247 void
35815
d6fe2c2ebbbe imgstore: remove from headers
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35689
diff changeset
2248 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, PurpleImage *img)
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2249 {
35818
f01e2638301f imgstore: rip the rest of imgstore references from Pidgin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35817
diff changeset
2250 if (status_box->buddy_icon_img)
f01e2638301f imgstore: rip the rest of imgstore references from Pidgin
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35817
diff changeset
2251 g_object_unref(status_box->buddy_icon_img);
16711
5ed4ee33d0f8 Only attempt to ref the statusbox icon image if it's actually set
Mark Doliner <markdoliner@pidgin.im>
parents: 16688
diff changeset
2252 status_box->buddy_icon_img = img;
5ed4ee33d0f8 Only attempt to ref the statusbox icon image if it's actually set
Mark Doliner <markdoliner@pidgin.im>
parents: 16688
diff changeset
2253 if (status_box->buddy_icon_img != NULL)
35815
d6fe2c2ebbbe imgstore: remove from headers
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35689
diff changeset
2254 g_object_ref(status_box->buddy_icon_img);
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
2255
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2256 pidgin_status_box_redisplay_buddy_icon(status_box);
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
2257 }
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
2258
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
2259 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2260 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2261 {
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2262 if (!status_box)
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2263 return;
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
2264 if (!connecting_stock_ids[++status_box->connecting_index])
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2265 status_box->connecting_index = 0;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2266 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2267 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2268
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
2269 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2270 pidgin_status_box_pulse_typing(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2271 {
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
2272 if (!typing_stock_ids[++status_box->typing_index])
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2273 status_box->typing_index = 0;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2274 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2275 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2276
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2277 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2278 activate_currently_selected_status(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2279 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2280 PidginStatusBoxItemType type;
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2281 gpointer data;
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2282 gchar *title;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2283 GtkTreeIter iter;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2284 GtkTreePath *path;
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2285 char *message;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2286 PurpleSavedStatus *saved_status = NULL;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2287 gboolean changed = TRUE;
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
2288
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2289 path = gtk_tree_row_reference_get_path(status_box->active_row);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2290 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
2291 return;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2292 gtk_tree_path_free(path);
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2293
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2294 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2295 TYPE_COLUMN, &type,
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2296 DATA_COLUMN, &data,
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2297 -1);
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
2298
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2299 /*
13025
824f4aef4e33 [gaim-migrate @ 15378]
Mark Doliner <markdoliner@pidgin.im>
parents: 13023
diff changeset
2300 * If the currently selected status is "New..." or
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2301 * "Saved..." or a popular status then do nothing.
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
2302 * Popular statuses are
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
2303 * activated elsewhere, and we update the status_box
14190
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
2304 * accordingly by connecting to the savedstatus-changed
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
2305 * signal and then calling status_menu_refresh_iter()
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2306 */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2307 if (type != PIDGIN_STATUS_BOX_TYPE_PRIMITIVE)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2308 return;
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2309
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2310 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2311 TITLE_COLUMN, &title, -1);
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2312
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2313 message = pidgin_status_box_get_message(status_box);
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2314 if (!message || !*message)
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2315 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
2316 gtk_widget_hide(status_box->vbox);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2317 status_box->webview_visible = FALSE;
37424
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
2318 g_free(message);
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
2319 message = NULL;
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2320 }
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
2321
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2322 if (status_box->account == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2323 PurpleStatusType *acct_status_type = NULL;
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
2324 const char *id = NULL; /* id of acct_status_type */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2325 PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2326 /* Global */
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2327 /* Save the newly selected status to prefs.xml and status.xml */
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2328
13112
d2c4ff0321e1 [gaim-migrate @ 15473]
Mark Doliner <markdoliner@pidgin.im>
parents: 13099
diff changeset
2329 /* Has the status really been changed? */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2330 if (status_box->token_status_account) {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2331 gint active;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2332 PurpleStatus *status;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2333 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2334 active = gtk_tree_path_get_indices(path)[0];
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
2335
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2336 gtk_tree_path_free(path);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2337
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2338 status = purple_account_get_active_status(status_box->token_status_account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2339
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
2340 acct_status_type = find_status_type_by_index(status_box->token_status_account, active);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2341 id = purple_status_type_get_id(acct_status_type);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2342
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 36256
diff changeset
2343 if (purple_strequal(id, purple_status_get_id(status)) &&
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2344 purple_strequal(message, purple_status_get_attr_string(status, "message")))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2345 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2346 /* Selected status and previous status is the same */
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2347 PurpleSavedStatus *ss = purple_savedstatus_get_current();
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2348 /* Make sure that statusbox displays the correct thing.
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2349 * It can get messed up if the previous selection was a
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2350 * saved status that wasn't supported by this account */
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2351 if ((purple_savedstatus_get_primitive_type(ss) == primitive)
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2352 && purple_savedstatus_is_transient(ss)
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2353 && purple_savedstatus_has_substatuses(ss))
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2354 changed = FALSE;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2355 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2356 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2357 saved_status = purple_savedstatus_get_current();
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2358 if (purple_savedstatus_get_primitive_type(saved_status) == primitive &&
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2359 !purple_savedstatus_has_substatuses(saved_status) &&
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2360 purple_strequal(purple_savedstatus_get_message(saved_status), message))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2361 {
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2362 changed = FALSE;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2363 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2364 }
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2365
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2366 if (changed)
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2367 {
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
2368 /* Manually find the appropriate transient status */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2369 if (status_box->token_status_account) {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
2370 GList *iter = purple_savedstatuses_get_all();
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2371 GList *tmp, *active_accts = purple_accounts_get_all_active();
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2372
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2373 for (; iter != NULL; iter = iter->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2374 PurpleSavedStatus *ss = iter->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2375 const char *ss_msg = purple_savedstatus_get_message(ss);
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
2376 /* find a known transient status that is the same as the
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
2377 * new selected one */
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2378 if ((purple_savedstatus_get_primitive_type(ss) == primitive) && purple_savedstatus_is_transient(ss) &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2379 purple_savedstatus_has_substatuses(ss) && /* Must have substatuses */
28745
a46bd7e81075 there's no reason for message_changed to use g_utf8_collate, and also
Ka-Hing Cheung <khc@pidgin.im>
parents: 28744
diff changeset
2380 purple_strequal(ss_msg, message))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2381 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2382 gboolean found = FALSE;
28749
601a10ad0be1 I don't think the comment made sense, this is probably what it meant
Ka-Hing Cheung <khc@pidgin.im>
parents: 28748
diff changeset
2383 /* this status must have substatuses for all the active accts */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2384 for(tmp = active_accts; tmp != NULL; tmp = tmp->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2385 PurpleAccount *acct = tmp->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2386 PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2387 if (sub) {
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2388 const PurpleStatusType *sub_type =
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2389 purple_savedstatus_substatus_get_status_type(sub);
16688
ef8a9e399320 Fedora bug/patch https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=234399
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16624
diff changeset
2390 const char *subtype_status_id = purple_status_type_get_id(sub_type);
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
2391 if (purple_strequal(subtype_status_id, id)) {
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2392 found = TRUE;
28744
84e58ebb5833 break early if we found the right saved status, and rewrote the exit logic
Ka-Hing Cheung <khc@pidgin.im>
parents: 28087
diff changeset
2393 break;
84e58ebb5833 break early if we found the right saved status, and rewrote the exit logic
Ka-Hing Cheung <khc@pidgin.im>
parents: 28087
diff changeset
2394 }
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2395 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2396 }
28744
84e58ebb5833 break early if we found the right saved status, and rewrote the exit logic
Ka-Hing Cheung <khc@pidgin.im>
parents: 28087
diff changeset
2397
84e58ebb5833 break early if we found the right saved status, and rewrote the exit logic
Ka-Hing Cheung <khc@pidgin.im>
parents: 28087
diff changeset
2398 if (found) {
84e58ebb5833 break early if we found the right saved status, and rewrote the exit logic
Ka-Hing Cheung <khc@pidgin.im>
parents: 28087
diff changeset
2399 saved_status = ss;
84e58ebb5833 break early if we found the right saved status, and rewrote the exit logic
Ka-Hing Cheung <khc@pidgin.im>
parents: 28087
diff changeset
2400 break;
84e58ebb5833 break early if we found the right saved status, and rewrote the exit logic
Ka-Hing Cheung <khc@pidgin.im>
parents: 28087
diff changeset
2401 }
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2402 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2403 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2404
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2405 g_list_free(active_accts);
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2406
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2407 } else {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2408 /* If we've used this type+message before, lookup the transient status */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2409 saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, message);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2410 }
13012
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
2411
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
2412 /* If this type+message is unique then create a new transient saved status */
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
2413 if (saved_status == NULL)
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
2414 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2415 saved_status = purple_savedstatus_new(NULL, primitive);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2416 purple_savedstatus_set_message(saved_status, message);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2417 if (status_box->token_status_account) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2418 GList *tmp, *active_accts = purple_accounts_get_all_active();
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2419 for (tmp = active_accts; tmp != NULL; tmp = tmp->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2420 purple_savedstatus_set_substatus(saved_status,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2421 (PurpleAccount*) tmp->data, acct_status_type, message);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2422 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2423 g_list_free(active_accts);
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2424 }
13012
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
2425 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2426
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2427 /* Set the status for each account */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2428 purple_savedstatus_activate(saved_status);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2429 }
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2430 } else {
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2431 /* Per-account */
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
2432 gint active;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2433 PurpleStatusType *status_type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2434 PurpleStatus *status;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2435 const char *id = NULL;
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2436
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2437 status = purple_account_get_active_status(status_box->account);
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
2438
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
2439 active = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(status_box), "active"));
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2440
11993
b9dff0189886 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
2441 status_type = find_status_type_by_index(status_box->account, active);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2442 id = purple_status_type_get_id(status_type);
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
2443
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 36256
diff changeset
2444 if (purple_strequal(id, purple_status_get_id(status)) &&
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2445 purple_strequal(message, purple_status_get_attr_string(status, "message")))
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2446 {
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2447 /* Selected status and previous status is the same */
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
2448 changed = FALSE;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2449 }
12123
a5890e156848 [gaim-migrate @ 14423]
Mark Doliner <markdoliner@pidgin.im>
parents: 12103
diff changeset
2450
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2451 if (changed)
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2452 {
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2453 if (message)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2454 purple_account_set_status(status_box->account, id,
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2455 TRUE, "message", message, NULL);
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2456 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2457 purple_account_set_status(status_box->account, id,
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2458 TRUE, NULL);
15064
da02544e8fe6 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14865
diff changeset
2459
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2460 saved_status = purple_savedstatus_get_current();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2461 if (purple_savedstatus_is_transient(saved_status))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2462 purple_savedstatus_set_substatus(saved_status, status_box->account,
15064
da02544e8fe6 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14865
diff changeset
2463 status_type, message);
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
2464 }
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
2465 }
11627
07feb58977aa [gaim-migrate @ 13902]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11593
diff changeset
2466
11638
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11627
diff changeset
2467 g_free(title);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2468 g_free(message);
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2469 }
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2470
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2471 static void update_size(PidginStatusBox *status_box)
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2472 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2473 #if 0
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2474 /* TODO WebKit Sizing */
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2475 GtkTextBuffer *buffer;
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2476 GtkTextIter iter;
25902
e00c2d18aad0 Change the logic for breaking out of the while look to match the if
Mark Doliner <markdoliner@pidgin.im>
parents: 25901
diff changeset
2477 int display_lines;
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2478 int lines;
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2479 GdkRectangle oneline;
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2480 int height;
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2481 int pad_top, pad_inside, pad_bottom;
29217
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2482 gboolean interior_focus;
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2483 int focus_width;
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2484 #endif
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2485
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2486 if (!status_box->webview_visible)
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2487 {
12598
fd20149e7a7e [gaim-migrate @ 14928]
Richard Laager <rlaager@pidgin.im>
parents: 12597
diff changeset
2488 if (status_box->vbox != NULL)
fd20149e7a7e [gaim-migrate @ 14928]
Richard Laager <rlaager@pidgin.im>
parents: 12597
diff changeset
2489 gtk_widget_set_size_request(status_box->vbox, -1, -1);
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2490 return;
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2491 }
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2492
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2493 #if 0
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2494 /* TODO WebKit: Entry sizing */
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2495 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->webview));
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2496
17190
674026d9a55a Fix #1100.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17082
diff changeset
2497 height = 0;
25902
e00c2d18aad0 Change the logic for breaking out of the while look to match the if
Mark Doliner <markdoliner@pidgin.im>
parents: 25901
diff changeset
2498 display_lines = 1;
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2499 gtk_text_buffer_get_start_iter(buffer, &iter);
17190
674026d9a55a Fix #1100.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17082
diff changeset
2500 do {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2501 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->webview), &iter, &oneline);
17190
674026d9a55a Fix #1100.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17082
diff changeset
2502 height += oneline.height;
25902
e00c2d18aad0 Change the logic for breaking out of the while look to match the if
Mark Doliner <markdoliner@pidgin.im>
parents: 25901
diff changeset
2503 display_lines++;
e00c2d18aad0 Change the logic for breaking out of the while look to match the if
Mark Doliner <markdoliner@pidgin.im>
parents: 25901
diff changeset
2504 } while (display_lines <= 4 &&
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2505 gtk_text_view_forward_display_line(GTK_TEXT_VIEW(status_box->webview), &iter));
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2506
25901
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2507 /*
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2508 * This check fixes the case where the last character entered is a
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2509 * newline (shift+return). For some reason the
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2510 * gtk_text_view_forward_display_line() function doesn't treat this
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2511 * like a new line, and so we think the input box only needs to be
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2512 * two lines instead of three, for example. So we check if the
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2513 * last character was a newline and add some extra height if so.
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2514 */
25902
e00c2d18aad0 Change the logic for breaking out of the while look to match the if
Mark Doliner <markdoliner@pidgin.im>
parents: 25901
diff changeset
2515 if (display_lines <= 4
25901
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2516 && gtk_text_iter_backward_char(&iter)
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2517 && gtk_text_iter_get_char(&iter) == '\n')
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2518 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2519 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->webview), &iter, &oneline);
25901
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2520 height += oneline.height;
25903
7a2258038ceb Increment display_lines here so that, for fonts where pixels_inside_wrap()
Mark Doliner <markdoliner@pidgin.im>
parents: 25902
diff changeset
2521 display_lines++;
25901
805c4c220100 Fix a bug that's bothered me for a while. When pressing shift+enter in
Mark Doliner <markdoliner@pidgin.im>
parents: 25888
diff changeset
2522 }
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2523
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2524 lines = gtk_text_buffer_get_line_count(buffer);
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2525
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2526 /* Show a maximum of 4 lines */
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2527 lines = MIN(lines, 4);
25902
e00c2d18aad0 Change the logic for breaking out of the while look to match the if
Mark Doliner <markdoliner@pidgin.im>
parents: 25901
diff changeset
2528 display_lines = MIN(display_lines, 4);
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2529
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2530 pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(status_box->webview));
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2531 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(status_box->webview));
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2532 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(status_box->webview));
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2533
17190
674026d9a55a Fix #1100.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17082
diff changeset
2534 height += (pad_top + pad_bottom) * lines;
25902
e00c2d18aad0 Change the logic for breaking out of the while look to match the if
Mark Doliner <markdoliner@pidgin.im>
parents: 25901
diff changeset
2535 height += (pad_inside) * (display_lines - lines);
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2536
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2537 gtk_widget_style_get(status_box->webview,
29217
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2538 "interior-focus", &interior_focus,
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2539 "focus-line-width", &focus_width,
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2540 NULL);
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2541 if (!interior_focus)
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2542 height += 2 * focus_width;
903157b8f52b Patch from Gabriel Schulhof to correctly size the GtkIMHtml entry in the
Gabriel Schulhof <nix@go-nix.ca>
parents: 28781
diff changeset
2543
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15736
diff changeset
2544 gtk_widget_set_size_request(status_box->vbox, -1, height + PIDGIN_HIG_BOX_SPACE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2545 #endif
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2546 gtk_widget_set_size_request(status_box->vbox, -1, -1);
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2547 }
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
2548
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2549 static void remove_typing_cb(PidginStatusBox *status_box)
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2550 {
12782
b6f0819de992 [gaim-migrate @ 15129]
Mark Doliner <markdoliner@pidgin.im>
parents: 12779
diff changeset
2551 if (status_box->typing == 0)
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2552 {
12782
b6f0819de992 [gaim-migrate @ 15129]
Mark Doliner <markdoliner@pidgin.im>
parents: 12779
diff changeset
2553 /* Nothing has changed, so we don't need to do anything */
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
2554 status_menu_refresh_iter(status_box, FALSE);
12782
b6f0819de992 [gaim-migrate @ 15129]
Mark Doliner <markdoliner@pidgin.im>
parents: 12779
diff changeset
2555 return;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2556 }
12782
b6f0819de992 [gaim-migrate @ 15129]
Mark Doliner <markdoliner@pidgin.im>
parents: 12779
diff changeset
2557
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2558 #if 0
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2559 /* TODO WebKit: Doesn't do this? */
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
2560 pidgin_webview_set_populate_primary_clipboard(
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
2561 PIDGIN_WEBVIEW(status_box->webview), TRUE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2562 #endif
27032
991e2899be82 Avoid overwriting the PRIMARY clipboard when we select-on-focus the status text for easy editing. Fixes #8781.
Daniel Atallah <datallah@pidgin.im>
parents: 26887
diff changeset
2563
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
2564 g_source_remove(status_box->typing);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2565 status_box->typing = 0;
13741
95f148a2c70a [gaim-migrate @ 16150]
Mark Doliner <markdoliner@pidgin.im>
parents: 13739
diff changeset
2566
95f148a2c70a [gaim-migrate @ 16150]
Mark Doliner <markdoliner@pidgin.im>
parents: 13739
diff changeset
2567 activate_currently_selected_status(status_box);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2568 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2569 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2570
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2571 static void pidgin_status_box_changed(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2572 {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2573 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2574 GtkTreeIter iter;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2575 PidginStatusBoxItemType type;
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
2576 gpointer data;
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
2577 GList *accounts = NULL, *node;
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
2578 int active;
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2579 gboolean wastyping = FALSE;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2580
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
2581
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2582 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
2583 return;
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
2584 active = gtk_tree_path_get_indices(path)[0];
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
2585 gtk_tree_path_free(path);
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
2586 g_object_set_data(G_OBJECT(status_box), "active", GINT_TO_POINTER(active));
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
2587
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2588 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2589 TYPE_COLUMN, &type,
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
2590 DATA_COLUMN, &data,
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
2591 -1);
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2592 if ((wastyping = (status_box->typing != 0)))
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
2593 g_source_remove(status_box->typing);
11638
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11627
diff changeset
2594 status_box->typing = 0;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2595
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
2596 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box)))
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
2597 {
16426
fabd69a48567 For Luke. Fixes saved status selection
Sean Egan <seanegan@pidgin.im>
parents: 16402
diff changeset
2598 if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR)
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
2599 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2600 PurpleSavedStatus *saved;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2601 saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
2602 g_return_if_fail(saved != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2603 purple_savedstatus_activate(saved);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
2604 return;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
2605 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
2606
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2607 if (type == PIDGIN_STATUS_BOX_TYPE_CUSTOM)
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2608 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2609 PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2610 saved_status = purple_savedstatus_get_current();
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2611 if (purple_savedstatus_get_primitive_type(saved_status) == PURPLE_STATUS_AVAILABLE)
16179
bdf68342e1ce sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents: 16158
diff changeset
2612 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
2613 pidgin_status_editor_show(FALSE,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2614 purple_savedstatus_is_transient(saved_status)
13176
df549de66219 [gaim-migrate @ 15538]
Mark Doliner <markdoliner@pidgin.im>
parents: 13125
diff changeset
2615 ? saved_status : NULL);
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2616 status_menu_refresh_iter(status_box, wastyping);
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2617 if (wastyping)
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2618 pidgin_status_box_refresh(status_box);
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2619 return;
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2620 }
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
2621
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2622 if (type == PIDGIN_STATUS_BOX_TYPE_SAVED)
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2623 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
2624 pidgin_status_window_show();
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2625 status_menu_refresh_iter(status_box, wastyping);
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2626 if (wastyping)
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
2627 pidgin_status_box_refresh(status_box);
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2628 return;
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2629 }
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
2630 }
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
2631
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2632 /*
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
2633 * Show the message box whenever the primitive allows for a
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
2634 * message attribute on any protocol that is enabled,
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
2635 * or our protocol, if we have account set
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2636 */
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
2637 if (status_box->account)
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
2638 accounts = g_list_prepend(accounts, status_box->account);
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
2639 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2640 accounts = purple_accounts_get_all_active();
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2641 status_box->webview_visible = FALSE;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2642 for (node = accounts; node != NULL; node = node->next)
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2643 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2644 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2645 PurpleStatusType *status_type;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2646
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2647 account = node->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2648 status_type = purple_account_get_status_type_with_primitive(account, GPOINTER_TO_INT(data));
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2649 if ((status_type != NULL) &&
31327
831530000b51 disapproval of revision 'c253c498a60e5a02bccb0f59d0908d1623c4307e'
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31326
diff changeset
2650 (purple_status_type_get_attr(status_type, "message") != NULL))
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2651 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2652 status_box->webview_visible = TRUE;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2653 break;
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2654 }
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2655 }
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
2656 g_list_free(accounts);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2657
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
2658 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box)))
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
2659 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2660 if (status_box->webview_visible)
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2661 {
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2662 gtk_widget_show_all(status_box->vbox);
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
2663 status_box->typing = g_timeout_add_seconds(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2664 gtk_widget_grab_focus(status_box->webview);
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2665 #if 0
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2666 /* TODO WebKit: Doesn't do this? */
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
2667 pidgin_webview_set_populate_primary_clipboard(
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
2668 PIDGIN_WEBVIEW(status_box->webview), FALSE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2669 #endif
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2670
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2671 webkit_web_view_select_all(WEBKIT_WEB_VIEW(status_box->webview));
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
2672 }
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2673 else
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2674 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
2675 gtk_widget_hide(status_box->vbox);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2676 activate_currently_selected_status(status_box); /* This is where we actually set the status */
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2677 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2678 }
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2679 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2680 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2681
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2682 static gint
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2683 get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status)
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2684 {
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2685 gint index = -1;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2686
35378
5d9e2581005b gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
2687 switch (purple_savedstatus_get_primitive_type(saved_status))
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2688 {
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2689 /* In reverse order */
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2690 case PURPLE_STATUS_OFFLINE:
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2691 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2692 /* fall through */
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2693 case PURPLE_STATUS_INVISIBLE:
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2694 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2695 /* fall through */
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2696 case PURPLE_STATUS_UNAVAILABLE:
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2697 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2698 /* fall through */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2699 case PURPLE_STATUS_AWAY:
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2700 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2701 /* fall through */
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2702 case PURPLE_STATUS_AVAILABLE:
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2703 index++;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2704 break;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2705 default:
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2706 break;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2707 }
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2708
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2709 return index;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2710 }
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2711
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2712 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
2713 webview_changed_cb(PidginWebView *webview, void *data)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2714 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2715 PidginStatusBox *status_box = (PidginStatusBox*)data;
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 30707
diff changeset
2716 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box)))
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2717 {
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
2718 if (status_box->typing != 0) {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2719 pidgin_status_box_pulse_typing(status_box);
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
2720 g_source_remove(status_box->typing);
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
2721 }
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
2722 status_box->typing = g_timeout_add_seconds(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
2723 }
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2724 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2725 }
10649
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2726
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2727 static void
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
2728 webview_format_changed_cb(PidginWebView *webview, PidginWebViewButtons buttons, void *data)
12460
12066438d0c2 [gaim-migrate @ 14770]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12379
diff changeset
2729 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2730 webview_changed_cb(NULL, data);
12460
12066438d0c2 [gaim-migrate @ 14770]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12379
diff changeset
2731 }
12066438d0c2 [gaim-migrate @ 14770]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12379
diff changeset
2732
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2733 char *pidgin_status_box_get_message(PidginStatusBox *status_box)
10649
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2734 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
2735 if (status_box->webview_visible)
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35475
diff changeset
2736 return g_strstrip(pidgin_webview_get_body_text(PIDGIN_WEBVIEW(status_box->webview)));
10649
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2737 else
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2738 return NULL;
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2739 }

mercurial