pidgin/gtkstatusbox.c

Mon, 21 Mar 2022 20:25:43 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 21 Mar 2022 20:25:43 -0500
changeset 41306
8befd71928c2
parent 41266
64805b295a5c
child 41314
0dc72eacd8bf
permissions
-rw-r--r--

Create a new status manager that's built in glade

Behavorial Changes:

* Confirmation dialog for remove has been removed.
* Remove button is disabled if the currently selected status is the active
status. Previously this scenario was silently ignored after confirmation.

Errata:

It is possible to open multiple modify windows for a status. Previously the
editor was reaching into the manager and controlling this pointer. I was going
to fix this, but the editor isn't a widget yet and I don't like doing duplicate
work.

Testing Done:
Basically tried everything I could think of with editing and selecting and so on.

Bugs closed: PIDGIN-17590

Reviewed at https://reviews.imfreedom.org/r/1322/

40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1 /*
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
2 * Pidgin - Internet Messenger
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
4 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15885
diff changeset
5 * 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
6 * to list here. Please refer to the COPYRIGHT file distributed with this
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 * source distribution.
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 *
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * 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
11 * the Free Software Foundation; either version 2 of the License, or
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * (at your option) any later version.
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 *
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * GNU General Public License for more details.
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 *
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 */
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
23 /*
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
24 * The status box is made up of two main pieces:
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
25 * - The box that displays the current status, which is made
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
26 * of a GtkListStore ("status_box->store") and GtkCellView
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
27 * ("status_box->cell_view"). There is always exactly 1 row
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
28 * in this list store. Only the TYPE_ICON and TYPE_TEXT
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
29 * columns are used in this list store.
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
30 * - The dropdown menu that lets users select a status, which
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
31 * is made of a GtkComboBox ("status_box") and GtkListStore
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
32 * ("status_box->dropdown_store"). This dropdown is shown
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
33 * when the user clicks on the box that displays the current
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
34 * status. This list store contains one row for Available,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
35 * one row for Away, etc., a few rows for popular statuses,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
36 * and the "New..." and "Saved..." options.
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
37 */
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
38
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
39 #include <glib/gi18n-lib.h>
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
40
40496
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40484
diff changeset
41 #include <gtk/gtk.h>
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40484
diff changeset
42
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
43 #include <gdk/gdkkeysyms.h>
18273
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18261
diff changeset
44
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40315
diff changeset
45 #include <purple.h>
11627
07feb58977aa [gaim-migrate @ 13902]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11593
diff changeset
46
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
47 #include "gtksavedstatuses.h"
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
48 #include "gtkstatusbox.h"
12080
2aaca2265a51 [gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12076
diff changeset
49 #include "gtkutils.h"
40496
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40484
diff changeset
50 #include "pidgincore.h"
39568
f4714f1de6d0 Start cleaning up gtkutils by moving functions to individual files
Gary Kramlich <grim@reaperworld.com>
parents: 38712
diff changeset
51 #include "pidgingdkpixbuf.h"
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
52 #include "pidginiconname.h"
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
53
26753
a8dca8faae69 A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents: 25903
diff changeset
54 /* 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
55 #define TYPING_TIMEOUT 4
12309
e42cff3223a3 [gaim-migrate @ 14613]
Mark Doliner <markdoliner@pidgin.im>
parents: 12294
diff changeset
56
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
57 typedef enum {
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
58 PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
59 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE,
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
60 PIDGIN_STATUS_BOX_TYPE_POPULAR,
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
61 PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
62 PIDGIN_STATUS_BOX_TYPE_CUSTOM,
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
63 PIDGIN_STATUS_BOX_TYPE_SAVED,
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
64 PIDGIN_STATUS_BOX_NUM_TYPES
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
65 } PidginStatusBoxItemType;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
66
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
67 struct _PidginStatusBox {
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
68 GtkContainer parent_instance;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
69
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
70 /*< public >*/
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
71 GtkListStore *store;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
72 GtkListStore *dropdown_store;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
73
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
74 PurpleAccount *account;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
75
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
76 PurpleAccount *token_status_account;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
77
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
78 GtkWidget *vbox;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
79 gboolean editor_visible;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
80 GtkWidget *editor;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
81 GtkWidget *input;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
82 GtkTextBuffer *buffer;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
83
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
84 GdkCursor *hand_cursor;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
85 GdkCursor *arrow_cursor;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
86 int icon_size;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
87 gboolean icon_opaque;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
88
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
89
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
90 GtkWidget *cell_view;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
91 GtkCellRenderer *icon_rend;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
92 GtkCellRenderer *text_rend;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
93
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
94 GdkPixbuf *error_pixbuf;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
95
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
96 gboolean network_available;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
97 gboolean connecting;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
98
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
99 GtkTreeIter iter;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
100 char *error;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
101
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
102 /*
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
103 * These widgets are made for renderin'
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
104 * That's just what they'll do
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
105 * One of these days these widgets
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
106 * Are gonna render all over you
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
107 */
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
108 GtkWidget *hbox;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
109 GtkWidget *toggle_button;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
110 GtkWidget *vsep;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
111 GtkWidget *arrow;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
112
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
113 GtkWidget *popup_window;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
114 GtkWidget *popup_frame;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
115 GtkWidget *scrolled_window;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
116 GtkWidget *cell_view_frame;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
117 GtkTreeViewColumn *column;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
118 GtkWidget *tree_view;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
119 gboolean popup_in_progress;
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
120 GtkTreeRowReference *active_row;
41228
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
121
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
122 GList *connections_in_progress;
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
123 };
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
124
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
125 static void pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
126 static void pidgin_status_box_add_separator(PidginStatusBox *status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
127 static void pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
128 static void activate_currently_selected_status(PidginStatusBox *status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
129
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
130 static void update_size (PidginStatusBox *box);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
131 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
132 static PurpleAccount* check_active_accounts_for_identical_statuses(void);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
133
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
134 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
135 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
136 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
137 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
138 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
139 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
140 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
141 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
142 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
143 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
144 static void pidgin_status_box_popdown(PidginStatusBox *box, GdkEvent *event);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
145
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
146 enum {
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
147 /* A PidginStatusBoxItemType */
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
148 TYPE_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
149
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
150 /* This is the icon-name for the icon. */
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
151 ICON_NAME_COLUMN,
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
152
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
153 /*
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
154 * This is a GdkPixbuf (the other columns are strings).
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
155 * This column is visible.
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
156 */
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
157 ICON_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
158
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
159 /* 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
160 TEXT_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
161
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
162 /* The plain-English title of this item */
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
163 TITLE_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
164
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
165 /* A plain-English description of this item */
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
166 DESC_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
167
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
168 /*
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
169 * This value depends on TYPE_COLUMN. For POPULAR types,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
170 * 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
171 * this is the PurpleStatusPrimitive.
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
172 */
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
173 DATA_COLUMN,
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
174
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
175 /*
22086
6594853346a3 Show the prpl icon in the account-specific statusboxes to avoid ambiguity.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22032
diff changeset
176 * This column stores the GdkPixbuf for the status emblem. Currently only 'saved' is stored.
41003
9b97fe2dcdac Remove the direct usage of GtkStock
Gary Kramlich <grim@reaperworld.com>
parents: 40705
diff changeset
177 * In the GtkTreeModel for the dropdown, this is the icon-name (gchararray), and for the
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
178 * 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
179 * (GdkPixbuf) of the account.
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
180 */
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
181 EMBLEM_COLUMN,
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
182
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
183 /*
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
184 * 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
185 */
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
186 EMBLEM_VISIBLE_COLUMN,
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
187
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
188 NUM_COLUMNS
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
189 };
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
190
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
191 enum {
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
192 PROP_0,
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
193 PROP_ACCOUNT,
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
194 };
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
195
26886
e071638184b6 Don't expose the parent class.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26885
diff changeset
196 static GtkContainerClass *parent_class = NULL;
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
197
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
198 static void pidgin_status_box_class_init (PidginStatusBoxClass *klass);
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
199 static void pidgin_status_box_init (PidginStatusBox *status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
200
40505
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
201 static void
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
202 pidgin_status_box_network_changed_cb(GNetworkMonitor *m, gboolean available,
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
203 gpointer data)
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
204 {
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
205 pidgin_status_box_set_network_available(PIDGIN_STATUS_BOX(data), available);
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
206 }
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
207
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
208 GType
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
209 pidgin_status_box_get_type (void)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
210 {
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
211 static GType status_box_type = 0;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
212
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
213 if (!status_box_type)
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
214 {
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
215 static const GTypeInfo status_box_info =
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
216 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
217 sizeof (PidginStatusBoxClass),
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
218 NULL, /* base_init */
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
219 NULL, /* base_finalize */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
220 (GClassInitFunc) pidgin_status_box_class_init,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
221 NULL, /* class_finalize */
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
222 NULL, /* class_data */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
223 sizeof (PidginStatusBox),
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
224 0,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
225 (GInstanceInitFunc) pidgin_status_box_init,
12221
49832990a0a4 [gaim-migrate @ 14523]
Richard Laager <rlaager@pidgin.im>
parents: 12125
diff changeset
226 NULL /* value_table */
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
227 };
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
229 status_box_type = g_type_register_static(GTK_TYPE_CONTAINER,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
230 "PidginStatusBox",
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
231 &status_box_info,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
232 0);
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
233 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
234
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
235 return status_box_type;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
236 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
237
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
238 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
239 pidgin_status_box_get_property(GObject *object, guint param_id,
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
240 GValue *value, GParamSpec *psec)
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
241 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
242 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(object);
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
243
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
244 switch (param_id) {
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
245 case PROP_ACCOUNT:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
246 g_value_set_pointer(value, statusbox->account);
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
247 break;
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
248 default:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
249 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, psec);
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
250 break;
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
251 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
252 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
253
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
254 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
255 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
256 {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
257 GList *l;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
258 int status_no = -1;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
259 const PurpleStatusType *statustype = NULL;
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
260 const char *message;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
261
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
262 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
263 (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
264
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
265 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
266 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
267
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
268 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
269 purple_status_type_is_independent(status_type))
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
270 continue;
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
271 status_no++;
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
272 if (statustype == status_type)
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
273 break;
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
274 }
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
275
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
276 if (status_no != -1) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
277 GtkTreePath *path;
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
278 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
279 path = gtk_tree_path_new_from_indices(status_no, -1);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
280 if (status_box->active_row)
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
281 gtk_tree_row_reference_free(status_box->active_row);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
282 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
283 gtk_tree_path_free(path);
12286
08d994091c36 [gaim-migrate @ 14590]
Etan Reisner <deryni@pidgin.im>
parents: 12275
diff changeset
284
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
285 message = purple_status_get_attr_string(newstatus, "message");
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
286
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
287 if (!message || !*message)
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
288 {
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
289 gtk_widget_hide(status_box->vbox);
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
290 status_box->editor_visible = FALSE;
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
291 }
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
292 else
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
293 {
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
294 gtk_widget_show_all(status_box->vbox);
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
295 status_box->editor_visible = TRUE;
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
296 talkatu_markup_set_html(TALKATU_BUFFER(status_box->buffer), message, -1);
12060
02c6d16cb1ec [gaim-migrate @ 14355]
Tim Ringenbach <marv@pidgin.im>
parents: 11998
diff changeset
297 }
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
298 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
299 pidgin_status_box_refresh(status_box);
11967
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
300 }
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
301 }
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
302
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
303 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
304 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
305 {
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
306 if (status_box->account == account)
d64971fce9a4 [gaim-migrate @ 14259]
Tim Ringenbach <marv@pidgin.im>
parents: 11960
diff changeset
307 update_to_reflect_account_status(status_box, account, newstatus);
14804
8c79ca123c25 [gaim-migrate @ 17499]
Daniel Atallah <datallah@pidgin.im>
parents: 14801
diff changeset
308 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
309 status_menu_refresh_iter(status_box, TRUE);
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
310 }
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
311
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
312 static void
41228
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
313 connection_start_cb(PurpleConnection *connection, gpointer data) {
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
314 PidginStatusBox *status_box = data;
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
315
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
316 status_box->connections_in_progress =
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
317 g_list_append(status_box->connections_in_progress, connection);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
318
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
319 pidgin_status_box_set_connecting(status_box, TRUE);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
320 }
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
321
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
322 static void
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
323 connection_finish_cb(PurpleConnection *connection, gpointer data) {
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
324 PidginStatusBox *status_box = data;
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
325
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
326 status_box->connections_in_progress =
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
327 g_list_remove(status_box->connections_in_progress, connection);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
328
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
329 if(status_box->connections_in_progress == NULL) {
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
330 pidgin_status_box_set_connecting(status_box, FALSE);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
331 }
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
332 }
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
333
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
334 static void
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
335 connection_error_cb(PurpleConnection *connection, G_GNUC_UNUSED gint conn_err,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
336 G_GNUC_UNUSED const gchar *conn_message, gpointer data)
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
337 {
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
338 PidginStatusBox *status_box = data;
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
339
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
340 status_box->connections_in_progress =
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
341 g_list_remove(status_box->connections_in_progress, connection);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
342
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
343 if(status_box->connections_in_progress == NULL) {
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
344 pidgin_status_box_set_connecting(status_box, FALSE);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
345 }
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
346 }
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
347
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
348 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
349 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
350 const GValue *value, GParamSpec *pspec)
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
351 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
352 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(object);
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
353
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
354 switch (param_id) {
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
355 case PROP_ACCOUNT:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
356 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
357 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
358 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
359 else
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
360 statusbox->token_status_account = check_active_accounts_for_identical_statuses();
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
361
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
362 pidgin_status_box_regenerate(statusbox, TRUE);
12256
2ad29826207a [gaim-migrate @ 14558]
Sean Egan <seanegan@pidgin.im>
parents: 12244
diff changeset
363
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
364 break;
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
365 default:
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
366 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
367 break;
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
368 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
369 }
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
370
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
371 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
372 pidgin_status_box_finalize(GObject *obj)
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
373 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
374 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(obj);
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
375
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
376 purple_signals_disconnect_by_handle(statusbox);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
377 purple_prefs_disconnect_by_handle(statusbox);
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
378
22305
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
379 if (statusbox->active_row)
400588b863be Fix some small leaks when destroying a statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22229
diff changeset
380 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
381
22214
e8a9916cb99e It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22104
diff changeset
382 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
383 g_object_unref(G_OBJECT(statusbox->dropdown_store));
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
384 G_OBJECT_CLASS(parent_class)->finalize(obj);
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
385 }
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
386
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
387 static GType
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
388 pidgin_status_box_child_type (GtkContainer *container)
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
389 {
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
390 return GTK_TYPE_WIDGET;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
391 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
392
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
393 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
394 pidgin_status_box_class_init (PidginStatusBoxClass *klass)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
395 {
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
396 GObjectClass *object_class;
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
397 GtkWidgetClass *widget_class;
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
398 GtkContainerClass *container_class = (GtkContainerClass*)klass;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
399
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
400 parent_class = g_type_class_peek_parent(klass);
12651
be8208c28eaa [gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents: 12634
diff changeset
401
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
402 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
403 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
404 widget_class->draw = pidgin_status_box_draw;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
405 widget_class->size_allocate = pidgin_status_box_size_allocate;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
406
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
407 container_class->child_type = pidgin_status_box_child_type;
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
408 container_class->forall = pidgin_status_box_forall;
14234
813897ffbdaf [gaim-migrate @ 16822]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14217
diff changeset
409 container_class->remove = NULL;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
410
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
411 object_class = (GObjectClass *)klass;
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
412
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
413 object_class->finalize = pidgin_status_box_finalize;
12379
c8d19d5bf238 [gaim-migrate @ 14683]
Daniel Atallah <datallah@pidgin.im>
parents: 12320
diff changeset
414
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
415 object_class->get_property = pidgin_status_box_get_property;
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
416 object_class->set_property = pidgin_status_box_set_property;
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
417
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
418 g_object_class_install_property(object_class,
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
419 PROP_ACCOUNT,
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
420 g_param_spec_pointer("account",
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
421 "Account",
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
422 "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
423 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
424 )
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
425 );
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
426 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
427
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
428 /*
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
429 * 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
430 * 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
431 * should modify status_box->store
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
432 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
433 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
434 pidgin_status_box_refresh(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
435 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
436 PurpleSavedStatus *saved_status;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
437 char *primary, *secondary, *text;
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
438 const char *icon_name = NULL;
26885
01b6646e42e4 Use stock-ids for connecting/typing animations in the statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26882
diff changeset
439 GdkPixbuf *emblem = NULL;
10702
55a43c79fd6f [gaim-migrate @ 12284]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10672
diff changeset
440 GtkTreePath *path;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
441 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
442 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
443
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
444 saved_status = purple_savedstatus_get_current();
13122
85136c011157 [gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents: 13112
diff changeset
445
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
446 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
447 && purple_savedstatus_is_transient(saved_status)))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
448 account_status = TRUE;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
449
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
450 /* Primary */
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
451 if (account_status)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
452 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
453 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
454 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
455 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
456 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
457
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
458 /* Secondary */
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
459 if (status_box->connecting)
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
460 secondary = g_strdup(_("Connecting"));
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
461 else if (!status_box->network_available)
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
462 secondary = g_strdup(_("Waiting for network connection"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
463 else if (purple_savedstatus_is_transient(saved_status))
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
464 secondary = NULL;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
465 else
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
466 {
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
467 const char *message;
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
468 char *tmp;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
469 message = purple_savedstatus_get_message(saved_status);
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
470 if (message != NULL)
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
471 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
472 tmp = purple_markup_strip_html(message);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
473 purple_util_chrreplace(tmp, '\n', ' ');
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
474 secondary = g_markup_escape_text(tmp, -1);
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
475 g_free(tmp);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
476 }
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
477 else
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
478 secondary = NULL;
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
479 }
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
480
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
481 /* Pixbuf */
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
482 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
483 PurpleStatusType *status_type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
484 PurpleStatusPrimitive prim;
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
485 if (account_status) {
34855
9c289149eed4 Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents: 34225
diff changeset
486 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
487 prim = purple_status_type_get_primitive(status_type);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
488 } 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
489 prim = purple_savedstatus_get_primitive_type(saved_status);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
490 }
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
491
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
492 icon_name = pidgin_icon_name_from_status_primitive(prim, "user-offline");
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
493 }
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
494
13122
85136c011157 [gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents: 13112
diff changeset
495 if (status_box->account != NULL) {
41266
64805b295a5c Remove pidgin_get_dim_grey_string
Gary Kramlich <grim@reaperworld.com>
parents: 41228
diff changeset
496 text = g_strdup_printf("%s - <span size=\"smaller\">%s</span>",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
497 purple_account_get_username(status_box->account),
41266
64805b295a5c Remove pidgin_get_dim_grey_string
Gary Kramlich <grim@reaperworld.com>
parents: 41228
diff changeset
498 secondary ? secondary : primary);
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
499 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
500 } else if (secondary != NULL) {
41266
64805b295a5c Remove pidgin_get_dim_grey_string
Gary Kramlich <grim@reaperworld.com>
parents: 41228
diff changeset
501 text = g_strdup_printf("%s<span size=\"smaller\"> - %s</span>",
64805b295a5c Remove pidgin_get_dim_grey_string
Gary Kramlich <grim@reaperworld.com>
parents: 41228
diff changeset
502 primary, secondary);
12228
448ba4f01ac6 [gaim-migrate @ 14530]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12221
diff changeset
503 } else {
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
504 text = g_strdup(primary);
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
505 }
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
506 g_free(primary);
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
507 g_free(secondary);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
508
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
509 /*
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
510 * Only two columns are used in this list store (does it
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
511 * really need to be a list store?)
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
512 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
513 gtk_list_store_set(status_box->store, &(status_box->iter),
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
514 ICON_NAME_COLUMN, icon_name,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
515 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
516 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
517 EMBLEM_VISIBLE_COLUMN, (emblem != NULL),
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
518 -1);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
519 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
520 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
521 g_object_unref(emblem);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
522
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
523 /* 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
524 path = gtk_tree_path_new_from_string("0");
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
525 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
526 gtk_tree_path_free(path);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
527
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
528 update_size(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
529 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
530
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
531 static PurpleStatusType *
39833
cd90938cd6f7 Silence various discarded const warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
532 find_status_type_by_index(PurpleAccount *account, gint active)
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
533 {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
534 GList *l = purple_account_get_status_types(account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
535 gint i;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
536
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
537 for (i = 0; l; l = l->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
538 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
539 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
540 purple_status_type_is_independent(status_type))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
541 continue;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
542
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
543 if (active == i)
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
544 return status_type;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
545 i++;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
546 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
547
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
548 return NULL;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
549 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
550
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
551 /*
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
552 * 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
553 * 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
554 * updated from somewhere other than the GtkStatusBox (from a plugin,
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
555 * 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
556 * also used when the user selects the "New..." option.
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
557 *
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
558 * 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
559 * keyboard signals instead of the changed signal?
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
560 */
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
561 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
562 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
563 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
564 PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
565 PurpleStatusPrimitive primitive;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
566 gint index;
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
567 const char *message;
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
568 GtkTreePath *path = NULL;
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
569
11983
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
570 /* this function is inappropriate for ones with accounts */
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
571 if (status_box->account)
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
572 return;
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
573
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
574 saved_status = purple_savedstatus_get_current();
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
575
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
576 /*
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
577 * Suppress the "changed" signal because the status
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
578 * was changed programmatically.
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
579 */
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
580 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
581
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
582 /*
14801
6554d4d17db8 [gaim-migrate @ 17495]
Etan Reisner <deryni@pidgin.im>
parents: 14767
diff changeset
583 * 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
584 * dropdown using a loop. Otherwise select from the default list.
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
585 */
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
586 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
587 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
588 ((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
589 (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
590 (primitive == PURPLE_STATUS_UNAVAILABLE)) &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
591 (!purple_savedstatus_has_substatuses(saved_status)))
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
592 {
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
593 index = get_statusbox_index(status_box, saved_status);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
594 path = gtk_tree_path_new_from_indices(index, -1);
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
595 }
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
596 else
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
597 {
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
598 GtkTreeIter iter;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
599 PidginStatusBoxItemType type;
13112
d2c4ff0321e1 [gaim-migrate @ 15473]
Mark Doliner <markdoliner@pidgin.im>
parents: 13099
diff changeset
600 gpointer data;
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
601
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
602 /* 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
603 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
604 {
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
605 do
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
606 {
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
607 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
608 TYPE_COLUMN, &type,
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
609 DATA_COLUMN, &data,
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
610 -1);
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
611
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
612 /* 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
613 * 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
614 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
615 && 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
616 {
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
617 char *name;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
618 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
619 purple_account_get_active_status(status_box->token_status_account));
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
620
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
621 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
622 TEXT_COLUMN, &name, -1);
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
623
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
624 if (!purple_savedstatus_has_substatuses(saved_status)
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
625 || purple_strequal(name, acct_status_name))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
626 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
627 /* Found! */
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
628 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
629 g_free(name);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
630 break;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
631 }
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
632 g_free(name);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
633
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
634 } 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
635 (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
636 {
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
637 /* Found! */
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
638 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
639 break;
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
640 }
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
641 } 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
642 }
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
643 }
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
644
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
645 if (status_box->active_row)
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
646 gtk_tree_row_reference_free(status_box->active_row);
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
647 if (path) { /* path should never be NULL */
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
648 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
649 gtk_tree_path_free(path);
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
650 } else
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
651 status_box->active_row = NULL;
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
652
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
653 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
654 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
655
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
656 /*
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
657 * If we are going to hide the editor, 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
658 * 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
659 * 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
660 * 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
661 *
d9499e1405f9 don't remember the message if we switch to a saved status (transient
Ka-Hing Cheung <khc@pidgin.im>
parents: 28751
diff changeset
662 * 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
663 * 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
664 */
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
665 gtk_widget_set_sensitive(GTK_WIDGET(status_box->input), FALSE);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
666
39609
a601304dcf51 A few cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents: 39608
diff changeset
667 talkatu_buffer_clear(TALKATU_BUFFER(status_box->buffer));
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
668
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
669 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
670 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
671 status_box->editor_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
672 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
673 }
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
674 else
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
675 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
676 status_box->editor_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
677 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
678
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
679 talkatu_markup_set_html(TALKATU_BUFFER(status_box->buffer), message, -1);
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
680 }
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
681
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
682 gtk_widget_set_sensitive(GTK_WIDGET(status_box->input), 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
683 update_size(status_box);
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
684 }
12634
943954b63b48 [gaim-migrate @ 14970]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12619
diff changeset
685
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
686 /* Stop suppressing the "changed" signal. */
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
687 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
688 }
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
689
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
690 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
691 add_popular_statuses(PidginStatusBox *statusbox)
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
692 {
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
693 GList *list, *cur;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
694
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
695 list = purple_savedstatuses_get_popular(6);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
696 if (list == NULL)
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
697 /* Odd... oh well, nothing we can do about it. */
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
698 return;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
699
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
700 pidgin_status_box_add_separator(statusbox);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
701
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
702 for (cur = list; cur != NULL; cur = cur->next)
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
703 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
704 PurpleSavedStatus *saved = cur->data;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
705 const gchar *message;
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
706 gchar *stripped = NULL;
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
707 PidginStatusBoxItemType type;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
708
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
709 if (purple_savedstatus_is_transient(saved))
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
710 {
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
711 /*
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
712 * 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
713 * API returns the message when purple_savedstatus_get_title() is
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
714 * 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
715 */
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
716 type = PIDGIN_STATUS_BOX_TYPE_POPULAR;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
717 }
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
718 else
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
719 {
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
720 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
721
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
722 message = purple_savedstatus_get_message(saved);
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
723 if (message != NULL)
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
724 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
725 stripped = purple_markup_strip_html(message);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
726 purple_util_chrreplace(stripped, '\n', ' ');
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
727 }
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
728 }
13091
b5ed878998dd [gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents: 13080
diff changeset
729
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
730 pidgin_status_box_add(statusbox, type,
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
731 NULL, purple_savedstatus_get_title(saved), stripped,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
732 GINT_TO_POINTER(purple_savedstatus_get_creation_time(saved)));
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
733 g_free(stripped);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
734 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
735
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
736 g_list_free(list);
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
737 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
738
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
739 /* This returns NULL if the active accounts don't have identical
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
740 * statuses and a token account if they do */
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
741 static
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
742 PurpleAccount *check_active_accounts_for_identical_statuses(void) {
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
743 PurpleAccountManager *manager = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
744 GList *iter, *active_accts = NULL;
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
745 PurpleAccount *acct1 = NULL;
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
746 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
747
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
748 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
749 active_accts = purple_account_manager_get_active(manager);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
750
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
751 if (active_accts) {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
752 acct1 = active_accts->data;
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
753 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
754 } else {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
755 /* 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
756 return NULL;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
757 }
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
758
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
759 /* 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
760 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
761 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
762 GList *s1, *s2;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
763
38358
30ba44276e74 Merge release-2.x.y into default
dx <dx@dxzone.com.ar>
parents: 38298 38259
diff changeset
764 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
765 acct1 = NULL;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
766 break;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
767 }
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
768
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
769 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
770 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
771 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
772 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
773 /* 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
774 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
775 || !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
776 || !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
777 acct1 = NULL;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
778 break;
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
779 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
780 }
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
781
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
782 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
783 acct1 = NULL;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
784 break;
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
785 }
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
786 }
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
787
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
788 g_list_free(active_accts);
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
789
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
790 return acct1;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
791 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
792
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
793 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
794 add_account_statuses(PidginStatusBox *status_box, PurpleAccount *account)
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
795 {
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
796 /* 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
797 GList *l;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
798
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
799 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
800 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
801 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
802 PurpleStatusPrimitive prim;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
803
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
804 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
805 purple_status_type_is_independent(status_type))
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
806 continue;
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
807
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
808 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
809
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
810 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
811 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
812 purple_status_type_get_name(status_type),
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
813 NULL,
30706
612b36b49058 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29689
diff changeset
814 GINT_TO_POINTER(prim));
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
815 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
816 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
817
18319
e5f4aef72165 disapproval of revision '146d6831fc3d1fdf025c5ae60bc4976eaed5c987'
Sean Egan <seanegan@pidgin.im>
parents: 18318
diff changeset
818 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
819 pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed)
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
820 {
12256
2ad29826207a [gaim-migrate @ 14558]
Sean Egan <seanegan@pidgin.im>
parents: 12244
diff changeset
821 /* Unset the model while clearing it */
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
822 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
823 gtk_list_store_clear(status_box->dropdown_store);
13242
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
824 /* 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
825 * 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
826 * if we do this here. */
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
827 /* 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
828
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
829 if (status_box->account == NULL)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
830 {
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
831 /* Do all the currently enabled accounts have the same statuses?
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
832 * If so, display them instead of our global list.
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
833 */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
834 if (status_box->token_status_account) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
835 add_account_statuses(status_box, status_box->token_status_account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
836 } else {
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
837 /* Global */
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
838 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
839 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
840 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
841 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
842 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
843 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
844
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
845 add_popular_statuses(status_box);
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
846
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
847 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
848 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
849 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
850
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
851 status_menu_refresh_iter(status_box, status_changed);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
852 pidgin_status_box_refresh(status_box);
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
853
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
854 } else {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
855 add_account_statuses(status_box, status_box->account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
856 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
857 purple_account_get_active_status(status_box->account));
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
858 }
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
859 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
860 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
861 }
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
862
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
863 static gboolean
39609
a601304dcf51 A few cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents: 39608
diff changeset
864 combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, G_GNUC_UNUSED gpointer data)
12827
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
865 {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
866 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
867 return TRUE;
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
868 }
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
869
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
870 static gboolean
39608
8d68fba092e7 remove a few more references to webview
Gary Kramlich <grim@reaperworld.com>
parents: 39607
diff changeset
871 editor_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box)
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
872 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
873 if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) {
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
874 activate_currently_selected_status(status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
875 pidgin_status_box_refresh(status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
876
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
877 return TRUE;
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
878 }
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
879 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
880 {
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
881 /* 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
882 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
883 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
884 (event->state & GDK_SHIFT_MASK) ?
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
885 GTK_DIR_TAB_BACKWARD: GTK_DIR_TAB_FORWARD);
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
886 return TRUE;
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
887 }
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
888
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
889 /* 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
890 if (event->keyval == GDK_KEY_Escape)
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
891 {
13832
2719e29e6e9e [gaim-migrate @ 16279]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13805
diff changeset
892 if (status_box->account != NULL)
2719e29e6e9e [gaim-migrate @ 16279]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13805
diff changeset
893 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
894 purple_account_get_active_status(status_box->account));
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
895 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
896 status_menu_refresh_iter(status_box, TRUE);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
897 pidgin_status_box_refresh(status_box);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
898 }
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
899 return TRUE;
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
900 }
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13832
diff changeset
901
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
902 return FALSE;
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
903 }
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
904
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
905 static gboolean
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
906 dropdown_store_row_separator_func(GtkTreeModel *model,
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
907 GtkTreeIter *iter, gpointer data)
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
908 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
909 PidginStatusBoxItemType type;
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
910
11885
0c447c0ced93 [gaim-migrate @ 14176]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11870
diff changeset
911 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1);
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
912
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
913 if (type == PIDGIN_STATUS_BOX_TYPE_SEPARATOR)
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
914 return TRUE;
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
915
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
916 return FALSE;
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
917 }
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
918
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
919 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
920 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
921 PurpleAccount *initial_token_acct = status_box->token_status_account;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
922
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
923 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
924 return;
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
925
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
926 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
927
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
928 /* Regenerate the list if it has changed */
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
929 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
930 pidgin_status_box_regenerate(status_box, TRUE);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
931 }
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
932
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
933 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
934
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
935 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
936 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
937 {
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
938 /* 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
939 pidgin_status_box_regenerate(status_box, TRUE);
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
940 }
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
941
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
942 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
943 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
944 {
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
945 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
946 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
947 }
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
948
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
949 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
950 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
951 {
40315
6746d9b67b3e Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents: 40264
diff changeset
952 GdkMonitor *m = NULL;
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
953 GdkRectangle monitor;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
954 GtkRequisition popup_req;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
955 GtkPolicyType hpolicy, vpolicy;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
956 GtkAllocation allocation;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
957
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
958 gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
959 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
960
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
961 *x += allocation.x;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
962 *y += allocation.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
963
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
964 *width = allocation.width;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
965
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
966 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
967 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
968 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
969 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
970 NULL);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
971 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
972
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
973 if (popup_req.width > *width) {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
974 hpolicy = GTK_POLICY_ALWAYS;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
975 g_object_set(G_OBJECT(status_box->scrolled_window),
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
976 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
977 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
978 NULL);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
979 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
980 }
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
981
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
982 *height = popup_req.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
983
40315
6746d9b67b3e Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents: 40264
diff changeset
984 m = gdk_display_get_monitor_at_window(gdk_display_get_default(),
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
985 gtk_widget_get_window(GTK_WIDGET(status_box)));
40315
6746d9b67b3e Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents: 40264
diff changeset
986 gdk_monitor_get_geometry(m, &monitor);
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
987
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
988 if (*x < monitor.x)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
989 *x = monitor.x;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
990 else if (*x + *width > monitor.x + monitor.width)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
991 *x = monitor.x + monitor.width - *width;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
992
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
993 if (*y + allocation.height + *height <= monitor.y + monitor.height)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
994 *y += allocation.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
995 else if (*y - *height >= monitor.y)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
996 *y -= *height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
997 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
998 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
999 *y += allocation.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1000 *height = monitor.y + monitor.height - *y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1001 }
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1002 else
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1003 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1004 *height = *y - monitor.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1005 *y = monitor.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1006 }
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1007
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1008 if (popup_req.height > *height)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1009 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1010 vpolicy = GTK_POLICY_ALWAYS;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1011
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1012 g_object_set(G_OBJECT(status_box->scrolled_window),
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1013 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1014 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1015 NULL);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1016 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1017 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1018
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1019 static gboolean
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1020 popup_grab_on_window(GdkWindow *window, GdkEvent *event)
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1021 {
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1022 GdkSeat *seat = gdk_event_get_seat(event);
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1023 GdkGrabStatus status;
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1024
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1025 status = gdk_seat_grab(seat, window, GDK_SEAT_CAPABILITY_ALL, TRUE, NULL,
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1026 event, NULL, NULL);
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1027 if (status == GDK_GRAB_SUCCESS) {
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1028 return TRUE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1029 }
29496
8807ee3e55c5 Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28087
diff changeset
1030
8807ee3e55c5 Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28087
diff changeset
1031 return FALSE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1032 }
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1033
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1034
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1035 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1036 pidgin_status_box_popup(PidginStatusBox *box, GdkEvent *event)
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1037 {
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1038 int width, height, x, y;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1039 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
1040
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1041 gtk_widget_set_size_request (box->popup_window, width, height);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1042 gtk_window_move (GTK_WINDOW (box->popup_window), x, y);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1043 gtk_widget_show(box->popup_window);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1044 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
1045 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
1046 gtk_widget_hide (box->popup_window);
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1047 return;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1048 }
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1049 gtk_grab_add (box->popup_window);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1050 /*box->popup_in_progress = TRUE;*/
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1051 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1052 TRUE);
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1053
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1054 if (box->active_row) {
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1055 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
1056 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
1057 gtk_tree_path_free(path);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1058 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1059 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1060
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1061 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1062 pidgin_status_box_popdown(PidginStatusBox *box, GdkEvent *event)
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1063 {
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1064 GdkSeat *seat;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1065 gtk_widget_hide(box->popup_window);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1066 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
1067 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
1068 gtk_grab_remove(box->popup_window);
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1069 seat = gdk_event_get_seat(event);
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1070 gdk_seat_ungrab(seat);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1071 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1072
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1073 static gboolean
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1074 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box)
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1075 {
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1076 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
1077 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
1078 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
1079 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
1080 case GDK_KEY_space:
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1081 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
1082 pidgin_status_box_popup(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1083 box->popup_in_progress = TRUE;
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1084 } else {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1085 pidgin_status_box_popdown(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1086 }
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1087 return TRUE;
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1088 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
1089 return FALSE;
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1090 }
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1091 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1092
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1093 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
1094 toggled_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1095 {
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1096 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
1097 pidgin_status_box_popup(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1098 else
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1099 pidgin_status_box_popdown(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1100 return TRUE;
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1101 }
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1102
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1103 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1104 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
1105 {
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1106 if (status_box->active_row)
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1107 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
1108
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1109 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
1110 pidgin_status_box_popdown(status_box, event);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1111 pidgin_status_box_changed(status_box);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1112 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1113
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
1114 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
1115 {
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
1116 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
1117
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
1118 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
1119 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
1120
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
1121 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
1122 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
1123 }
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
1124
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
1125 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1126 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
1127 {
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
1128 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
1129 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
1130 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
1131 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
1132
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
1133 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
1134 /* 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
1135 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
1136 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
1137 }
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
1138
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
1139 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
1140 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
1141
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
1142 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
1143 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
1144 -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
1145
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
1146 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
1147 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
1148 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
1149 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
1150
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
1151 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
1152
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1153 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
1154 NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1155 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
1156 _("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
1157 _("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
1158
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
1159 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
1160
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1161 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
1162 }
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
1163
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1164 static gboolean
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1165 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
1166 {
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1167 GtkTreePath *path = NULL;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1168 int ret;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1169 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
1170
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1171 if (ewidget != status_box->tree_view) {
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1172 if (ewidget == status_box->toggle_button &&
15176
44bc99559266 [gaim-migrate @ 17900]
Sean Egan <seanegan@pidgin.im>
parents: 15174
diff changeset
1173 status_box->popup_in_progress &&
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1174 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
1175 pidgin_status_box_popdown(status_box, (GdkEvent *)event);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1176 return TRUE;
19659
acdd4962bf80 Allow you to click on statusbox again and keep it open.
Sean Egan <seanegan@pidgin.im>
parents: 19576
diff changeset
1177 } else if (ewidget == status_box->toggle_button) {
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24508
diff changeset
1178 status_box->popup_in_progress = TRUE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1179 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1180
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1181 /* 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
1182 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
1183 pidgin_status_box_popdown(status_box, (GdkEvent *)event);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1184 return TRUE;
19659
acdd4962bf80 Allow you to click on statusbox again and keep it open.
Sean Egan <seanegan@pidgin.im>
parents: 19576
diff changeset
1185 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1186
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1187 return FALSE;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1188 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1189
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1190 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
1191 event->x, event->y,
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1192 &path,
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1193 NULL, NULL, NULL);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1194
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1195 if (!ret)
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1196 return TRUE; /* clicked outside window? */
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1197
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1198 treeview_activate_current_selection(status_box, path, (GdkEvent *)event);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1199 gtk_tree_path_free (path);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1200
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1201 return TRUE;
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1202 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1203
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1204 static gboolean
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1205 treeview_key_press_event(GtkWidget *widget,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1206 GdkEventKey *event, PidginStatusBox *box)
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1207 {
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1208 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
1209 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
1210 pidgin_status_box_popdown(box, (GdkEvent *)event);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1211 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
1212 } else {
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1213 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
1214 GtkTreeIter iter;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1215 GtkTreePath *path;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1216
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1217 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
1218 gboolean ret = TRUE;
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1219 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
1220 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
1221 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
1222 } 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
1223 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
1224 } else
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1225 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
1226
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1227 gtk_tree_path_free (path);
18259
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1228 return ret;
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1229 }
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24508
diff changeset
1230 }
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1231 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1232 return FALSE;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1233 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1234
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1235 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
1236 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
1237 {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1238 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
1239 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
1240 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
1241 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
1242 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
1243 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
1244
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1245 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
1246 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
1247 /* 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
1248 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1249 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1250 } else {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1251 /* 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
1252 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1253 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1254
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1255 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
1256 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
1257 /* 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
1258 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
1259 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1260 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1261
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1262 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
1263 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
1264 /* 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
1265 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
1266 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
1267 } 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
1268 /* 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
1269 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
1270 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
1271 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1272
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1273 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
1274 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
1275 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1276
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1277 static void
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1278 pidgin_status_box_buffer_changed_cb(GtkTextBuffer *buffer, gpointer data) {
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1279 PidginStatusBox *status_box = (PidginStatusBox*)data;
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1280
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1281 pidgin_status_box_refresh(status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1282 }
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1283
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1284 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1285 pidgin_status_box_init (PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1286 {
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1287 GNetworkMonitor *monitor = NULL;
11400
be2052efada5 [gaim-migrate @ 13635]
Will Thompson <resiak@pidgin.im>
parents: 11347
diff changeset
1288 GtkCellRenderer *text_rend;
be2052efada5 [gaim-migrate @ 13635]
Will Thompson <resiak@pidgin.im>
parents: 11347
diff changeset
1289 GtkCellRenderer *icon_rend;
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1290 GtkCellRenderer *emblem_rend;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1291 GtkWidget *toplevel;
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1292 GtkTreeSelection *sel;
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1293 gboolean network_available = FALSE;
41228
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1294 gpointer handle;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1295
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
1296 gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE);
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1297 status_box->editor_visible = FALSE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1298 status_box->network_available = purple_network_is_available();
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1299 status_box->connecting = FALSE;
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1300 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
1301 status_box->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1302 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
1303 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
1304 status_box->arrow = gtk_image_new_from_icon_name("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1305
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1306 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
1307 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
1308 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
1309 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
1310
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1311 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
1312 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
1313
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
1314 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
1315
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1316 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
1317 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
1318 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
1319 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
1320 gtk_widget_show_all(status_box->toggle_button);
39946
f1b741397c35 Replace deprecated gtk_button_set_focus_on_click.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39945
diff changeset
1321 gtk_widget_set_focus_on_click(status_box->toggle_button, FALSE);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1322
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1323 text_rend = gtk_cell_renderer_text_new();
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1324 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
1325 emblem_rend = gtk_cell_renderer_pixbuf_new();
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1326 status_box->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1327
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1328 toplevel = gtk_widget_get_toplevel (GTK_WIDGET (status_box));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1329 if (GTK_IS_WINDOW (toplevel)) {
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1330 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
1331 GTK_WINDOW (toplevel));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1332 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1333
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1334 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
1335 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
1336 GDK_WINDOW_TYPE_HINT_POPUP_MENU);
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1337 gtk_window_set_screen (GTK_WINDOW (status_box->popup_window),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1338 gtk_widget_get_screen (GTK_WIDGET (status_box)));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1339 status_box->popup_frame = gtk_frame_new (NULL);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1340 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
1341 GTK_SHADOW_ETCHED_IN);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1342 gtk_container_add (GTK_CONTAINER (status_box->popup_window),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1343 status_box->popup_frame);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1344
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1345 gtk_widget_show (status_box->popup_frame);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1346
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1347 status_box->tree_view = gtk_tree_view_new ();
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1348 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
1349 gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1350 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
1351 FALSE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1352 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
1353 TRUE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1354 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
1355 GTK_TREE_MODEL(status_box->dropdown_store));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1356 status_box->column = gtk_tree_view_column_new ();
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1357 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
1358 status_box->column);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1359 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
1360 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
1361 gtk_tree_view_column_pack_start(status_box->column, emblem_rend, FALSE);
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
1362 gtk_tree_view_column_set_attributes(status_box->column, icon_rend, "icon-name", ICON_NAME_COLUMN, NULL);
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1363 gtk_tree_view_column_set_attributes(status_box->column, text_rend, "markup", TEXT_COLUMN, NULL);
41003
9b97fe2dcdac Remove the direct usage of GtkStock
Gary Kramlich <grim@reaperworld.com>
parents: 40705
diff changeset
1364 gtk_tree_view_column_set_attributes(status_box->column, emblem_rend, "icon-name", 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
1365
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
1366 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
1367 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
1368 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
1369
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1370 gtk_widget_show(status_box->tree_view);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1371 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
1372 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
1373 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
1374
13045
75f38f58edde [gaim-migrate @ 15404]
Mark Doliner <markdoliner@pidgin.im>
parents: 13044
diff changeset
1375 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1376
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1377 status_box->icon_rend = gtk_cell_renderer_pixbuf_new();
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1378 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
1379 emblem_rend = gtk_cell_renderer_pixbuf_new();
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
1380 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
1381 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
1382 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), emblem_rend, FALSE);
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
1383 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "icon-name", ICON_NAME_COLUMN, NULL);
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
1384 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
1385 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
1386 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
1387
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35500
diff changeset
1388 status_box->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, FALSE);
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1389 status_box->editor = talkatu_editor_new();
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
1390 status_box->input = talkatu_editor_get_input(TALKATU_EDITOR(status_box->editor));
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1391
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1392 status_box->buffer = talkatu_html_buffer_new();
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
1393 gtk_text_view_set_buffer(GTK_TEXT_VIEW(status_box->input), status_box->buffer);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1394
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1395 g_signal_connect(G_OBJECT(status_box->buffer), "changed",
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1396 G_CALLBACK(pidgin_status_box_buffer_changed_cb),
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1397 status_box);
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1398
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1399 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
1400 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
1401 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
1402 G_CALLBACK(toggled_cb), status_box);
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
1403 g_signal_connect(G_OBJECT(status_box->input), "key-press-event",
39608
8d68fba092e7 remove a few more references to webview
Gary Kramlich <grim@reaperworld.com>
parents: 39607
diff changeset
1404 G_CALLBACK(editor_remove_focus), status_box);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1405
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1406 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
1407 gtk_widget_show_all(status_box->vbox);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1408
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1409 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
1410
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1411 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->editor, TRUE, TRUE, 0);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1412
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1413 g_signal_connect(G_OBJECT(status_box), "scroll-event", G_CALLBACK(combo_box_scroll_event_cb), NULL);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1414 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
1415 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
1416 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
1417 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
1418
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1419 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
1420
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1421 status_box->token_status_account = check_active_accounts_for_identical_statuses();
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1422
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1423 pidgin_status_box_regenerate(status_box, TRUE);
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1424
41228
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1425 handle = purple_savedstatuses_get_handle();
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1426 purple_signal_connect(handle, "savedstatus-changed", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1427 PURPLE_CALLBACK(current_savedstatus_changed_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1428 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1429 purple_signal_connect(handle, "savedstatus-added", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1430 PURPLE_CALLBACK(saved_status_updated_cb), status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1431 purple_signal_connect(handle, "savedstatus-deleted", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1432 PURPLE_CALLBACK(saved_status_updated_cb), status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1433 purple_signal_connect(handle, "savedstatus-modified", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1434 PURPLE_CALLBACK(saved_status_updated_cb), status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1435
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1436 handle = purple_accounts_get_handle();
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1437 purple_signal_connect(handle, "account-enabled", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1438 PURPLE_CALLBACK(account_enabled_cb), status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1439 purple_signal_connect(handle, "account-disabled", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1440 PURPLE_CALLBACK(account_enabled_cb), status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1441 purple_signal_connect(handle, "account-status-changed", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1442 PURPLE_CALLBACK(account_status_changed_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1443 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1444
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1445 handle = purple_connections_get_handle();
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1446 purple_signal_connect(handle, "signing-on", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1447 PURPLE_CALLBACK(connection_start_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1448 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1449 purple_signal_connect(handle, "signed-on", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1450 PURPLE_CALLBACK(connection_finish_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1451 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1452 purple_signal_connect(handle, "signing-off", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1453 PURPLE_CALLBACK(connection_finish_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1454 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1455 purple_signal_connect(handle, "connection-error", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1456 PURPLE_CALLBACK(connection_error_cb), status_box);
14804
8c79ca123c25 [gaim-migrate @ 17499]
Daniel Atallah <datallah@pidgin.im>
parents: 14801
diff changeset
1457
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1458 monitor = g_network_monitor_get_default();
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1459 g_signal_connect(G_OBJECT(monitor), "network-changed",
40505
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
1460 G_CALLBACK(pidgin_status_box_network_changed_cb),
e2c4be9e3aa6 fix some issues that were identified while working on a flatpak build
Gary Kramlich <grim@reaperworld.com>
parents: 40504
diff changeset
1461 status_box);
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1462 network_available = g_network_monitor_get_network_available(monitor);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1463 pidgin_status_box_set_network_available(status_box, network_available);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1464 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1465
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1466 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
1467 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
1468 gint *natural_height)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1469 {
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
1470 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
1471 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
1472
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
1473 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
1474 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
1475
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
1476 *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
1477 *natural_height = MAX(*natural_height, 34) + border_width * 2;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1478
39608
8d68fba092e7 remove a few more references to webview
Gary Kramlich <grim@reaperworld.com>
parents: 39607
diff changeset
1479 /* If the editor is visible, then add some additional padding */
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1480 if (PIDGIN_STATUS_BOX(widget)->editor_visible) {
33152
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1481 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
1482 &box_min_height, &box_nat_height);
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1483
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1484 if (box_min_height > 1)
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1485 *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
1486
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1487 if (box_nat_height > 1)
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1488 *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
1489 }
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1490 }
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1491
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1492 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1493 pidgin_status_box_size_allocate(GtkWidget *widget,
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1494 GtkAllocation *allocation)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1495 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1496 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1497 GtkRequisition req = {0,0};
40676
50284e37698c Remove the icon from the statusbox. I'm not sure exactly how this will work in the future, but we'll tackle it much differently when we're ready to bring it back.
Gary Kramlich <grim@reaperworld.com>
parents: 40505
diff changeset
1498 GtkAllocation parent_alc, box_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
1499 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
1500
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
1501 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
1502 /* 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
1503
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1504 req.height = MAX(req.height, 34);
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1505 req.height += border_width * 2;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1506
13065
6ad1cf73ad6b [gaim-migrate @ 15427]
Mark Doliner <markdoliner@pidgin.im>
parents: 13062
diff changeset
1507 box_alc = *allocation;
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
1508
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1509 box_alc.width -= (border_width * 2);
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1510 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
1511 box_alc.x += border_width;
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1512 box_alc.y += req.height + border_width;
15180
7ed2edcb163b [gaim-migrate @ 17904]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15177
diff changeset
1513 gtk_widget_size_allocate(status_box->vbox, &box_alc);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1514
13065
6ad1cf73ad6b [gaim-migrate @ 15427]
Mark Doliner <markdoliner@pidgin.im>
parents: 13062
diff changeset
1515 parent_alc = *allocation;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1516 parent_alc.height = MAX(1,req.height - (border_width *2));
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1517 parent_alc.width -= (border_width * 2);
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1518 parent_alc.x += border_width;
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1519 parent_alc.y += border_width;
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1520
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1521 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
1522 gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1523 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1524
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1525 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
1526 pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1527 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1528 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
1529 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
1530
37618
33e0bc920834 Fix status box drawing
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37424
diff changeset
1531 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
1532
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1533 return FALSE;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1534 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1535
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1536 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1537 pidgin_status_box_forall(GtkContainer *container,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1538 gboolean include_internals,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1539 GtkCallback callback,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1540 gpointer callback_data)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1541 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1542 PidginStatusBox *status_box = PIDGIN_STATUS_BOX (container);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1543
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1544 if (include_internals)
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1545 {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1546 (* callback) (status_box->vbox, callback_data);
12275
c9b030c5819c [gaim-migrate @ 14579]
Sean Egan <seanegan@pidgin.im>
parents: 12274
diff changeset
1547 (* callback) (status_box->toggle_button, callback_data);
c9b030c5819c [gaim-migrate @ 14579]
Sean Egan <seanegan@pidgin.im>
parents: 12274
diff changeset
1548 (* callback) (status_box->arrow, callback_data);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1549 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1550 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1551
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1552 GtkWidget *
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1553 pidgin_status_box_new()
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1554 {
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1555 return g_object_new(PIDGIN_TYPE_STATUS_BOX, "account", NULL, NULL);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1556 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1557
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
1558 GtkWidget *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1559 pidgin_status_box_new_with_account(PurpleAccount *account)
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
1560 {
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1561 return g_object_new(PIDGIN_TYPE_STATUS_BOX, "account", account, NULL);
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
1562 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1563
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1564 /*
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1565 * pidgin_status_box_add:
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1566 * @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
1567 * @type: A PidginStatusBoxItemType.
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1568 * @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
1569 * 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
1570 * @title: The title of this item. For the primitive entries,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1571 * this is something like "Available" or "Away." For
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1572 * the saved statuses, this is something like
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1573 * "My favorite away message!" This should be
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1574 * 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
1575 * @desc: The secondary text for this item. This will be
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1576 * placed on the row below the title, in a dimmer
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1577 * font (generally gray). This text should be plaintext
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1578 * (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
1579 * @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
1580 * 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
1581 * PurpleStatusPrimitive. For saved statuses this is the
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1582 * creation timestamp.
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1583 *
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1584 * Add a row to the dropdown menu.
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1585 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1586 void
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1587 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
1588 const char *title, const char *desc, gpointer data)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1589 {
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1590 GtkTreeIter iter;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1591 char *text;
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
1592 const char *icon_name = NULL;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1593
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1594 if (desc == NULL)
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1595 {
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1596 text = g_markup_escape_text(title, -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1597 }
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1598 else
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1599 {
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1600 gchar *escaped_title, *escaped_desc;
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1601
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1602 escaped_title = g_markup_escape_text(title, -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1603 escaped_desc = g_markup_escape_text(desc, -1);
41266
64805b295a5c Remove pidgin_get_dim_grey_string
Gary Kramlich <grim@reaperworld.com>
parents: 41228
diff changeset
1604 text = g_strdup_printf("%s - <span size=\"smaller\">%s</span>",
64805b295a5c Remove pidgin_get_dim_grey_string
Gary Kramlich <grim@reaperworld.com>
parents: 41228
diff changeset
1605 escaped_title, escaped_desc);
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1606 g_free(escaped_title);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1607 g_free(escaped_desc);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1608 }
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1609
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1610 if (!pixbuf) {
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1611 PurpleStatusPrimitive prim = PURPLE_STATUS_UNSET;
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1612 if (type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE) {
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1613 prim = GPOINTER_TO_INT(data);
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1614 } else if (type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR ||
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1615 type == PIDGIN_STATUS_BOX_TYPE_POPULAR) {
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1616 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
1617 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
1618 prim = purple_savedstatus_get_primitive_type(saved);
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1619 }
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1620 }
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1621
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
1622 icon_name = pidgin_icon_name_from_status_primitive(prim, "user-offline");
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1623 }
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1624
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1625 gtk_list_store_append(status_box->dropdown_store, &iter);
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1626 gtk_list_store_set(status_box->dropdown_store, &iter,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1627 TYPE_COLUMN, type,
41065
b46de1b53654 Convert the status box to use icon names instead of stock IDs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41003
diff changeset
1628 ICON_NAME_COLUMN, icon_name,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1629 TEXT_COLUMN, text,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1630 TITLE_COLUMN, title,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1631 DESC_COLUMN, desc,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1632 DATA_COLUMN, data,
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1633 EMBLEM_VISIBLE_COLUMN, type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
41003
9b97fe2dcdac Remove the direct usage of GtkStock
Gary Kramlich <grim@reaperworld.com>
parents: 40705
diff changeset
1634 EMBLEM_COLUMN, "document-save",
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1635 -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1636 g_free(text);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1637 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1638
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1639 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1640 pidgin_status_box_add_separator(PidginStatusBox *status_box)
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1641 {
11756
c1b8045e540a [gaim-migrate @ 14047]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11755
diff changeset
1642 /* Don't do anything unless GTK actually supports
c1b8045e540a [gaim-migrate @ 14047]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11755
diff changeset
1643 * gtk_combo_box_set_row_separator_func */
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1644 GtkTreeIter iter;
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1645
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1646 gtk_list_store_append(status_box->dropdown_store, &iter);
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1647 gtk_list_store_set(status_box->dropdown_store, &iter,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1648 TYPE_COLUMN, PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1649 -1);
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1650 }
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1651
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1652 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1653 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
1654 {
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1655 if (!status_box)
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1656 return;
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1657 status_box->network_available = available;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1658 pidgin_status_box_refresh(status_box);
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1659 }
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1660
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1661 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1662 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1663 {
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1664 if (!status_box)
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1665 return;
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1666 status_box->connecting = connecting;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1667 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1668 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1669
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1670 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1671 activate_currently_selected_status(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1672 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1673 PidginStatusBoxItemType type;
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1674 gpointer data;
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1675 gchar *title;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1676 GtkTreeIter iter;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1677 GtkTreePath *path;
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1678 char *message;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1679 PurpleSavedStatus *saved_status = NULL;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1680 gboolean changed = TRUE;
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1681
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1682 path = gtk_tree_row_reference_get_path(status_box->active_row);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1683 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
1684 return;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1685 gtk_tree_path_free(path);
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1686
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1687 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
1688 TYPE_COLUMN, &type,
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1689 DATA_COLUMN, &data,
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1690 -1);
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1691
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1692 /*
13025
824f4aef4e33 [gaim-migrate @ 15378]
Mark Doliner <markdoliner@pidgin.im>
parents: 13023
diff changeset
1693 * If the currently selected status is "New..." or
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1694 * "Saved..." or a popular status then do nothing.
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
1695 * Popular statuses are
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1696 * activated elsewhere, and we update the status_box
14190
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
1697 * accordingly by connecting to the savedstatus-changed
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
1698 * signal and then calling status_menu_refresh_iter()
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1699 */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1700 if (type != PIDGIN_STATUS_BOX_TYPE_PRIMITIVE)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1701 return;
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1702
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1703 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
1704 TITLE_COLUMN, &title, -1);
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1705
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1706 message = pidgin_status_box_get_message(status_box);
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1707 if (!message || !*message)
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1708 {
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
1709 gtk_widget_hide(status_box->vbox);
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1710 status_box->editor_visible = FALSE;
37424
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
1711 g_free(message);
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
1712 message = NULL;
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1713 }
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1714
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1715 if (status_box->account == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1716 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
1717 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
1718 PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1719 /* Global */
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1720 /* Save the newly selected status to prefs.xml and status.xml */
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1721
13112
d2c4ff0321e1 [gaim-migrate @ 15473]
Mark Doliner <markdoliner@pidgin.im>
parents: 13099
diff changeset
1722 /* Has the status really been changed? */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1723 if (status_box->token_status_account) {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1724 gint active;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1725 PurpleStatus *status;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1726 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
1727 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
1728
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1729 gtk_tree_path_free(path);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1730
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1731 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
1732
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
1733 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
1734 id = purple_status_type_get_id(acct_status_type);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1735
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 36256
diff changeset
1736 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
1737 purple_strequal(message, purple_status_get_attr_string(status, "message")))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1738 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1739 /* Selected status and previous status is the same */
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1740 PurpleSavedStatus *ss = purple_savedstatus_get_current();
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1741 /* Make sure that statusbox displays the correct thing.
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1742 * 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
1743 * 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
1744 if ((purple_savedstatus_get_primitive_type(ss) == primitive)
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1745 && purple_savedstatus_is_transient(ss)
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1746 && purple_savedstatus_has_substatuses(ss))
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1747 changed = FALSE;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1748 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1749 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1750 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
1751 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
1752 !purple_savedstatus_has_substatuses(saved_status) &&
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1753 purple_strequal(purple_savedstatus_get_message(saved_status), message))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1754 {
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1755 changed = FALSE;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1756 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1757 }
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1758
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1759 if (changed)
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1760 {
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
1761 /* Manually find the appropriate transient status */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1762 if (status_box->token_status_account) {
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1763 PurpleAccountManager *manager = NULL;
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
1764 GList *iter = purple_savedstatuses_get_all();
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1765 GList *active_accts = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1766
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1767 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1768 active_accts = purple_account_manager_get_active(manager);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1769
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1770 for (; iter != NULL; iter = iter->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1771 PurpleSavedStatus *ss = iter->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1772 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
1773 /* 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
1774 * 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
1775 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
1776 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
1777 purple_strequal(ss_msg, message))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1778 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1779 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
1780 /* this status must have substatuses for all the active accts */
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1781 while(active_accts != NULL) {
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1782 PurpleAccount *acct = active_accts->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1783 PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1784 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
1785 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
1786 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
1787 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
1788 if (purple_strequal(subtype_status_id, id)) {
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1789 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
1790 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
1791 }
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1792 }
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1793
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1794 active_accts = g_list_delete_link(active_accts,
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1795 active_accts);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1796 }
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
1797
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
1798 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
1799 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
1800 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
1801 }
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1802 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1803 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1804
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1805 g_list_free(active_accts);
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1806
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1807 } else {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1808 /* 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
1809 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
1810 }
13012
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
1811
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
1812 /* If this type+message is unique then create a new transient saved status */
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1813 if(saved_status == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1814 saved_status = purple_savedstatus_new(NULL, primitive);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1815 purple_savedstatus_set_message(saved_status, message);
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1816
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1817 if (status_box->token_status_account) {
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1818 PurpleAccountManager *manager = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1819 GList *active_accts = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1820
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1821 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1822 active_accts = purple_account_manager_get_active(manager);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1823
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1824 while(active_accts != NULL) {
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1825 PurpleAccount *account = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1826
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1827 account = PURPLE_ACCOUNT(active_accts->data);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1828 purple_savedstatus_set_substatus(saved_status, account,
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1829 acct_status_type,
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1830 message);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1831
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1832 active_accts = g_list_delete_link(active_accts,
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1833 active_accts);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1834 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1835 }
13012
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
1836 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1837
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1838 /* Set the status for each account */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1839 purple_savedstatus_activate(saved_status);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1840 }
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1841 } else {
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1842 /* Per-account */
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1843 gint active;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1844 PurpleStatusType *status_type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1845 PurpleStatus *status;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1846 const char *id = NULL;
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1847
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1848 status = purple_account_get_active_status(status_box->account);
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1849
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1850 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
1851
11993
b9dff0189886 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1852 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
1853 id = purple_status_type_get_id(status_type);
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1854
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 36256
diff changeset
1855 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
1856 purple_strequal(message, purple_status_get_attr_string(status, "message")))
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1857 {
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1858 /* Selected status and previous status is the same */
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1859 changed = FALSE;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1860 }
12123
a5890e156848 [gaim-migrate @ 14423]
Mark Doliner <markdoliner@pidgin.im>
parents: 12103
diff changeset
1861
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1862 if (changed)
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1863 {
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1864 if (message)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1865 purple_account_set_status(status_box->account, id,
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1866 TRUE, "message", message, NULL);
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1867 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1868 purple_account_set_status(status_box->account, id,
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1869 TRUE, NULL);
15064
da02544e8fe6 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14865
diff changeset
1870
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1871 saved_status = purple_savedstatus_get_current();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1872 if (purple_savedstatus_is_transient(saved_status))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1873 purple_savedstatus_set_substatus(saved_status, status_box->account,
15064
da02544e8fe6 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14865
diff changeset
1874 status_type, message);
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1875 }
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1876 }
11627
07feb58977aa [gaim-migrate @ 13902]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11593
diff changeset
1877
11638
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11627
diff changeset
1878 g_free(title);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1879 g_free(message);
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1880 }
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1881
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1882 static void update_size(PidginStatusBox *status_box)
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1883 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1884 if (!status_box->editor_visible)
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1885 {
12598
fd20149e7a7e [gaim-migrate @ 14928]
Richard Laager <rlaager@pidgin.im>
parents: 12597
diff changeset
1886 if (status_box->vbox != NULL)
fd20149e7a7e [gaim-migrate @ 14928]
Richard Laager <rlaager@pidgin.im>
parents: 12597
diff changeset
1887 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
1888 return;
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1889 }
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1890
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1891 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
1892 }
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1893
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1894 static void pidgin_status_box_changed(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1895 {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1896 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
1897 GtkTreeIter iter;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1898 PidginStatusBoxItemType type;
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1899 gpointer data;
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1900 GList *accounts = NULL, *node;
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1901 int active;
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1902 gboolean wastyping = FALSE;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1903
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1904
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1905 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
1906 return;
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1907 active = gtk_tree_path_get_indices(path)[0];
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1908 gtk_tree_path_free(path);
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1909 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
1910
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1911 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
1912 TYPE_COLUMN, &type,
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1913 DATA_COLUMN, &data,
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1914 -1);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1915
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
1916 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box)))
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1917 {
16426
fabd69a48567 For Luke. Fixes saved status selection
Sean Egan <seanegan@pidgin.im>
parents: 16402
diff changeset
1918 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
1919 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1920 PurpleSavedStatus *saved;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1921 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
1922 g_return_if_fail(saved != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1923 purple_savedstatus_activate(saved);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1924 return;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1925 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1926
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1927 if (type == PIDGIN_STATUS_BOX_TYPE_CUSTOM)
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1928 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1929 PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1930 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
1931 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
1932 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
1933 pidgin_status_editor_show(FALSE,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1934 purple_savedstatus_is_transient(saved_status)
13176
df549de66219 [gaim-migrate @ 15538]
Mark Doliner <markdoliner@pidgin.im>
parents: 13125
diff changeset
1935 ? saved_status : NULL);
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1936 status_menu_refresh_iter(status_box, wastyping);
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1937 if (wastyping)
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1938 pidgin_status_box_refresh(status_box);
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1939 return;
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1940 }
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1941
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1942 if (type == PIDGIN_STATUS_BOX_TYPE_SAVED)
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1943 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
1944 pidgin_status_window_show();
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1945 status_menu_refresh_iter(status_box, wastyping);
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1946 if (wastyping)
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1947 pidgin_status_box_refresh(status_box);
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1948 return;
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1949 }
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1950 }
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1951
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1952 /*
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1953 * Show the message box whenever the primitive allows for a
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1954 * message attribute on any protocol that is enabled,
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1955 * or our protocol, if we have account set
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1956 */
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1957 if(status_box->account) {
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1958 accounts = g_list_prepend(accounts, status_box->account);
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1959 } else {
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1960 PurpleAccountManager *manager = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1961
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1962 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1963
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1964 accounts = purple_account_manager_get_active(manager);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1965 }
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1966
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1967 status_box->editor_visible = FALSE;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1968 for (node = accounts; node != NULL; node = node->next)
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1969 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1970 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1971 PurpleStatusType *status_type;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1972
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1973 account = node->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1974 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
1975 if ((status_type != NULL) &&
31327
831530000b51 disapproval of revision 'c253c498a60e5a02bccb0f59d0908d1623c4307e'
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31326
diff changeset
1976 (purple_status_type_get_attr(status_type, "message") != NULL))
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1977 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1978 status_box->editor_visible = TRUE;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1979 break;
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1980 }
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1981 }
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1982 g_list_free(accounts);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1983
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
1984 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box)))
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1985 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1986 if (status_box->editor_visible)
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
1987 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1988 GtkTextIter start, end;
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1989
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
1990 gtk_widget_show_all(status_box->vbox);
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
1991 gtk_widget_grab_focus(status_box->input);
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1992
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1993 gtk_text_buffer_get_start_iter(status_box->buffer, &start);
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1994 gtk_text_buffer_get_end_iter(status_box->buffer, &end);
39609
a601304dcf51 A few cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents: 39608
diff changeset
1995 gtk_text_buffer_select_range(status_box->buffer, &start, &end);
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
1996 }
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
1997 else
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
1998 {
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
1999 gtk_widget_hide(status_box->vbox);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2000 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
2001 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2002 }
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2003 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2004 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2005
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2006 static gint
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2007 get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status)
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2008 {
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2009 gint index = -1;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2010
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
2011 switch (purple_savedstatus_get_primitive_type(saved_status))
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2012 {
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2013 /* 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
2014 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
2015 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2016 /* 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
2017 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
2018 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2019 /* 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
2020 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
2021 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2022 /* fall through */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2023 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
2024 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2025 /* 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
2026 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
2027 index++;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2028 break;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2029 default:
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2030 break;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2031 }
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2032
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2033 return index;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2034 }
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2035
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2036 char *pidgin_status_box_get_message(PidginStatusBox *status_box)
10649
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2037 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
2038 if (status_box->editor_visible)
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
2039 return g_strstrip(talkatu_markup_get_html(status_box->buffer, NULL));
10649
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2040 else
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2041 return NULL;
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2042 }

mercurial