pidgin/gtkstatusbox.c

Sun, 09 Jan 2022 12:11:21 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 09 Jan 2022 12:11:21 -0600
changeset 41240
943ba4838efc
parent 41228
cfabfc1afd50
child 41266
64805b295a5c
permissions
-rw-r--r--

Remove some deprecated accounts api

Testing Done:
Compiled and ran

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

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 {
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
436 const char *aa_color;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
437 PurpleSavedStatus *saved_status;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
438 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
439 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
440 GdkPixbuf *emblem = NULL;
10702
55a43c79fd6f [gaim-migrate @ 12284]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10672
diff changeset
441 GtkTreePath *path;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
442 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
443 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
444
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
445 saved_status = purple_savedstatus_get_current();
13122
85136c011157 [gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents: 13112
diff changeset
446
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
447 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
448 && purple_savedstatus_is_transient(saved_status)))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
449 account_status = TRUE;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
450
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
451 /* Primary */
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
452 if (account_status)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
453 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
454 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
455 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
456 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
457 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
458
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
459 /* Secondary */
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
460 if (status_box->connecting)
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
461 secondary = g_strdup(_("Connecting"));
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
462 else if (!status_box->network_available)
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
463 secondary = g_strdup(_("Waiting for network connection"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
464 else if (purple_savedstatus_is_transient(saved_status))
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
465 secondary = NULL;
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
466 else
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
467 {
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
468 const char *message;
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
469 char *tmp;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
470 message = purple_savedstatus_get_message(saved_status);
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
471 if (message != NULL)
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
472 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
473 tmp = purple_markup_strip_html(message);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
474 purple_util_chrreplace(tmp, '\n', ' ');
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
475 secondary = g_markup_escape_text(tmp, -1);
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
476 g_free(tmp);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
477 }
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
478 else
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
479 secondary = NULL;
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
480 }
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
481
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
482 /* Pixbuf */
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
483 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
484 PurpleStatusType *status_type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
485 PurpleStatusPrimitive prim;
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
486 if (account_status) {
34855
9c289149eed4 Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents: 34225
diff changeset
487 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
488 prim = purple_status_type_get_primitive(status_type);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
489 } 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
490 prim = purple_savedstatus_get_primitive_type(saved_status);
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
491 }
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
492
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
493 icon_name = pidgin_icon_name_from_status_primitive(prim, "user-offline");
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
494 }
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
495
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
496 aa_color = pidgin_get_dim_grey_string(GTK_WIDGET(status_box));
13122
85136c011157 [gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents: 13112
diff changeset
497 if (status_box->account != NULL) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
498 text = g_strdup_printf("%s - <span size=\"smaller\" color=\"%s\">%s</span>",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
499 purple_account_get_username(status_box->account),
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
500 aa_color, secondary ? secondary : primary);
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
501 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
502 } else if (secondary != NULL) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
503 text = g_strdup_printf("%s<span size=\"smaller\" color=\"%s\"> - %s</span>",
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
504 primary, aa_color, secondary);
12228
448ba4f01ac6 [gaim-migrate @ 14530]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12221
diff changeset
505 } else {
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
506 text = g_strdup(primary);
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
507 }
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
508 g_free(primary);
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
509 g_free(secondary);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
510
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
511 /*
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
512 * Only two columns are used in this list store (does it
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
513 * really need to be a list store?)
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
514 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
515 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
516 ICON_NAME_COLUMN, icon_name,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
517 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
518 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
519 EMBLEM_VISIBLE_COLUMN, (emblem != NULL),
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
520 -1);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
521 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
522 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
523 g_object_unref(emblem);
13124
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
524
1750c1be8e81 [gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents: 13123
diff changeset
525 /* 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
526 path = gtk_tree_path_new_from_string("0");
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
527 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
528 gtk_tree_path_free(path);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
529
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
530 update_size(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
531 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
532
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
533 static PurpleStatusType *
39833
cd90938cd6f7 Silence various discarded const warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39673
diff changeset
534 find_status_type_by_index(PurpleAccount *account, gint active)
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
535 {
18190
bcf28ef7e8ff Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents: 18122
diff changeset
536 GList *l = purple_account_get_status_types(account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
537 gint i;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
538
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
539 for (i = 0; l; l = l->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
540 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
541 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
542 purple_status_type_is_independent(status_type))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
543 continue;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
544
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
545 if (active == i)
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
546 return status_type;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
547 i++;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
548 }
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 return NULL;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
551 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
552
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
553 /*
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
554 * 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
555 * 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
556 * updated from somewhere other than the GtkStatusBox (from a plugin,
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
557 * 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
558 * also used when the user selects the "New..." option.
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
559 *
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
560 * 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
561 * keyboard signals instead of the changed signal?
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
562 */
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
563 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
564 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
565 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
566 PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
567 PurpleStatusPrimitive primitive;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
568 gint index;
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
569 const char *message;
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
570 GtkTreePath *path = NULL;
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
571
11983
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
572 /* this function is inappropriate for ones with accounts */
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
573 if (status_box->account)
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
574 return;
e4dde668ace7 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11981
diff changeset
575
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
576 saved_status = purple_savedstatus_get_current();
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
577
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
578 /*
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
579 * Suppress the "changed" signal because the status
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
580 * was changed programmatically.
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
581 */
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
582 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
583
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
584 /*
14801
6554d4d17db8 [gaim-migrate @ 17495]
Etan Reisner <deryni@pidgin.im>
parents: 14767
diff changeset
585 * 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
586 * dropdown using a loop. Otherwise select from the default list.
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
587 */
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
588 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
589 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
590 ((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
591 (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
592 (primitive == PURPLE_STATUS_UNAVAILABLE)) &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
593 (!purple_savedstatus_has_substatuses(saved_status)))
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
594 {
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
595 index = get_statusbox_index(status_box, saved_status);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
596 path = gtk_tree_path_new_from_indices(index, -1);
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
597 }
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
598 else
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
599 {
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
600 GtkTreeIter iter;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
601 PidginStatusBoxItemType type;
13112
d2c4ff0321e1 [gaim-migrate @ 15473]
Mark Doliner <markdoliner@pidgin.im>
parents: 13099
diff changeset
602 gpointer data;
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
603
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
604 /* 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
605 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
606 {
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
607 do
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
608 {
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
609 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
610 TYPE_COLUMN, &type,
13066
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
611 DATA_COLUMN, &data,
3e0627fbf320 [gaim-migrate @ 15428]
Mark Doliner <markdoliner@pidgin.im>
parents: 13065
diff changeset
612 -1);
14809
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
613
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
614 /* 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
615 * 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
616 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
617 && 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
618 {
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
619 char *name;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
620 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
621 purple_account_get_active_status(status_box->token_status_account));
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
622
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
623 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
624 TEXT_COLUMN, &name, -1);
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
625
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
626 if (!purple_savedstatus_has_substatuses(saved_status)
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38256
diff changeset
627 || purple_strequal(name, acct_status_name))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
628 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
629 /* Found! */
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
630 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
631 g_free(name);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
632 break;
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
633 }
14738
09249782862d [gaim-migrate @ 17425]
Daniel Atallah <datallah@pidgin.im>
parents: 14725
diff changeset
634 g_free(name);
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
635
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
636 } 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
637 (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
638 {
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
639 /* Found! */
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
640 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
641 break;
a706db03c45f [gaim-migrate @ 17504]
Daniel Atallah <datallah@pidgin.im>
parents: 14806
diff changeset
642 }
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
643 } 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
644 }
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
645 }
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
646
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
647 if (status_box->active_row)
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
648 gtk_tree_row_reference_free(status_box->active_row);
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
649 if (path) { /* path should never be NULL */
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
650 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
651 gtk_tree_path_free(path);
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
652 } else
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
653 status_box->active_row = NULL;
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
654
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
655 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
656 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
657
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 /*
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
659 * 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
660 * 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
661 * 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
662 * 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
663 *
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 * 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
665 * 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
666 */
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
667 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
668
39609
a601304dcf51 A few cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents: 39608
diff changeset
669 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
670
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
671 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
672 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
673 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
674 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
675 }
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
676 else
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
677 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
678 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
679 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
680
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
681 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
682 }
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
683
40484
7df95db772d8 Update a a few things that were changed in talkatu
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
684 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
685 update_size(status_box);
12125
c1e55f812ded [gaim-migrate @ 14425]
Mark Doliner <markdoliner@pidgin.im>
parents: 12123
diff changeset
686 }
12634
943954b63b48 [gaim-migrate @ 14970]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12619
diff changeset
687
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
688 /* Stop suppressing the "changed" signal. */
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
689 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
11870
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
690 }
e116fee2b30c [gaim-migrate @ 14161]
Joshua Blanton <jblanton@cs.ohiou.edu>
parents: 11850
diff changeset
691
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
692 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
693 add_popular_statuses(PidginStatusBox *statusbox)
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
694 {
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
695 GList *list, *cur;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
696
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
697 list = purple_savedstatuses_get_popular(6);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
698 if (list == NULL)
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
699 /* Odd... oh well, nothing we can do about it. */
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
700 return;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
701
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
702 pidgin_status_box_add_separator(statusbox);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
703
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
704 for (cur = list; cur != NULL; cur = cur->next)
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
705 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
706 PurpleSavedStatus *saved = cur->data;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
707 const gchar *message;
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
708 gchar *stripped = NULL;
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
709 PidginStatusBoxItemType type;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
710
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
711 if (purple_savedstatus_is_transient(saved))
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
712 {
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
713 /*
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
714 * 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
715 * API returns the message when purple_savedstatus_get_title() is
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
716 * 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
717 */
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
718 type = PIDGIN_STATUS_BOX_TYPE_POPULAR;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
719 }
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
720 else
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
721 {
30707
cdaabb0e9f13 I think this is marginally better to read.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
722 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
723
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
724 message = purple_savedstatus_get_message(saved);
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
725 if (message != NULL)
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
726 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
727 stripped = purple_markup_strip_html(message);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
728 purple_util_chrreplace(stripped, '\n', ' ');
13099
35c9898ba2f1 [gaim-migrate @ 15460]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
729 }
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
730 }
13091
b5ed878998dd [gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents: 13080
diff changeset
731
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
732 pidgin_status_box_add(statusbox, type,
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
733 NULL, purple_savedstatus_get_title(saved), stripped,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
734 GINT_TO_POINTER(purple_savedstatus_get_creation_time(saved)));
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
735 g_free(stripped);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
736 }
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 g_list_free(list);
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
739 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
740
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
741 /* This returns NULL if the active accounts don't have identical
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
742 * 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
743 static
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
744 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
745 PurpleAccountManager *manager = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
746 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
747 PurpleAccount *acct1 = NULL;
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
748 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
749
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
750 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
751 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
752
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
753 if (active_accts) {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
754 acct1 = active_accts->data;
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36633
diff changeset
755 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
756 } else {
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
757 /* 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
758 return NULL;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
759 }
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
760
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
761 /* 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
762 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
763 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
764 GList *s1, *s2;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
765
38358
30ba44276e74 Merge release-2.x.y into default
dx <dx@dxzone.com.ar>
parents: 38298 38259
diff changeset
766 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
767 acct1 = NULL;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
768 break;
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
769 }
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
770
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
771 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
772 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
773 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
774 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
775 /* 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
776 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
777 || !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
778 || !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
779 acct1 = NULL;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
780 break;
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
781 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
782 }
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
783
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
784 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
785 acct1 = NULL;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
786 break;
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 }
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
789
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
790 g_list_free(active_accts);
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
791
28748
53f15767337e only need to loop over active accounts once for this
Ka-Hing Cheung <khc@pidgin.im>
parents: 28747
diff changeset
792 return acct1;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
793 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
794
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
795 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
796 add_account_statuses(PidginStatusBox *status_box, PurpleAccount *account)
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
797 {
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
798 /* 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
799 GList *l;
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 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
802 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
803 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
804 PurpleStatusPrimitive prim;
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
805
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
806 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
807 purple_status_type_is_independent(status_type))
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
808 continue;
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
809
23408
3dc9e98485aa Don't include 'Listening to music' in the per-account statusbox.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23405
diff changeset
810 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
811
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
812 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
813 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, NULL,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
814 purple_status_type_get_name(status_type),
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
815 NULL,
30706
612b36b49058 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29689
diff changeset
816 GINT_TO_POINTER(prim));
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
817 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
818 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
819
18319
e5f4aef72165 disapproval of revision '146d6831fc3d1fdf025c5ae60bc4976eaed5c987'
Sean Egan <seanegan@pidgin.im>
parents: 18318
diff changeset
820 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
821 pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed)
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
822 {
12256
2ad29826207a [gaim-migrate @ 14558]
Sean Egan <seanegan@pidgin.im>
parents: 12244
diff changeset
823 /* Unset the model while clearing it */
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
824 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
825 gtk_list_store_clear(status_box->dropdown_store);
13242
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
826 /* 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
827 * 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
828 * if we do this here. */
3b87f908bb32 [gaim-migrate @ 15607]
Kevin Hunter
parents: 13231
diff changeset
829 /* 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
830
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
831 if (status_box->account == NULL)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
832 {
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
833 /* Do all the currently enabled accounts have the same statuses?
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
834 * If so, display them instead of our global list.
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
835 */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
836 if (status_box->token_status_account) {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
837 add_account_statuses(status_box, status_box->token_status_account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
838 } else {
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
839 /* Global */
26844
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, _("Available"), NULL, GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE));
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, _("Away"), NULL, GINT_TO_POINTER(PURPLE_STATUS_AWAY));
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, _("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
843 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
844 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
845 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
846
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
847 add_popular_statuses(status_box);
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
848
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
849 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
850 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
851 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
852
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
853 status_menu_refresh_iter(status_box, status_changed);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
854 pidgin_status_box_refresh(status_box);
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
855
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
856 } else {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
857 add_account_statuses(status_box, status_box->account);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
858 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
859 purple_account_get_active_status(status_box->account));
11732
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
860 }
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
861 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
862 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
863 }
aba36f84241a [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
864
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
865 static gboolean
39609
a601304dcf51 A few cleanups from review
Gary Kramlich <grim@reaperworld.com>
parents: 39608
diff changeset
866 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
867 {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
868 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
869 return TRUE;
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
870 }
9157f095aa9d [gaim-migrate @ 15175]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12816
diff changeset
871
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
872 static gboolean
39608
8d68fba092e7 remove a few more references to webview
Gary Kramlich <grim@reaperworld.com>
parents: 39607
diff changeset
873 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
874 {
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
875 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
876 activate_currently_selected_status(status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
877 pidgin_status_box_refresh(status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
878
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
879 return TRUE;
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
880 }
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
881 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
882 {
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
883 /* 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
884 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
885 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
886 (event->state & GDK_SHIFT_MASK) ?
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
887 GTK_DIR_TAB_BACKWARD: GTK_DIR_TAB_FORWARD);
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
888 return TRUE;
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
889 }
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
890
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
891 /* 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
892 if (event->keyval == GDK_KEY_Escape)
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
893 {
13832
2719e29e6e9e [gaim-migrate @ 16279]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13805
diff changeset
894 if (status_box->account != NULL)
2719e29e6e9e [gaim-migrate @ 16279]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13805
diff changeset
895 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
896 purple_account_get_active_status(status_box->account));
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
897 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
898 status_menu_refresh_iter(status_box, TRUE);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
899 pidgin_status_box_refresh(status_box);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
900 }
13805
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
901 return TRUE;
58441e81b8f6 [gaim-migrate @ 16217]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13804
diff changeset
902 }
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13832
diff changeset
903
12274
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
904 return FALSE;
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
905 }
9a6e53645f92 [gaim-migrate @ 14578]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12269
diff changeset
906
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
907 static gboolean
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
908 dropdown_store_row_separator_func(GtkTreeModel *model,
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
909 GtkTreeIter *iter, gpointer data)
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
910 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
911 PidginStatusBoxItemType type;
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
912
11885
0c447c0ced93 [gaim-migrate @ 14176]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11870
diff changeset
913 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1);
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
914
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
915 if (type == PIDGIN_STATUS_BOX_TYPE_SEPARATOR)
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
916 return TRUE;
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 return FALSE;
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
919 }
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
920
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
921 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
922 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
923 PurpleAccount *initial_token_acct = status_box->token_status_account;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
924
22836
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
925 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
926 return;
5ddb441e37e4 Ignore token_status_account on account-specific status boxes. This should
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22618
diff changeset
927
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
928 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
929
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
930 /* Regenerate the list if it has changed */
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
931 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
932 pidgin_status_box_regenerate(status_box, TRUE);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
933 }
14703
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
934
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
935 }
3e5228ca175b [gaim-migrate @ 17387]
Daniel Atallah <datallah@pidgin.im>
parents: 14698
diff changeset
936
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
937 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
938 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
939 {
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
940 /* 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
941 pidgin_status_box_regenerate(status_box, TRUE);
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
942 }
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
943
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12585
diff changeset
944 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
945 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
946 {
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
947 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
948 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
949 }
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
950
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
951 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
952 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
953 {
40315
6746d9b67b3e Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents: 40264
diff changeset
954 GdkMonitor *m = NULL;
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
955 GdkRectangle monitor;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
956 GtkRequisition popup_req;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
957 GtkPolicyType hpolicy, vpolicy;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
958 GtkAllocation allocation;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
959
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
960 gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
961 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
962
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
963 *x += allocation.x;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
964 *y += allocation.y;
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 *width = allocation.width;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
967
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
968 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
969 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
970 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
971 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
972 NULL);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
973 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
974
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
975 if (popup_req.width > *width) {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
976 hpolicy = GTK_POLICY_ALWAYS;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
977 g_object_set(G_OBJECT(status_box->scrolled_window),
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
978 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
979 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
980 NULL);
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
981 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
982 }
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
983
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
984 *height = popup_req.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
985
40315
6746d9b67b3e Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents: 40264
diff changeset
986 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
987 gtk_widget_get_window(GTK_WIDGET(status_box)));
40315
6746d9b67b3e Replace deprecated gdk functions
Gary Kramlich <grim@reaperworld.com>
parents: 40264
diff changeset
988 gdk_monitor_get_geometry(m, &monitor);
33184
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
989
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
990 if (*x < monitor.x)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
991 *x = monitor.x;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
992 else if (*x + *width > monitor.x + monitor.width)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
993 *x = monitor.x + monitor.width - *width;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
994
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
995 if (*y + allocation.height + *height <= monitor.y + monitor.height)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
996 *y += allocation.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
997 else if (*y - *height >= monitor.y)
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
998 *y -= *height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
999 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
1000 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1001 *y += allocation.height;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1002 *height = monitor.y + monitor.height - *y;
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 else
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1005 {
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1006 *height = *y - monitor.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1007 *y = monitor.y;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1008 }
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 if (popup_req.height > *height)
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 vpolicy = GTK_POLICY_ALWAYS;
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1013
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1014 g_object_set(G_OBJECT(status_box->scrolled_window),
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1015 "hscrollbar-policy", hpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1016 "vscrollbar-policy", vpolicy,
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1017 NULL);
e27e4a465dba Fix erroneous spacing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33183
diff changeset
1018 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1019 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1020
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1021 static gboolean
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1022 popup_grab_on_window(GdkWindow *window, GdkEvent *event)
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1023 {
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1024 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
1025 GdkGrabStatus status;
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1026
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1027 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
1028 event, NULL, NULL);
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1029 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
1030 return TRUE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1031 }
29496
8807ee3e55c5 Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28087
diff changeset
1032
8807ee3e55c5 Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28087
diff changeset
1033 return FALSE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1034 }
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1035
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1036
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1037 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1038 pidgin_status_box_popup(PidginStatusBox *box, GdkEvent *event)
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1039 {
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1040 int width, height, x, y;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1041 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
1042
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1043 gtk_widget_set_size_request (box->popup_window, width, height);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1044 gtk_window_move (GTK_WINDOW (box->popup_window), x, y);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1045 gtk_widget_show(box->popup_window);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1046 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
1047 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
1048 gtk_widget_hide (box->popup_window);
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1049 return;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1050 }
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1051 gtk_grab_add (box->popup_window);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1052 /*box->popup_in_progress = TRUE;*/
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1053 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1054 TRUE);
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1055
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1056 if (box->active_row) {
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1057 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
1058 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
1059 gtk_tree_path_free(path);
15182
7c8a78f32f37 [gaim-migrate @ 17906]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15180
diff changeset
1060 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1061 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1062
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1063 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1064 pidgin_status_box_popdown(PidginStatusBox *box, GdkEvent *event)
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1065 {
39945
a463a1d03965 Use new GdkSeat API instead of deprecated GdkDevice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39930
diff changeset
1066 GdkSeat *seat;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1067 gtk_widget_hide(box->popup_window);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1068 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
1069 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
1070 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
1071 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
1072 gdk_seat_ungrab(seat);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1073 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1074
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1075 static gboolean
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1076 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box)
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1077 {
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1078 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
1079 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
1080 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
1081 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
1082 case GDK_KEY_space:
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1083 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
1084 pidgin_status_box_popup(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1085 box->popup_in_progress = TRUE;
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1086 } else {
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1087 pidgin_status_box_popdown(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1088 }
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1089 return TRUE;
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1090 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
1091 return FALSE;
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1092 }
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1093 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1094
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1095 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
1096 toggled_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1097 {
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1098 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
1099 pidgin_status_box_popup(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1100 else
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1101 pidgin_status_box_popdown(box, (GdkEvent *)event);
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1102 return TRUE;
12294
4e5f06bcfaa1 [gaim-migrate @ 14598]
Etan Reisner <deryni@pidgin.im>
parents: 12286
diff changeset
1103 }
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1104
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1105 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1106 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
1107 {
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1108 if (status_box->active_row)
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1109 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
1110
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1111 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
1112 pidgin_status_box_popdown(status_box, event);
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1113 pidgin_status_box_changed(status_box);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1114 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1115
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
1116 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
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 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
1119
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 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
1121 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
1122
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 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
1124 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
1125 }
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
1126
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 static void
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1128 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
1129 {
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 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
1131 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
1132 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
1133 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
1134
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 (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
1136 /* 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
1137 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
1138 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
1139 }
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
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 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
1142 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
1143
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 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
1145 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
1146 -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
1147
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 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
1149 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
1150 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
1151 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
1152
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
1153 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
1154
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1155 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
1156 NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1157 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
1158 _("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
1159 _("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
1160
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
1161 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
1162
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1163 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
1164 }
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
1165
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1166 static gboolean
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1167 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
1168 {
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1169 GtkTreePath *path = NULL;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1170 int ret;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1171 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
1172
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1173 if (ewidget != status_box->tree_view) {
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1174 if (ewidget == status_box->toggle_button &&
15176
44bc99559266 [gaim-migrate @ 17900]
Sean Egan <seanegan@pidgin.im>
parents: 15174
diff changeset
1175 status_box->popup_in_progress &&
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1176 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
1177 pidgin_status_box_popdown(status_box, (GdkEvent *)event);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1178 return TRUE;
19659
acdd4962bf80 Allow you to click on statusbox again and keep it open.
Sean Egan <seanegan@pidgin.im>
parents: 19576
diff changeset
1179 } else if (ewidget == status_box->toggle_button) {
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24508
diff changeset
1180 status_box->popup_in_progress = TRUE;
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1181 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1182
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1183 /* 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
1184 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
1185 pidgin_status_box_popdown(status_box, (GdkEvent *)event);
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1186 return TRUE;
19659
acdd4962bf80 Allow you to click on statusbox again and keep it open.
Sean Egan <seanegan@pidgin.im>
parents: 19576
diff changeset
1187 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1188
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1189 return FALSE;
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1190 }
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1191
15145
29ce100d3f5b [gaim-migrate @ 17869]
Sean Egan <seanegan@pidgin.im>
parents: 15141
diff changeset
1192 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
1193 event->x, event->y,
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1194 &path,
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1195 NULL, NULL, NULL);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1196
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1197 if (!ret)
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1198 return TRUE; /* clicked outside window? */
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1199
33270
a6493d38dc28 Use GdkDevice instead of keyboard and pointer grabs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33257
diff changeset
1200 treeview_activate_current_selection(status_box, path, (GdkEvent *)event);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1201 gtk_tree_path_free (path);
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 return TRUE;
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1204 }
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1205
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1206 static gboolean
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1207 treeview_key_press_event(GtkWidget *widget,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1208 GdkEventKey *event, PidginStatusBox *box)
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1209 {
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1210 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
1211 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
1212 pidgin_status_box_popdown(box, (GdkEvent *)event);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1213 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
1214 } else {
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1215 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
1216 GtkTreeIter iter;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1217 GtkTreePath *path;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1218
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1219 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
1220 gboolean ret = TRUE;
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1221 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
1222 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
1223 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
1224 } 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
1225 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
1226 } else
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1227 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
1228
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1229 gtk_tree_path_free (path);
18259
27b06926c3d7 Let non-delete keys operate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18239
diff changeset
1230 return ret;
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1231 }
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 24508
diff changeset
1232 }
15177
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 return FALSE;
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1235 }
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1236
14698
ce03134f05df [gaim-migrate @ 17382]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14661
diff changeset
1237 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
1238 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
1239 {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1240 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
1241 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
1242 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
1243 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
1244 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
1245 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
1246
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1247 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
1248 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
1249 /* 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
1250 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1251 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1252 } else {
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1253 /* 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
1254 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1255 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1256
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1257 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
1258 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
1259 /* 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
1260 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
1261 return;
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1262 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1263
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1264 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
1265 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
1266 /* 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
1267 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
1268 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
1269 } 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
1270 /* 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
1271 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
1272 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
1273 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1274
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1275 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
1276 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
1277 }
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1278
c07358e00ffc Arrow keys in status menu should skip separator lines. Closes #1360.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23032
diff changeset
1279 static void
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1280 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
1281 PidginStatusBox *status_box = (PidginStatusBox*)data;
40682
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 pidgin_status_box_refresh(status_box);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1284 }
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1285
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1286 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1287 pidgin_status_box_init (PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1288 {
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1289 GNetworkMonitor *monitor = NULL;
11400
be2052efada5 [gaim-migrate @ 13635]
Will Thompson <resiak@pidgin.im>
parents: 11347
diff changeset
1290 GtkCellRenderer *text_rend;
be2052efada5 [gaim-migrate @ 13635]
Will Thompson <resiak@pidgin.im>
parents: 11347
diff changeset
1291 GtkCellRenderer *icon_rend;
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1292 GtkCellRenderer *emblem_rend;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1293 GtkWidget *toplevel;
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1294 GtkTreeSelection *sel;
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1295 gboolean network_available = FALSE;
41228
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1296 gpointer handle;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1297
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
1298 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
1299 status_box->editor_visible = FALSE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1300 status_box->network_available = purple_network_is_available();
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1301 status_box->connecting = FALSE;
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1302 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
1303 status_box->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1304 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
1305 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
1306 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
1307
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1308 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
1309 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
1310 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
1311 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
1312
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1313 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
1314 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
1315
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
1316 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
1317
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1318 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
1319 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
1320 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
1321 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
1322 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
1323 gtk_widget_set_focus_on_click(status_box->toggle_button, FALSE);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1324
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1325 text_rend = gtk_cell_renderer_text_new();
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1326 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
1327 emblem_rend = gtk_cell_renderer_pixbuf_new();
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1328 status_box->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1329
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1330 toplevel = gtk_widget_get_toplevel (GTK_WIDGET (status_box));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1331 if (GTK_IS_WINDOW (toplevel)) {
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1332 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
1333 GTK_WINDOW (toplevel));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1334 }
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1335
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1336 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
1337 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
1338 GDK_WINDOW_TYPE_HINT_POPUP_MENU);
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1339 gtk_window_set_screen (GTK_WINDOW (status_box->popup_window),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1340 gtk_widget_get_screen (GTK_WIDGET (status_box)));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1341 status_box->popup_frame = gtk_frame_new (NULL);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1342 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
1343 GTK_SHADOW_ETCHED_IN);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1344 gtk_container_add (GTK_CONTAINER (status_box->popup_window),
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1345 status_box->popup_frame);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1346
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1347 gtk_widget_show (status_box->popup_frame);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1348
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1349 status_box->tree_view = gtk_tree_view_new ();
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1350 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
1351 gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1352 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
1353 FALSE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1354 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
1355 TRUE);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1356 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
1357 GTK_TREE_MODEL(status_box->dropdown_store));
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1358 status_box->column = gtk_tree_view_column_new ();
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1359 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
1360 status_box->column);
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1361 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
1362 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
1363 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
1364 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
1365 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
1366 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
1367
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 = 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
1369 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
1370 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
1371
15183
9aed18680470 [gaim-migrate @ 17907]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15182
diff changeset
1372 gtk_widget_show(status_box->tree_view);
15177
8b6c66e09388 [gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15176
diff changeset
1373 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
1374 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
1375 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
1376
13045
75f38f58edde [gaim-migrate @ 15404]
Mark Doliner <markdoliner@pidgin.im>
parents: 13044
diff changeset
1377 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1378
13044
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1379 status_box->icon_rend = gtk_cell_renderer_pixbuf_new();
de31095dc4ff [gaim-migrate @ 15403]
Mark Doliner <markdoliner@pidgin.im>
parents: 13025
diff changeset
1380 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
1381 emblem_rend = gtk_cell_renderer_pixbuf_new();
14865
533ea832c97c [gaim-migrate @ 17568]
Sean Egan <seanegan@pidgin.im>
parents: 14864
diff changeset
1382 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
1383 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
1384 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
1385 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
1386 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
1387 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
1388 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
1389
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35500
diff changeset
1390 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
1391 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
1392 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
1393
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1394 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
1395 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
1396
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1397 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
1398 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
1399 status_box);
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1400
20214
6b993c1f4c6a applied changes from 1bdf4754abed6b49eec400ecf415a9d557bc9834
Luke Schierer <lschiere@pidgin.im>
parents: 20147
diff changeset
1401 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
1402 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
1403 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
1404 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
1405 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
1406 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
1407
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1408 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
1409 gtk_widget_show_all(status_box->vbox);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1410
12262
91aa0bd039aa [gaim-migrate @ 14564]
Sean Egan <seanegan@pidgin.im>
parents: 12256
diff changeset
1411 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
1412
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1413 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
1414
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1415 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
1416 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
1417 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
1418 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
1419 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
1420
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1421 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
1422
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1423 status_box->token_status_account = check_active_accounts_for_identical_statuses();
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1424
28751
01d28b827401 try not to artificially hide and then unhide the imhtml when status
Ka-Hing Cheung <khc@pidgin.im>
parents: 28750
diff changeset
1425 pidgin_status_box_regenerate(status_box, TRUE);
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1426
41228
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1427 handle = purple_savedstatuses_get_handle();
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1428 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
1429 PURPLE_CALLBACK(current_savedstatus_changed_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1430 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-added", 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-deleted", 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 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
1436 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
1437
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1438 handle = purple_accounts_get_handle();
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1439 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
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-disabled", status_box,
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1442 PURPLE_CALLBACK(account_enabled_cb), status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1443 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
1444 PURPLE_CALLBACK(account_status_changed_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1445 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1446
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1447 handle = purple_connections_get_handle();
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1448 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
1449 PURPLE_CALLBACK(connection_start_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1450 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1451 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
1452 PURPLE_CALLBACK(connection_finish_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1453 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1454 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
1455 PURPLE_CALLBACK(connection_finish_cb),
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1456 status_box);
cfabfc1afd50 Make PidginStatusBox manage its own connecting state.
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
1457 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
1458 PURPLE_CALLBACK(connection_error_cb), status_box);
14804
8c79ca123c25 [gaim-migrate @ 17499]
Daniel Atallah <datallah@pidgin.im>
parents: 14801
diff changeset
1459
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1460 monitor = g_network_monitor_get_default();
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1461 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
1462 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
1463 status_box);
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1464 network_available = g_network_monitor_get_network_available(monitor);
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1465 pidgin_status_box_set_network_available(status_box, network_available);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1466 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1467
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1468 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
1469 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
1470 gint *natural_height)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1471 {
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
1472 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
1473 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
1474
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
1475 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
1476 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
1477
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
1478 *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
1479 *natural_height = MAX(*natural_height, 34) + border_width * 2;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1480
39608
8d68fba092e7 remove a few more references to webview
Gary Kramlich <grim@reaperworld.com>
parents: 39607
diff changeset
1481 /* 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
1482 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
1483 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
1484 &box_min_height, &box_nat_height);
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1485
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1486 if (box_min_height > 1)
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1487 *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
1488
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1489 if (box_nat_height > 1)
b6c76bcadbe8 Probably fix the statusbox sizing.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
1490 *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
1491 }
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1492 }
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1493
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1494 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1495 pidgin_status_box_size_allocate(GtkWidget *widget,
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1496 GtkAllocation *allocation)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1497 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1498 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1499 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
1500 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
1501 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
1502
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33271
diff changeset
1503 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
1504 /* 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
1505
15474
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1506 req.height = MAX(req.height, 34);
673a21839b11 More statusbox tweaks:
Sean Egan <seanegan@pidgin.im>
parents: 15462
diff changeset
1507 req.height += border_width * 2;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1508
13065
6ad1cf73ad6b [gaim-migrate @ 15427]
Mark Doliner <markdoliner@pidgin.im>
parents: 13062
diff changeset
1509 box_alc = *allocation;
14661
d5bcf645d158 [gaim-migrate @ 17326]
Mark Doliner <markdoliner@pidgin.im>
parents: 14623
diff changeset
1510
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1511 box_alc.width -= (border_width * 2);
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1512 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
1513 box_alc.x += border_width;
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1514 box_alc.y += req.height + border_width;
15180
7ed2edcb163b [gaim-migrate @ 17904]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15177
diff changeset
1515 gtk_widget_size_allocate(status_box->vbox, &box_alc);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1516
13065
6ad1cf73ad6b [gaim-migrate @ 15427]
Mark Doliner <markdoliner@pidgin.im>
parents: 13062
diff changeset
1517 parent_alc = *allocation;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1518 parent_alc.height = MAX(1,req.height - (border_width *2));
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1519 parent_alc.width -= (border_width * 2);
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1520 parent_alc.x += border_width;
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14316
diff changeset
1521 parent_alc.y += border_width;
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14190
diff changeset
1522
14215
1565e928d130 [gaim-migrate @ 16798]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14214
diff changeset
1523 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
1524 gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1525 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1526
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1527 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
1528 pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1529 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1530 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
1531 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
1532
37618
33e0bc920834 Fix status box drawing
Jakub Adam <jakub.adam@ktknet.cz>
parents: 37424
diff changeset
1533 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
1534
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1535 return FALSE;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1536 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1537
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1538 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1539 pidgin_status_box_forall(GtkContainer *container,
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1540 gboolean include_internals,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1541 GtkCallback callback,
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1542 gpointer callback_data)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1543 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1544 PidginStatusBox *status_box = PIDGIN_STATUS_BOX (container);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1545
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1546 if (include_internals)
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1547 {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1548 (* callback) (status_box->vbox, callback_data);
12275
c9b030c5819c [gaim-migrate @ 14579]
Sean Egan <seanegan@pidgin.im>
parents: 12274
diff changeset
1549 (* callback) (status_box->toggle_button, callback_data);
c9b030c5819c [gaim-migrate @ 14579]
Sean Egan <seanegan@pidgin.im>
parents: 12274
diff changeset
1550 (* callback) (status_box->arrow, callback_data);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1551 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1552 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1553
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1554 GtkWidget *
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1555 pidgin_status_box_new()
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1556 {
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1557 return g_object_new(PIDGIN_TYPE_STATUS_BOX, "account", NULL, NULL);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1558 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1559
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
1560 GtkWidget *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1561 pidgin_status_box_new_with_account(PurpleAccount *account)
11499
95be4b16bfaf [gaim-migrate @ 13744]
Tim Ringenbach <marv@pidgin.im>
parents: 11400
diff changeset
1562 {
40682
edbc992e77be Some initial cleanups to PidginStatusBox
Gary Kramlich <grim@reaperworld.com>
parents: 40676
diff changeset
1563 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
1564 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1565
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1566 /*
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1567 * pidgin_status_box_add:
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1568 * @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
1569 * @type: A PidginStatusBoxItemType.
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1570 * @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
1571 * 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
1572 * @title: The title of this item. For the primitive entries,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1573 * this is something like "Available" or "Away." For
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1574 * the saved statuses, this is something like
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1575 * "My favorite away message!" This should be
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1576 * 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
1577 * @desc: The secondary text for this item. This will be
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1578 * placed on the row below the title, in a dimmer
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1579 * font (generally gray). This text should be plaintext
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1580 * (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
1581 * @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
1582 * 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
1583 * PurpleStatusPrimitive. For saved statuses this is the
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1584 * creation timestamp.
35455
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1585 *
216a37403c5b Fix a bunch of gtk-doc warnings in pidgin
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
1586 * Add a row to the dropdown menu.
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1587 */
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1588 void
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1589 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
1590 const char *title, const char *desc, gpointer data)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1591 {
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1592 GtkTreeIter iter;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1593 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
1594 const char *icon_name = NULL;
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1595
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1596 if (desc == NULL)
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 text = g_markup_escape_text(title, -1);
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 else
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1601 {
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
1602 const char *aa_color;
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1603 gchar *escaped_title, *escaped_desc;
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1604
37996
6c9cb1e8b2d9 Replace GtkStyle with GtkStyleContext.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37879
diff changeset
1605 aa_color = pidgin_get_dim_grey_string(GTK_WIDGET(status_box));
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1606
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1607 escaped_title = g_markup_escape_text(title, -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1608 escaped_desc = g_markup_escape_text(desc, -1);
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1609 text = g_strdup_printf("%s - <span color=\"%s\" size=\"smaller\">%s</span>",
17082
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1610 escaped_title,
3316a891ffa9 disapproval of revision 'aee2b2d67b643d59beb0b75b460c553c804e8220'
Daniel Atallah <datallah@pidgin.im>
parents: 17081
diff changeset
1611 aa_color, escaped_desc);
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1612 g_free(escaped_title);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1613 g_free(escaped_desc);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1614 }
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1615
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1616 if (!pixbuf) {
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1617 PurpleStatusPrimitive prim = PURPLE_STATUS_UNSET;
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1618 if (type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE) {
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1619 prim = GPOINTER_TO_INT(data);
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1620 } else if (type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR ||
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1621 type == PIDGIN_STATUS_BOX_TYPE_POPULAR) {
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1622 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
1623 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
1624 prim = purple_savedstatus_get_primitive_type(saved);
26844
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1625 }
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1626 }
26845
ecb95636d308 Use stock id everywhere!
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26844
diff changeset
1627
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 = 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
1629 }
fd2c3d3f1209 Use stock id where possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26828
diff changeset
1630
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1631 gtk_list_store_append(status_box->dropdown_store, &iter);
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1632 gtk_list_store_set(status_box->dropdown_store, &iter,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1633 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
1634 ICON_NAME_COLUMN, icon_name,
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1635 TEXT_COLUMN, text,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1636 TITLE_COLUMN, title,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1637 DESC_COLUMN, desc,
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1638 DATA_COLUMN, data,
16376
04b7b529b7b0 Saved icon for saved statuses in statusbox
Sean Egan <seanegan@pidgin.im>
parents: 16351
diff changeset
1639 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
1640 EMBLEM_COLUMN, "document-save",
13050
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1641 -1);
d65dcd88c5bb [gaim-migrate @ 15411]
Mark Doliner <markdoliner@pidgin.im>
parents: 13045
diff changeset
1642 g_free(text);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1643 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1644
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1645 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1646 pidgin_status_box_add_separator(PidginStatusBox *status_box)
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1647 {
11756
c1b8045e540a [gaim-migrate @ 14047]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11755
diff changeset
1648 /* Don't do anything unless GTK actually supports
c1b8045e540a [gaim-migrate @ 14047]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11755
diff changeset
1649 * gtk_combo_box_set_row_separator_func */
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1650 GtkTreeIter iter;
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 gtk_list_store_append(status_box->dropdown_store, &iter);
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1653 gtk_list_store_set(status_box->dropdown_store, &iter,
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1654 TYPE_COLUMN, PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1655 -1);
11738
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1656 }
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1657
207d5519a4d0 [gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents: 11732
diff changeset
1658 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1659 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
1660 {
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1661 if (!status_box)
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1662 return;
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1663 status_box->network_available = available;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1664 pidgin_status_box_refresh(status_box);
14767
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1665 }
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1666
34cc644b452f [gaim-migrate @ 17458]
Nathan Walp <nwalp@pidgin.im>
parents: 14738
diff changeset
1667 void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1668 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1669 {
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1670 if (!status_box)
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1671 return;
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1672 status_box->connecting = connecting;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1673 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1674 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1675
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1676 static void
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1677 activate_currently_selected_status(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1678 {
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1679 PidginStatusBoxItemType type;
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1680 gpointer data;
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1681 gchar *title;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1682 GtkTreeIter iter;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1683 GtkTreePath *path;
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1684 char *message;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1685 PurpleSavedStatus *saved_status = NULL;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1686 gboolean changed = TRUE;
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1687
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1688 path = gtk_tree_row_reference_get_path(status_box->active_row);
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1689 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
1690 return;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1691 gtk_tree_path_free(path);
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1692
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1693 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
1694 TYPE_COLUMN, &type,
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1695 DATA_COLUMN, &data,
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1696 -1);
12074
c377fb120662 [gaim-migrate @ 14370]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12060
diff changeset
1697
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1698 /*
13025
824f4aef4e33 [gaim-migrate @ 15378]
Mark Doliner <markdoliner@pidgin.im>
parents: 13023
diff changeset
1699 * If the currently selected status is "New..." or
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1700 * "Saved..." or a popular status then do nothing.
13125
c5dab3b004ab [gaim-migrate @ 15486]
Mark Doliner <markdoliner@pidgin.im>
parents: 13124
diff changeset
1701 * Popular statuses are
11954
7da15f32e1ca [gaim-migrate @ 14245]
Mark Doliner <markdoliner@pidgin.im>
parents: 11951
diff changeset
1702 * activated elsewhere, and we update the status_box
14190
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
1703 * accordingly by connecting to the savedstatus-changed
4d3fc3f58cc6 [gaim-migrate @ 16766]
Mark Doliner <markdoliner@pidgin.im>
parents: 14097
diff changeset
1704 * signal and then calling status_menu_refresh_iter()
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1705 */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1706 if (type != PIDGIN_STATUS_BOX_TYPE_PRIMITIVE)
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1707 return;
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1708
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1709 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
1710 TITLE_COLUMN, &title, -1);
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1711
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1712 message = pidgin_status_box_get_message(status_box);
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1713 if (!message || !*message)
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1714 {
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
1715 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
1716 status_box->editor_visible = FALSE;
37424
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
1717 g_free(message);
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
1718 message = NULL;
12659
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1719 }
de9c41f39996 [gaim-migrate @ 15002]
Kris Marsh <moogman@gmail.com>
parents: 12651
diff changeset
1720
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1721 if (status_box->account == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1722 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
1723 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
1724 PurpleStatusPrimitive primitive = GPOINTER_TO_INT(data);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1725 /* Global */
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1726 /* Save the newly selected status to prefs.xml and status.xml */
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1727
13112
d2c4ff0321e1 [gaim-migrate @ 15473]
Mark Doliner <markdoliner@pidgin.im>
parents: 13099
diff changeset
1728 /* Has the status really been changed? */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1729 if (status_box->token_status_account) {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1730 gint active;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1731 PurpleStatus *status;
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1732 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
1733 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
1734
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1735 gtk_tree_path_free(path);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1736
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1737 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
1738
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
1739 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
1740 id = purple_status_type_get_id(acct_status_type);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1741
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 36256
diff changeset
1742 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
1743 purple_strequal(message, purple_status_get_attr_string(status, "message")))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1744 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1745 /* Selected status and previous status is the same */
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1746 PurpleSavedStatus *ss = purple_savedstatus_get_current();
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1747 /* Make sure that statusbox displays the correct thing.
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1748 * 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
1749 * 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
1750 if ((purple_savedstatus_get_primitive_type(ss) == primitive)
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1751 && purple_savedstatus_is_transient(ss)
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1752 && purple_savedstatus_has_substatuses(ss))
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1753 changed = FALSE;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1754 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1755 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1756 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
1757 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
1758 !purple_savedstatus_has_substatuses(saved_status) &&
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1759 purple_strequal(purple_savedstatus_get_message(saved_status), message))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1760 {
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1761 changed = FALSE;
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1762 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1763 }
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1764
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1765 if (changed)
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1766 {
28746
47618d069f02 mostly comment changes, changed a str && !strcmp to purple_strequal
Ka-Hing Cheung <khc@pidgin.im>
parents: 28745
diff changeset
1767 /* Manually find the appropriate transient status */
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1768 if (status_box->token_status_account) {
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1769 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
1770 GList *iter = purple_savedstatuses_get_all();
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1771 GList *active_accts = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1772
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1773 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1774 active_accts = purple_account_manager_get_active(manager);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1775
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1776 for (; iter != NULL; iter = iter->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1777 PurpleSavedStatus *ss = iter->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1778 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
1779 /* 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
1780 * 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
1781 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
1782 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
1783 purple_strequal(ss_msg, message))
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1784 {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1785 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
1786 /* 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
1787 while(active_accts != NULL) {
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1788 PurpleAccount *acct = active_accts->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1789 PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1790 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
1791 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
1792 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
1793 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
1794 if (purple_strequal(subtype_status_id, id)) {
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1795 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
1796 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
1797 }
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1798 }
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1799
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1800 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
1801 active_accts);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1802 }
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
1803
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
1804 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
1805 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
1806 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
1807 }
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1808 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1809 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1810
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1811 g_list_free(active_accts);
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1812
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1813 } else {
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1814 /* 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
1815 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
1816 }
13012
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
1817
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
1818 /* 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
1819 if(saved_status == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1820 saved_status = purple_savedstatus_new(NULL, primitive);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1821 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
1822
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1823 if (status_box->token_status_account) {
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1824 PurpleAccountManager *manager = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1825 GList *active_accts = 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 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1828 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
1829
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1830 while(active_accts != NULL) {
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1831 PurpleAccount *account = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1832
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1833 account = PURPLE_ACCOUNT(active_accts->data);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1834 purple_savedstatus_set_substatus(saved_status, account,
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1835 acct_status_type,
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1836 message);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1837
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1838 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
1839 active_accts);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1840 }
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
1841 }
13012
402bd07464a7 [gaim-migrate @ 15365]
Mark Doliner <markdoliner@pidgin.im>
parents: 12932
diff changeset
1842 }
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1843
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1844 /* Set the status for each account */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1845 purple_savedstatus_activate(saved_status);
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1846 }
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1847 } else {
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1848 /* Per-account */
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1849 gint active;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1850 PurpleStatusType *status_type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1851 PurpleStatus *status;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1852 const char *id = NULL;
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1853
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1854 status = purple_account_get_active_status(status_box->account);
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1855
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1856 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
1857
11993
b9dff0189886 [gaim-migrate @ 14286]
Tim Ringenbach <marv@pidgin.im>
parents: 11991
diff changeset
1858 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
1859 id = purple_status_type_get_id(status_type);
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1860
38256
035f00c4fd87 Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 36256
diff changeset
1861 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
1862 purple_strequal(message, purple_status_get_attr_string(status, "message")))
12076
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 /* Selected status and previous status is the same */
28750
185fe805c9d0 colapses 2 ifs together
Ka-Hing Cheung <khc@pidgin.im>
parents: 28749
diff changeset
1865 changed = FALSE;
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1866 }
12123
a5890e156848 [gaim-migrate @ 14423]
Mark Doliner <markdoliner@pidgin.im>
parents: 12103
diff changeset
1867
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1868 if (changed)
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1869 {
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1870 if (message)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1871 purple_account_set_status(status_box->account, id,
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1872 TRUE, "message", message, NULL);
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1873 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1874 purple_account_set_status(status_box->account, id,
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1875 TRUE, NULL);
15064
da02544e8fe6 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14865
diff changeset
1876
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1877 saved_status = purple_savedstatus_get_current();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1878 if (purple_savedstatus_is_transient(saved_status))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1879 purple_savedstatus_set_substatus(saved_status, status_box->account,
15064
da02544e8fe6 [gaim-migrate @ 17782]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14865
diff changeset
1880 status_type, message);
12076
43b9b14ead2d [gaim-migrate @ 14373]
Daniel Atallah <datallah@pidgin.im>
parents: 12075
diff changeset
1881 }
11981
50f2070cd348 [gaim-migrate @ 14274]
Tim Ringenbach <marv@pidgin.im>
parents: 11967
diff changeset
1882 }
11627
07feb58977aa [gaim-migrate @ 13902]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11593
diff changeset
1883
11638
1821b40269a3 [gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11627
diff changeset
1884 g_free(title);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1885 g_free(message);
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1886 }
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1887
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1888 static void update_size(PidginStatusBox *status_box)
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1889 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1890 if (!status_box->editor_visible)
12597
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1891 {
12598
fd20149e7a7e [gaim-migrate @ 14928]
Richard Laager <rlaager@pidgin.im>
parents: 12597
diff changeset
1892 if (status_box->vbox != NULL)
fd20149e7a7e [gaim-migrate @ 14928]
Richard Laager <rlaager@pidgin.im>
parents: 12597
diff changeset
1893 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
1894 return;
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1895 }
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1896
33257
eb15b7f78e32 Convert GtkStatusBox to use a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33184
diff changeset
1897 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
1898 }
ff6ea86357fa [gaim-migrate @ 14927]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12596
diff changeset
1899
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1900 static void pidgin_status_box_changed(PidginStatusBox *status_box)
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1901 {
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1902 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
1903 GtkTreeIter iter;
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1904 PidginStatusBoxItemType type;
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1905 gpointer data;
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1906 GList *accounts = NULL, *node;
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1907 int active;
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1908 gboolean wastyping = FALSE;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1909
15999
77ac8981199b Some pixmap path fixes and win32 fixes
Daniel Atallah <datallah@pidgin.im>
parents: 15941
diff changeset
1910
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1911 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
1912 return;
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1913 active = gtk_tree_path_get_indices(path)[0];
15141
6fde8ebff40a [gaim-migrate @ 17864]
Sean Egan <seanegan@pidgin.im>
parents: 15132
diff changeset
1914 gtk_tree_path_free(path);
15216
2859ff89476d [gaim-migrate @ 17940]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15201
diff changeset
1915 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
1916
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1917 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
1918 TYPE_COLUMN, &type,
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1919 DATA_COLUMN, &data,
11739
cc15987b3937 [gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents: 11738
diff changeset
1920 -1);
10861
21977f46cdf4 [gaim-migrate @ 12544]
Mark Doliner <markdoliner@pidgin.im>
parents: 10749
diff changeset
1921
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
1922 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box)))
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1923 {
16426
fabd69a48567 For Luke. Fixes saved status selection
Sean Egan <seanegan@pidgin.im>
parents: 16402
diff changeset
1924 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
1925 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1926 PurpleSavedStatus *saved;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1927 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
1928 g_return_if_fail(saved != NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1929 purple_savedstatus_activate(saved);
12778
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1930 return;
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1931 }
e98948ef3259 [gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12731
diff changeset
1932
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1933 if (type == PIDGIN_STATUS_BOX_TYPE_CUSTOM)
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1934 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1935 PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1936 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
1937 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
1938 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
1939 pidgin_status_editor_show(FALSE,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1940 purple_savedstatus_is_transient(saved_status)
13176
df549de66219 [gaim-migrate @ 15538]
Mark Doliner <markdoliner@pidgin.im>
parents: 13125
diff changeset
1941 ? saved_status : NULL);
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1942 status_menu_refresh_iter(status_box, wastyping);
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1943 if (wastyping)
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1944 pidgin_status_box_refresh(status_box);
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1945 return;
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1946 }
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1947
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
1948 if (type == PIDGIN_STATUS_BOX_TYPE_SAVED)
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1949 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
1950 pidgin_status_window_show();
29298
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1951 status_menu_refresh_iter(status_box, wastyping);
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1952 if (wastyping)
44ae7afa8fd0 Refresh the statusbox correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29217
diff changeset
1953 pidgin_status_box_refresh(status_box);
11951
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1954 return;
0aee90f8d803 [gaim-migrate @ 14242]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11891
diff changeset
1955 }
11729
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1956 }
56b1a9f35b74 [gaim-migrate @ 14020]
Mark Doliner <markdoliner@pidgin.im>
parents: 11724
diff changeset
1957
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1958 /*
12779
b0d89f38aebb [gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents: 12778
diff changeset
1959 * Show the message box whenever the primitive allows for a
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1960 * message attribute on any protocol that is enabled,
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1961 * or our protocol, if we have account set
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1962 */
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1963 if(status_box->account) {
11960
2efa2d4369e5 [gaim-migrate @ 14251]
Tim Ringenbach <marv@pidgin.im>
parents: 11954
diff changeset
1964 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
1965 } else {
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1966 PurpleAccountManager *manager = NULL;
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1967
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1968 manager = purple_account_manager_get_default();
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1969
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1970 accounts = purple_account_manager_get_active(manager);
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1971 }
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41065
diff changeset
1972
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1973 status_box->editor_visible = FALSE;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1974 for (node = accounts; node != NULL; node = node->next)
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1975 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1976 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1977 PurpleStatusType *status_type;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1978
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1979 account = node->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1980 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
1981 if ((status_type != NULL) &&
31327
831530000b51 disapproval of revision 'c253c498a60e5a02bccb0f59d0908d1623c4307e'
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31326
diff changeset
1982 (purple_status_type_get_attr(status_type, "message") != NULL))
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1983 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1984 status_box->editor_visible = TRUE;
11755
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1985 break;
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1986 }
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1987 }
3b1b0ff3c22e [gaim-migrate @ 14046]
Mark Doliner <markdoliner@pidgin.im>
parents: 11753
diff changeset
1988 g_list_free(accounts);
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1989
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
1990 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box)))
11654
3f025590a95a [gaim-migrate @ 13938]
Mark Doliner <markdoliner@pidgin.im>
parents: 11638
diff changeset
1991 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1992 if (status_box->editor_visible)
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
1993 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1994 GtkTextIter start, end;
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1995
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
1996 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
1997 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
1998
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
1999 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
2000 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
2001 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
2002 }
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2003 else
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2004 {
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
2005 gtk_widget_hide(status_box->vbox);
14725
39980ddc0b9a [gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents: 14703
diff changeset
2006 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
2007 }
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2008 }
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2009 pidgin_status_box_refresh(status_box);
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2010 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2011
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2012 static gint
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2013 get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status)
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2014 {
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2015 gint index = -1;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2016
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
2017 switch (purple_savedstatus_get_primitive_type(saved_status))
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2018 {
19455
e3f7e189ef7b Select the correct item in the dropdown when using a transient status.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18319
diff changeset
2019 /* 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
2020 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
2021 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2022 /* 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
2023 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
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_UNAVAILABLE:
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++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2028 /* fall through */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2029 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
2030 index++;
35998
aeaebd2ba4af Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33215
diff changeset
2031 /* 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
2032 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
2033 index++;
12932
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2034 break;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2035 default:
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2036 break;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2037 }
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2038
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2039 return index;
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2040 }
63d706361608 [gaim-migrate @ 15285]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12905
diff changeset
2041
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2042 char *pidgin_status_box_get_message(PidginStatusBox *status_box)
10649
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2043 {
39607
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
2044 if (status_box->editor_visible)
58a24064b74a Replace webkit in the statusbox with a talkatu editor.
Gary Kramlich <grim@reaperworld.com>
parents: 39568
diff changeset
2045 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
2046 else
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2047 return NULL;
cd536d7aff51 [gaim-migrate @ 12167]
Sean Egan <seanegan@pidgin.im>
parents: 10643
diff changeset
2048 }

mercurial