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