pidgin/gtkstatusbox.c

Sat, 27 Feb 2021 18:03:38 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 27 Feb 2021 18:03:38 -0600
changeset 40790
e92d5c060155
parent 40705
f7a1c67543e5
child 41003
9b97fe2dcdac
permissions
-rw-r--r--

Add a description to PurpleCredentialProvider and show it in the preferences selector

Testing Done:
Compiled and ran locally.

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

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

mercurial