Fri, 06 Dec 2013 01:14:48 -0800
Drop support for Netscape because it's ancient, no longer exists, is
probably riddled with security holes, and anyone using it should be
publicly shamed.
| 5437 | 1 | /** |
| 2 | * @file gtknotify.c GTK+ Notification API | |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
16123
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20113
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20113
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20113
diff
changeset
|
6 | /* pidgin |
| 5437 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
11 | * |
| 5437 | 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:
19832
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5437 | 25 | */ |
| 9791 | 26 | #include "internal.h" |
| 15577 | 27 | #include "pidgin.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
28 | |
| 7455 | 29 | #include <gdk/gdkkeysyms.h> |
| 30 | ||
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
31 | #include "account.h" |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
32 | #include "connection.h" |
|
8284
c4af8a21d5d5
[gaim-migrate @ 9008]
Mark Doliner <markdoliner@pidgin.im>
parents:
8278
diff
changeset
|
33 | #include "debug.h" |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
34 | #include "prefs.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
|
35 | #include "pidginstock.h" |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
36 | #include "util.h" |
| 5437 | 37 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
38 | #include "gtkblist.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
39 | #include "gtknotify.h" |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
40 | #include "gtkpounce.h" |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
41 | #include "gtkutils.h" |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
27504
diff
changeset
|
42 | #include "gtkwebview.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
43 | |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
44 | typedef struct |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
45 | { |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
46 | GtkWidget *window; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
47 | int count; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
48 | } PidginUserInfo; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
49 | |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
50 | typedef struct |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
51 | { |
| 15884 | 52 | PurpleAccount *account; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
53 | char *url; |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
54 | GtkWidget *label; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
55 | int count; |
| 22999 | 56 | gboolean purple_has_handle; |
| 15882 | 57 | } PidginNotifyMailData; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
58 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
59 | typedef struct |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
60 | { |
| 15884 | 61 | PurpleAccount *account; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
62 | PurplePounce *pounce; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
63 | char *pouncee; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
64 | } PidginNotifyPounceData; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
65 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
66 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
67 | typedef struct |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
68 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
69 | PurpleAccount *account; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
70 | GtkListStore *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
71 | GtkWidget *treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
72 | GtkWidget *window; |
| 13641 | 73 | gpointer user_data; |
| 15884 | 74 | PurpleNotifySearchResults *results; |
| 13641 | 75 | |
| 15882 | 76 | } PidginNotifySearchResultsData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
77 | |
| 11359 | 78 | typedef struct |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
79 | { |
| 15884 | 80 | PurpleNotifySearchButton *button; |
| 15882 | 81 | PidginNotifySearchResultsData *data; |
| 11359 | 82 | |
| 15882 | 83 | } PidginNotifySearchResultsButtonData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
84 | |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
85 | enum |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
86 | { |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
87 | PIDGIN_MAIL_ICON, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
88 | PIDGIN_MAIL_TEXT, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
89 | PIDGIN_MAIL_DATA, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
90 | COLUMNS_PIDGIN_MAIL |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
91 | }; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
92 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
93 | enum |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
94 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
95 | PIDGIN_POUNCE_ICON, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
96 | PIDGIN_POUNCE_ALIAS, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
97 | PIDGIN_POUNCE_EVENT, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
98 | PIDGIN_POUNCE_TEXT, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
99 | PIDGIN_POUNCE_DATE, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
100 | PIDGIN_POUNCE_DATA, |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
101 | COLUMNS_PIDGIN_POUNCE |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
102 | }; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
103 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
104 | |
|
27489
6a8a2099b20a
Remove the PidginMailDialog typedef.
Paul Aurich <darkrain42@pidgin.im>
parents:
27488
diff
changeset
|
105 | typedef struct _PidginNotifyDialog |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
106 | { |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
107 | /* |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
108 | * This must be first so PidginNotifyDialog can masquerade as the |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
109 | * dialog widget. |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
110 | */ |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
111 | GtkWidget *dialog; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
112 | GtkWidget *treeview; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
113 | GtkTreeStore *treemodel; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
114 | GtkLabel *label; |
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
115 | GtkWidget *open_button; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
116 | GtkWidget *dismiss_button; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
117 | GtkWidget *edit_button; |
| 15246 | 118 | int total_count; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
119 | gboolean in_use; |
|
27489
6a8a2099b20a
Remove the PidginMailDialog typedef.
Paul Aurich <darkrain42@pidgin.im>
parents:
27488
diff
changeset
|
120 | } PidginNotifyDialog; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
121 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
122 | typedef enum |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
123 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
124 | PIDGIN_NOTIFY_MAIL, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
125 | PIDGIN_NOTIFY_POUNCE, |
|
27254
e1eec4dda0d2
Setting `dialog->open_button = button` when `button` is not yet assigned
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27063
diff
changeset
|
126 | PIDGIN_NOTIFY_TYPES |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
127 | } PidginNotifyType; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
128 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
129 | static PidginNotifyDialog *mail_dialog = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
130 | static PidginNotifyDialog *pounce_dialog = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
131 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
132 | static PidginNotifyDialog *pidgin_create_notification_dialog(PidginNotifyType type); |
| 15884 | 133 | static void *pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
134 | const char **subjects, |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
135 | const char **froms, const char **tos, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
136 | const char **urls); |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
137 | |
| 22999 | 138 | static void pidgin_close_notify(PurpleNotifyType type, void *ui_handle); |
| 139 | ||
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
140 | static void |
|
6354
685303e0c013
[gaim-migrate @ 6853]
Christian Hammond <chipx86@chipx86.com>
parents:
6106
diff
changeset
|
141 | message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
142 | { |
| 15884 | 143 | purple_notify_close(PURPLE_NOTIFY_MESSAGE, widget); |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
144 | } |
|
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
145 | |
|
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
146 | static void |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
147 | pounce_response_close(PidginNotifyDialog *dialog) |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
148 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
149 | GtkTreeIter iter; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
150 | PidginNotifyPounceData *pounce_data; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
151 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
152 | while (gtk_tree_model_get_iter_first( |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
153 | GTK_TREE_MODEL(pounce_dialog->treemodel), &iter)) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
154 | gtk_tree_model_get(GTK_TREE_MODEL(pounce_dialog->treemodel), &iter, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
155 | PIDGIN_POUNCE_DATA, &pounce_data, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
156 | -1); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
157 | gtk_tree_store_remove(dialog->treemodel, &iter); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
158 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
159 | g_free(pounce_data->pouncee); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
160 | g_free(pounce_data); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
161 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
162 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
163 | gtk_widget_destroy(pounce_dialog->dialog); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
164 | g_free(pounce_dialog); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
165 | pounce_dialog = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
166 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
167 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
168 | static void |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
169 | delete_foreach(GtkTreeModel *model, GtkTreePath *path, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
170 | GtkTreeIter *iter, gpointer data) |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
171 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
172 | PidginNotifyPounceData *pounce_data; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
173 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
174 | gtk_tree_model_get(model, iter, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
175 | PIDGIN_POUNCE_DATA, &pounce_data, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
176 | -1); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
177 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
178 | if (pounce_data != NULL) { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
179 | g_free(pounce_data->pouncee); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
180 | g_free(pounce_data); |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
181 | } |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
182 | } |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
183 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
184 | static void |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
185 | open_im_foreach(GtkTreeModel *model, GtkTreePath *path, |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
186 | GtkTreeIter *iter, gpointer data) |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
187 | { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
188 | PidginNotifyPounceData *pounce_data; |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
189 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
190 | gtk_tree_model_get(model, iter, |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
191 | PIDGIN_POUNCE_DATA, &pounce_data, |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
192 | -1); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
193 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
194 | if (pounce_data != NULL) { |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
33796
diff
changeset
|
195 | PurpleIMConversation *im; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
196 | |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
33796
diff
changeset
|
197 | im = purple_im_conversation_new(pounce_data->account, pounce_data->pouncee); |
|
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
33796
diff
changeset
|
198 | purple_conversation_present(PURPLE_CONVERSATION(im)); |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
199 | } |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
200 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
201 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
202 | static void |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
203 | append_to_list(GtkTreeModel *model, GtkTreePath *path, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
204 | GtkTreeIter *iter, gpointer data) |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
205 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
206 | GList **list = data; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
207 | *list = g_list_prepend(*list, gtk_tree_path_copy(path)); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
208 | } |
|
28343
0f91a1031c00
Close the Pounce dialog when you dismiss the last pounce.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
28338
diff
changeset
|
209 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
210 | static void |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
211 | pounce_response_dismiss() |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
212 | { |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
213 | GtkTreeModel *model = GTK_TREE_MODEL(pounce_dialog->treemodel); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
214 | GtkTreeSelection *selection; |
|
28343
0f91a1031c00
Close the Pounce dialog when you dismiss the last pounce.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
28338
diff
changeset
|
215 | GtkTreeIter iter; |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
216 | GtkTreeIter new_selection; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
217 | GList *list = NULL; |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
218 | gboolean found_selection = FALSE; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
219 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
220 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pounce_dialog->treeview)); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
221 | gtk_tree_selection_selected_foreach(selection, delete_foreach, pounce_dialog); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
222 | gtk_tree_selection_selected_foreach(selection, append_to_list, &list); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
223 | |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
224 | g_return_if_fail(list != NULL); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
225 | |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
226 | if (list->next == NULL) { |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
227 | gtk_tree_model_get_iter(model, &new_selection, list->data); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
228 | if (gtk_tree_model_iter_next(model, &new_selection)) |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
229 | found_selection = TRUE; |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
230 | else { |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
231 | /* This is the last thing in the list */ |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
232 | GtkTreePath *path; |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
233 | |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
234 | /* Because gtk_tree_model_iter_prev doesn't exist... */ |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
235 | gtk_tree_model_get_iter(model, &new_selection, list->data); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
236 | path = gtk_tree_model_get_path(model, &new_selection); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
237 | if (gtk_tree_path_prev(path)) { |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
238 | gtk_tree_model_get_iter(model, &new_selection, path); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
239 | found_selection = TRUE; |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
240 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
241 | |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
242 | gtk_tree_path_free(path); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
243 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
244 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
245 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
246 | while (list) { |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
247 | if (gtk_tree_model_get_iter(model, &iter, list->data)) { |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
248 | gtk_tree_store_remove(GTK_TREE_STORE(pounce_dialog->treemodel), &iter); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
249 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
250 | gtk_tree_path_free(list->data); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
251 | list = g_list_delete_link(list, list); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
252 | } |
|
28343
0f91a1031c00
Close the Pounce dialog when you dismiss the last pounce.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
28338
diff
changeset
|
253 | |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
254 | if (gtk_tree_model_get_iter_first(model, &iter)) { |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
255 | if (found_selection) |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
256 | gtk_tree_selection_select_iter(selection, &new_selection); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
257 | else |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
258 | gtk_tree_selection_select_iter(selection, &iter); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
259 | } else |
|
28343
0f91a1031c00
Close the Pounce dialog when you dismiss the last pounce.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
28338
diff
changeset
|
260 | pounce_response_close(pounce_dialog); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
261 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
262 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
263 | static void |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
264 | pounce_response_open_ims() |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
265 | { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
266 | GtkTreeSelection *selection; |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
267 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
268 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pounce_dialog->treeview)); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
269 | gtk_tree_selection_selected_foreach(selection, open_im_foreach, pounce_dialog); |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
270 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
271 | pounce_response_dismiss(); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
272 | } |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
273 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
274 | static void |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
275 | pounce_response_edit_cb(GtkTreeModel *model, GtkTreePath *path, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
276 | GtkTreeIter *iter, gpointer data) |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
277 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
278 | PidginNotifyPounceData *pounce_data; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
279 | PidginNotifyDialog *dialog = (PidginNotifyDialog*)data; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
280 | PurplePounce *pounce; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
281 | GList *list; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
282 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
283 | list = purple_pounces_get_all(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
284 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
285 | gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), iter, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
286 | PIDGIN_POUNCE_DATA, &pounce_data, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
287 | -1); |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
288 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
289 | for (; list != NULL; list = list->next) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
290 | pounce = list->data; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
291 | if (pounce == pounce_data->pounce) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
292 | pidgin_pounce_editor_show(pounce_data->account, NULL, pounce_data->pounce); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
293 | return; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
294 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
295 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
296 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
297 | purple_debug_warning("gtknotify", "Pounce was destroyed.\n"); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
298 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
299 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
300 | static void |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
301 | pounce_response_cb(GtkDialog *dlg, gint id, PidginNotifyDialog *dialog) |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
302 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
303 | GtkTreeSelection *selection = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
304 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
305 | switch (id) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
306 | case GTK_RESPONSE_CLOSE: |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
307 | case GTK_RESPONSE_DELETE_EVENT: |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
308 | pounce_response_close(dialog); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
309 | break; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
310 | case GTK_RESPONSE_YES: |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
311 | pounce_response_open_ims(); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
312 | break; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
313 | case GTK_RESPONSE_NO: |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
314 | pounce_response_dismiss(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
315 | break; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
316 | case GTK_RESPONSE_APPLY: |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
317 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
318 | gtk_tree_selection_selected_foreach(selection, pounce_response_edit_cb, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
319 | dialog); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
320 | break; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
321 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
322 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
323 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
324 | static void |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
325 | pounce_row_selected_cb(GtkTreeView *tv, GtkTreePath *path, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
326 | GtkTreeViewColumn *col, gpointer data) |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
327 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
328 | GtkTreeSelection *selection; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
329 | int count; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
330 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
331 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pounce_dialog->treeview)); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
332 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
333 | count = gtk_tree_selection_count_selected_rows(selection); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
334 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
335 | if (count == 0) { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
336 | gtk_widget_set_sensitive(pounce_dialog->open_button, FALSE); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
337 | gtk_widget_set_sensitive(pounce_dialog->edit_button, FALSE); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
338 | gtk_widget_set_sensitive(pounce_dialog->dismiss_button, FALSE); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
339 | } else if (count == 1) { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
340 | GList *pounces; |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
341 | GList *list; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
342 | PidginNotifyPounceData *pounce_data; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
343 | GtkTreeIter iter; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
344 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
345 | list = gtk_tree_selection_get_selected_rows(selection, NULL); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
346 | gtk_tree_model_get_iter(GTK_TREE_MODEL(pounce_dialog->treemodel), |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
347 | &iter, list->data); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
348 | gtk_tree_model_get(GTK_TREE_MODEL(pounce_dialog->treemodel), &iter, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
349 | PIDGIN_POUNCE_DATA, &pounce_data, |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
350 | -1); |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
351 | g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
352 | g_list_free(list); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
353 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
354 | pounces = purple_pounces_get_all(); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
355 | for (; pounces != NULL; pounces = pounces->next) { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
356 | PurplePounce *pounce = pounces->data; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
357 | if (pounce == pounce_data->pounce) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
358 | gtk_widget_set_sensitive(pounce_dialog->edit_button, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
359 | break; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
360 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
361 | } |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
362 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
363 | gtk_widget_set_sensitive(pounce_dialog->open_button, TRUE); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
364 | gtk_widget_set_sensitive(pounce_dialog->dismiss_button, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
365 | } else { |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
366 | gtk_widget_set_sensitive(pounce_dialog->open_button, TRUE); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
367 | gtk_widget_set_sensitive(pounce_dialog->edit_button, FALSE); |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
368 | gtk_widget_set_sensitive(pounce_dialog->dismiss_button, TRUE); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
369 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
370 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
371 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
372 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
373 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
374 | static void |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
375 | reset_mail_dialog(GtkDialog *unused) |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
376 | { |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
377 | g_return_if_fail(mail_dialog != NULL); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
378 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
379 | if (mail_dialog->in_use) |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
380 | return; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
381 | gtk_widget_destroy(mail_dialog->dialog); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
382 | g_free(mail_dialog); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
383 | mail_dialog = NULL; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
384 | purple_signal_emit(purple_notify_get_handle(), "displaying-emails-clear"); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
385 | } |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
386 | |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
387 | gboolean |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
388 | pidgin_notify_emails_pending() |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
389 | { |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
390 | return mail_dialog != NULL |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
391 | && !gtk_widget_get_visible(mail_dialog->dialog); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
392 | } |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
393 | |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
394 | void pidgin_notify_emails_present(void *data) |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
395 | { |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
396 | if (pidgin_notify_emails_pending()) { |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
397 | gtk_widget_show_all(mail_dialog->dialog); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
398 | mail_dialog->in_use = TRUE; |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
399 | pidgin_blist_set_headline(NULL, NULL, NULL, NULL, NULL); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
400 | mail_dialog->in_use = FALSE; |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
401 | } |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
402 | purple_signal_emit(purple_notify_get_handle(), "displaying-emails-clear"); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
403 | } |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
404 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
405 | static void |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
406 | email_response_cb(GtkDialog *unused, gint id, PidginNotifyDialog *unused2) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
407 | { |
| 15882 | 408 | PidginNotifyMailData *data = NULL; |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
409 | GtkTreeModel *model = GTK_TREE_MODEL(mail_dialog->treemodel); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
410 | GtkTreeIter iter; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
411 | |
|
10260
76253312081f
[gaim-migrate @ 11403]
Matthew A. Nicholson <therealman11@users.sourceforge.net>
parents:
10240
diff
changeset
|
412 | if (id == GTK_RESPONSE_YES) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
413 | { |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
414 | /* A single row activated. Remove that row. */ |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
415 | GtkTreeSelection *selection; |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
416 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
417 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mail_dialog->treeview)); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
418 | |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
419 | if (gtk_tree_selection_get_selected(selection, NULL, &iter)) |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
420 | { |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
421 | gtk_tree_model_get(model, &iter, PIDGIN_MAIL_DATA, &data, -1); |
| 15884 | 422 | purple_notify_uri(NULL, data->url); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
423 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
424 | gtk_tree_store_remove(mail_dialog->treemodel, &iter); |
|
24194
e9b2e5b544c9
Some cleanup and a little leak fix that I thought I committed a while ago.
Daniel Atallah <datallah@pidgin.im>
parents:
24193
diff
changeset
|
425 | if (data->purple_has_handle) |
|
e9b2e5b544c9
Some cleanup and a little leak fix that I thought I committed a while ago.
Daniel Atallah <datallah@pidgin.im>
parents:
24193
diff
changeset
|
426 | purple_notify_close(PURPLE_NOTIFY_EMAILS, data); |
|
e9b2e5b544c9
Some cleanup and a little leak fix that I thought I committed a while ago.
Daniel Atallah <datallah@pidgin.im>
parents:
24193
diff
changeset
|
427 | else |
|
e9b2e5b544c9
Some cleanup and a little leak fix that I thought I committed a while ago.
Daniel Atallah <datallah@pidgin.im>
parents:
24193
diff
changeset
|
428 | pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
429 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
430 | if (gtk_tree_model_get_iter_first(model, &iter)) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
431 | return; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
432 | } |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
433 | else |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
434 | return; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
435 | } |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
436 | else |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
437 | { |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
438 | /* Remove all the rows */ |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
439 | while (gtk_tree_model_get_iter_first(model, &iter)) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
440 | { |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
441 | gtk_tree_model_get(model, &iter, PIDGIN_MAIL_DATA, &data, -1); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
442 | |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
443 | if (id == GTK_RESPONSE_ACCEPT) |
| 15884 | 444 | purple_notify_uri(NULL, data->url); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
445 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
446 | gtk_tree_store_remove(mail_dialog->treemodel, &iter); |
| 22999 | 447 | if (data->purple_has_handle) |
| 448 | purple_notify_close(PURPLE_NOTIFY_EMAILS, data); | |
| 449 | else | |
| 450 | pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); | |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
451 | } |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
452 | } |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
453 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
454 | reset_mail_dialog(NULL); |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
455 | } |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
456 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
457 | static void |
|
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
458 | email_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, |
|
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
459 | GtkTreeViewColumn *col, gpointer data) |
|
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
460 | { |
|
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
461 | email_response_cb(NULL, GTK_RESPONSE_YES, NULL); |
|
19431
99985a434ef8
Open emails by doubleclicking the row.
Daniel Atallah <datallah@pidgin.im>
parents:
19222
diff
changeset
|
462 | } |
|
99985a434ef8
Open emails by doubleclicking the row.
Daniel Atallah <datallah@pidgin.im>
parents:
19222
diff
changeset
|
463 | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22007
diff
changeset
|
464 | static gboolean |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
465 | formatted_close_cb(GtkWidget *win, GdkEvent *event, void *user_data) |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
466 | { |
| 15884 | 467 | purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22007
diff
changeset
|
468 | return FALSE; |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
469 | } |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
470 | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22007
diff
changeset
|
471 | static gboolean |
| 15882 | 472 | searchresults_close_cb(PidginNotifySearchResultsData *data, GdkEvent *event, gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
473 | { |
| 15884 | 474 | purple_notify_close(PURPLE_NOTIFY_SEARCHRESULTS, data); |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22007
diff
changeset
|
475 | return FALSE; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
476 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
477 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
478 | static void |
| 15882 | 479 | searchresults_callback_wrapper_cb(GtkWidget *widget, PidginNotifySearchResultsButtonData *bd) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
480 | { |
| 15882 | 481 | PidginNotifySearchResultsData *data = bd->data; |
| 11359 | 482 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
483 | GtkTreeSelection *selection; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
484 | GtkTreeModel *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
485 | GtkTreeIter iter; |
| 15884 | 486 | PurpleNotifySearchButton *button; |
| 11359 | 487 | GList *row = NULL; |
| 488 | gchar *str; | |
| 489 | int i; | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
490 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
491 | g_return_if_fail(data != NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
492 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
493 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->treeview)); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
494 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
495 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
496 | { |
| 11359 | 497 | for (i = 1; i < gtk_tree_model_get_n_columns(GTK_TREE_MODEL(model)); i++) { |
| 498 | gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, i, &str, -1); | |
| 499 | row = g_list_append(row, str); | |
| 500 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
501 | } |
| 11359 | 502 | |
| 503 | button = bd->button; | |
| 15884 | 504 | button->callback(purple_account_get_connection(data->account), row, data->user_data); |
|
14037
d034d4d2070e
[gaim-migrate @ 16533]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13641
diff
changeset
|
505 | g_list_foreach(row, (GFunc)g_free, NULL); |
|
d034d4d2070e
[gaim-migrate @ 16533]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13641
diff
changeset
|
506 | g_list_free(row); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
507 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
508 | |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
509 | /* copy-paste from gtkrequest.c */ |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
510 | static void |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
511 | pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account) |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
512 | { |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
513 | GtkWidget *image; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
514 | GdkPixbuf *pixbuf; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
515 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
516 | if (!account) |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
517 | return; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
518 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
519 | pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
520 | image = gtk_image_new_from_pixbuf(pixbuf); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
521 | g_object_unref(G_OBJECT(pixbuf)); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
522 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
523 | gtk_widget_set_tooltip_text(image, |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
524 | purple_account_get_username(account)); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
525 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
526 | if (GTK_IS_DIALOG(cont)) { |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
527 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_action_area( |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
528 | GTK_DIALOG(cont))), image, FALSE, TRUE, 0); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
529 | gtk_box_reorder_child(GTK_BOX(gtk_dialog_get_action_area( |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
530 | GTK_DIALOG(cont))), image, 0); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
531 | } else if (GTK_IS_HBOX(cont)) { |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
532 | gtk_misc_set_alignment(GTK_MISC(image), 0, 0); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
533 | gtk_box_pack_end(GTK_BOX(cont), image, FALSE, TRUE, 0); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
534 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
535 | gtk_widget_show(image); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
536 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
537 | |
| 5437 | 538 | static void * |
| 15884 | 539 | pidgin_notify_message(PurpleNotifyMsgType type, const char *title, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
540 | const char *primary, const char *secondary, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
541 | PurpleRequestCommonParameters *cpar) |
| 5437 | 542 | { |
| 14865 | 543 | GtkWidget *dialog; |
| 544 | GtkWidget *hbox; | |
| 545 | GtkWidget *label; | |
| 546 | GtkWidget *img = NULL; | |
| 547 | char label_text[2048]; | |
| 548 | const char *icon_name = NULL; | |
| 549 | char *primary_esc, *secondary_esc; | |
| 5437 | 550 | |
| 14865 | 551 | switch (type) |
| 552 | { | |
| 15884 | 553 | case PURPLE_NOTIFY_MSG_ERROR: |
| 15497 | 554 | icon_name = PIDGIN_STOCK_DIALOG_ERROR; |
| 14865 | 555 | break; |
| 5437 | 556 | |
| 15884 | 557 | case PURPLE_NOTIFY_MSG_WARNING: |
| 15497 | 558 | icon_name = PIDGIN_STOCK_DIALOG_WARNING; |
| 14865 | 559 | break; |
| 5437 | 560 | |
| 15884 | 561 | case PURPLE_NOTIFY_MSG_INFO: |
| 15497 | 562 | icon_name = PIDGIN_STOCK_DIALOG_INFO; |
| 14865 | 563 | break; |
| 5437 | 564 | |
| 14865 | 565 | default: |
| 566 | icon_name = NULL; | |
| 567 | break; | |
| 568 | } | |
| 5437 | 569 | |
| 14865 | 570 | if (icon_name != NULL) |
| 571 | { | |
| 15497 | 572 | img = gtk_image_new_from_stock(icon_name, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); |
| 14865 | 573 | gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
| 574 | } | |
| 5437 | 575 | |
| 15882 | 576 | dialog = gtk_dialog_new_with_buttons(title ? title : PIDGIN_ALERT_TITLE, |
| 14865 | 577 | NULL, 0, GTK_STOCK_CLOSE, |
| 578 | GTK_RESPONSE_CLOSE, NULL); | |
| 579 | ||
| 580 | gtk_window_set_role(GTK_WINDOW(dialog), "notify_dialog"); | |
| 581 | ||
| 582 | g_signal_connect(G_OBJECT(dialog), "response", | |
| 583 | G_CALLBACK(message_response_cb), dialog); | |
| 584 | ||
| 15882 | 585 | gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER); |
| 14865 | 586 | gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
587 | gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), |
|
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
588 | PIDGIN_HIG_BORDER); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30812
diff
changeset
|
589 | gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
590 | PIDGIN_HIG_BOX_SPACE); |
| 14865 | 591 | |
| 15882 | 592 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30812
diff
changeset
|
593 | gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
594 | hbox); |
| 5437 | 595 | |
| 14865 | 596 | if (img != NULL) |
| 597 | gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
| 5437 | 598 | |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
599 | pidgin_widget_decorate_account(hbox, |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
600 | purple_request_cpar_get_account(cpar)); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
601 | |
| 14865 | 602 | primary_esc = g_markup_escape_text(primary, -1); |
| 603 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
| 604 | g_snprintf(label_text, sizeof(label_text), | |
|
20869
e2db8ce46cda
If there is no secondary text in a notify, avoid adding "\n\n" and creating
Richard Laager <rlaager@pidgin.im>
parents:
20791
diff
changeset
|
605 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
e2db8ce46cda
If there is no secondary text in a notify, avoid adding "\n\n" and creating
Richard Laager <rlaager@pidgin.im>
parents:
20791
diff
changeset
|
606 | primary_esc, (secondary ? "\n\n" : ""), |
|
e2db8ce46cda
If there is no secondary text in a notify, avoid adding "\n\n" and creating
Richard Laager <rlaager@pidgin.im>
parents:
20791
diff
changeset
|
607 | (secondary ? secondary_esc : "")); |
| 14865 | 608 | g_free(primary_esc); |
| 609 | g_free(secondary_esc); | |
| 5437 | 610 | |
| 14865 | 611 | label = gtk_label_new(NULL); |
| 5437 | 612 | |
| 14865 | 613 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
| 614 | gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
|
19222
f0fa371d6752
Allow notification labels to be selectable (for copy-and-paste purposes). Fixes #563.
Daniel Atallah <datallah@pidgin.im>
parents:
18802
diff
changeset
|
615 | gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
| 14865 | 616 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
| 617 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 5437 | 618 | |
|
34451
b7165d4e1d73
Implement purple_*_is_valid_ui_handle, purple_request_cpar_*et_parent_from, pidgin_request_get_dialog_window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34450
diff
changeset
|
619 | g_object_set_data(G_OBJECT(dialog), "pidgin-parent-from", |
|
b7165d4e1d73
Implement purple_*_is_valid_ui_handle, purple_request_cpar_*et_parent_from, pidgin_request_get_dialog_window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34450
diff
changeset
|
620 | purple_request_cpar_get_parent_from(cpar)); |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
621 | pidgin_auto_parent_window(dialog); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
622 | |
| 14865 | 623 | gtk_widget_show_all(dialog); |
| 5437 | 624 | |
| 14865 | 625 | return dialog; |
| 5437 | 626 | } |
| 627 | ||
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
628 | static void |
|
27489
6a8a2099b20a
Remove the PidginMailDialog typedef.
Paul Aurich <darkrain42@pidgin.im>
parents:
27488
diff
changeset
|
629 | selection_changed_cb(GtkTreeSelection *sel, PidginNotifyDialog *dialog) |
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
630 | { |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
631 | GtkTreeIter iter; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
632 | GtkTreeModel *model; |
| 15882 | 633 | PidginNotifyMailData *data; |
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
634 | gboolean active = TRUE; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
635 | |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
636 | if (gtk_tree_selection_get_selected(sel, &model, &iter) == FALSE) |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
637 | active = FALSE; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
638 | else |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
639 | { |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
640 | gtk_tree_model_get(model, &iter, PIDGIN_MAIL_DATA, &data, -1); |
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
641 | if (data->url == NULL) |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
642 | active = FALSE; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
643 | } |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
644 | |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
645 | gtk_widget_set_sensitive(dialog->open_button, active); |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
646 | } |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
647 | |
| 5437 | 648 | static void * |
| 15884 | 649 | pidgin_notify_email(PurpleConnection *gc, const char *subject, const char *from, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
650 | const char *to, const char *url) |
| 5437 | 651 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
652 | return pidgin_notify_emails(gc, 1, (subject != NULL), |
|
5524
753be2126684
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
653 | (subject == NULL ? NULL : &subject), |
|
753be2126684
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
654 | (from == NULL ? NULL : &from), |
|
753be2126684
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
655 | (to == NULL ? NULL : &to), |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
656 | (url == NULL ? NULL : &url)); |
| 5437 | 657 | } |
| 658 | ||
|
15789
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
659 | static int |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
660 | mail_window_focus_cb(GtkWidget *widget, GdkEventFocus *focus, gpointer null) |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
661 | { |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
662 | pidgin_set_urgent(GTK_WINDOW(widget), FALSE); |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
663 | return 0; |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
664 | } |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
665 | |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
666 | /* count == 0 means this is a detailed mail notification. |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
667 | * count > 0 mean non-detailed. |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
668 | */ |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
669 | static void * |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
670 | pidgin_notify_add_mail(GtkTreeStore *treemodel, PurpleAccount *account, char *notification, const char *url, int count, gboolean clear, gboolean *new_data) |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
671 | { |
| 15882 | 672 | PidginNotifyMailData *data = NULL; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
673 | GtkTreeIter iter; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
674 | GdkPixbuf *icon; |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
675 | gboolean new_n = TRUE; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
676 | |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
677 | if (count > 0 || clear) { |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
678 | /* Allow only one non-detailed email notification for each account */ |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
679 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(treemodel), &iter)) { |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
680 | gboolean advanced; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
681 | do { |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
682 | advanced = FALSE; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
683 | gtk_tree_model_get(GTK_TREE_MODEL(treemodel), &iter, |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
684 | PIDGIN_MAIL_DATA, &data, -1); |
|
27470
328658067ce6
Avoid a null deref when clearing mail notifications. Refs #9345.
Paul Aurich <darkrain42@pidgin.im>
parents:
27410
diff
changeset
|
685 | if (data && data->account == account) { |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
686 | if (clear) { |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
687 | advanced = gtk_tree_store_remove(treemodel, &iter); |
|
27492
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
688 | mail_dialog->total_count -= data->count; |
|
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
689 | |
|
27410
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
690 | if (data->purple_has_handle) |
|
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
691 | purple_notify_close(PURPLE_NOTIFY_EMAILS, data); |
|
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
692 | else |
|
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
693 | pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
694 | /* We're completely done if we've processed all entries */ |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
695 | if (!advanced) |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
696 | return NULL; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
697 | } else if (data->count > 0) { |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
698 | new_n = FALSE; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
699 | g_free(data->url); |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
700 | data->url = NULL; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
701 | mail_dialog->total_count -= data->count; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
702 | break; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
703 | } |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
704 | } |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
705 | } while (advanced || gtk_tree_model_iter_next(GTK_TREE_MODEL(treemodel), &iter)); |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
706 | } |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
707 | } |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
708 | |
|
20149
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
709 | if (clear) |
|
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
710 | return NULL; |
|
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
711 | |
|
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
712 | icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM); |
|
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
713 | |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
714 | if (new_n) { |
| 15882 | 715 | data = g_new0(PidginNotifyMailData, 1); |
| 22999 | 716 | data->purple_has_handle = TRUE; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
717 | gtk_tree_store_append(treemodel, &iter, NULL); |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
718 | } |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
719 | |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
720 | if (url != NULL) |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
721 | data->url = g_strdup(url); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
722 | |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
723 | gtk_tree_store_set(treemodel, &iter, |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
724 | PIDGIN_MAIL_ICON, icon, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
725 | PIDGIN_MAIL_TEXT, notification, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
726 | PIDGIN_MAIL_DATA, data, |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
727 | -1); |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
728 | data->account = account; |
|
27492
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
729 | /* count == 0 indicates we're adding a single detailed e-mail */ |
|
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
730 | data->count = count > 0 ? count : 1; |
| 22999 | 731 | |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
732 | if (icon) |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
733 | g_object_unref(icon); |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
734 | |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
735 | if (new_data) |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
736 | *new_data = new_n; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
737 | return data; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
738 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
739 | |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
740 | static void * |
| 15884 | 741 | pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
742 | const char **subjects, const char **froms, |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
743 | const char **tos, const char **urls) |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
744 | { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
745 | char *notification; |
| 15884 | 746 | PurpleAccount *account; |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
747 | PidginNotifyMailData *data = NULL, *data2; |
|
27410
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
748 | gboolean new_data = FALSE; |
|
32765
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
749 | GtkTreeSelection *sel; |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
750 | GtkTreeIter iter; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
751 | |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
752 | /* Don't bother updating if there aren't new emails and we don't have any displayed currently */ |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
753 | if (count == 0 && mail_dialog == NULL) |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
754 | return NULL; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
755 | |
| 15884 | 756 | account = purple_connection_get_account(gc); |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
757 | if (mail_dialog == NULL) |
|
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
758 | mail_dialog = pidgin_create_notification_dialog(PIDGIN_NOTIFY_MAIL); |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
759 | |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
760 | mail_dialog->total_count += count; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
761 | if (detailed) { |
|
27492
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
762 | for ( ; count; --count) { |
|
13414
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
763 | char *to_text = NULL; |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
764 | char *from_text = NULL; |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
765 | char *subject_text = NULL; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
766 | char *tmp; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
767 | gboolean first = TRUE; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
768 | |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
769 | if (tos != NULL) { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
770 | tmp = g_markup_escape_text(*tos, -1); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
771 | to_text = g_strdup_printf("<b>%s</b>: %s\n", _("Account"), tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
772 | g_free(tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
773 | first = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
774 | tos++; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
775 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
776 | if (froms != NULL) { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
777 | tmp = g_markup_escape_text(*froms, -1); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
778 | from_text = g_strdup_printf("%s<b>%s</b>: %s\n", first ? "<br>" : "", _("Sender"), tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
779 | g_free(tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
780 | first = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
781 | froms++; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
782 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
783 | if (subjects != NULL) { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
784 | tmp = g_markup_escape_text(*subjects, -1); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
785 | subject_text = g_strdup_printf("%s<b>%s</b>: %s", first ? "<br>" : "", _("Subject"), tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
786 | g_free(tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
787 | first = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
788 | subjects++; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
789 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
790 | #define SAFE(x) ((x) ? (x) : "") |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
791 | notification = g_strdup_printf("%s%s%s", SAFE(to_text), SAFE(from_text), SAFE(subject_text)); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
792 | #undef SAFE |
|
13414
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
793 | g_free(to_text); |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
794 | g_free(from_text); |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
795 | g_free(subject_text); |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
796 | |
| 22999 | 797 | /* If we don't keep track of this, will leak "data" for each of the notifications except the last */ |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
798 | data2 = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE, &new_data); |
|
27410
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
799 | if (data2 && new_data) { |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
800 | if (data) |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
801 | data->purple_has_handle = FALSE; |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
802 | data = data2; |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
803 | } |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
804 | g_free(notification); |
|
13414
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
805 | |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
806 | if (urls != NULL) |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
807 | urls++; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
808 | } |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
809 | } else { |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
810 | if (count > 0) { |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
811 | notification = g_strdup_printf(ngettext("%s has %d new message.", |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
812 | "%s has %d new messages.", |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
813 | (int)count), |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
814 | *tos, (int)count); |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
815 | data2 = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, count, FALSE, &new_data); |
|
27410
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
816 | if (data2 && new_data) { |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
817 | if (data) |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
818 | data->purple_has_handle = FALSE; |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
819 | data = data2; |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
820 | } |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
821 | g_free(notification); |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
822 | } else { |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
823 | /* Clear out all mails for the account */ |
|
23031
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
824 | pidgin_notify_add_mail(mail_dialog->treemodel, account, NULL, NULL, 0, TRUE, NULL); |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
825 | |
|
27492
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
826 | if (mail_dialog->total_count == 0) { |
|
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
827 | /* |
|
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
828 | * There is no API to clear the headline specifically |
|
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
829 | * This will trigger reset_mail_dialog() |
|
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
830 | */ |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
831 | pidgin_blist_set_headline(NULL, NULL, NULL, NULL, NULL); |
|
20149
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
832 | return NULL; |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
833 | } |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
834 | } |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
835 | } |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
836 | |
|
32765
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
837 | /* Select first item if nothing selected */ |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
838 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(mail_dialog->treeview)); |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
839 | if ((gtk_tree_selection_count_selected_rows(sel) < 1) |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
840 | && gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
841 | gtk_tree_selection_select_iter(sel, &iter); |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
842 | } |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
843 | |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32912
diff
changeset
|
844 | if (!gtk_widget_get_visible(mail_dialog->dialog)) { |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
845 | GdkPixbuf *pixbuf = gtk_widget_render_icon(mail_dialog->dialog, PIDGIN_STOCK_DIALOG_MAIL, |
| 15497 | 846 | gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23031
diff
changeset
|
847 | char *label_text = g_strdup_printf(ngettext("<b>%d new email.</b>", |
|
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23031
diff
changeset
|
848 | "<b>%d new emails.</b>", |
| 15246 | 849 | mail_dialog->total_count), mail_dialog->total_count); |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
850 | mail_dialog->in_use = TRUE; /* So that _set_headline doesn't accidentally |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
851 | remove the notifications when replacing an |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
852 | old notification. */ |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
853 | pidgin_blist_set_headline(label_text, |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
854 | pixbuf, G_CALLBACK(pidgin_notify_emails_present), mail_dialog->dialog, |
|
15386
2cfff7893ed0
[gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15275
diff
changeset
|
855 | (GDestroyNotify)reset_mail_dialog); |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
856 | mail_dialog->in_use = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
857 | g_free(label_text); |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
858 | if (pixbuf) |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
859 | g_object_unref(pixbuf); |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32912
diff
changeset
|
860 | } else if (!gtk_widget_has_focus(mail_dialog->dialog)) |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
861 | pidgin_set_urgent(GTK_WINDOW(mail_dialog->dialog), TRUE); |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
862 | |
| 22999 | 863 | return data; |
| 5437 | 864 | } |
| 865 | ||
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
866 | static gboolean |
|
10875
bd4a5904e395
[gaim-migrate @ 12566]
Daniel Atallah <datallah@pidgin.im>
parents:
10774
diff
changeset
|
867 | formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) |
| 7455 | 868 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30812
diff
changeset
|
869 | if (event->keyval == GDK_KEY_Escape) |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
870 | { |
| 15884 | 871 | purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
872 | |
| 7455 | 873 | return TRUE; |
| 874 | } | |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
875 | |
| 7455 | 876 | return FALSE; |
| 877 | } | |
| 878 | ||
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
879 | static void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
880 | pidgin_notify_formatted(const char *title, const char *primary, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
881 | const char *secondary, const char *text) |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
882 | { |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
883 | GtkWidget *window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
884 | GtkWidget *vbox; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
885 | GtkWidget *label; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
886 | GtkWidget *button; |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
27504
diff
changeset
|
887 | GtkWidget *web_view; |
|
10181
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
888 | GtkWidget *frame; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
889 | char label_text[2048]; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
890 | char *linked_text, *primary_esc, *secondary_esc; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
891 | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
892 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
893 | gtk_window_set_title(GTK_WINDOW(window), title); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
894 | #if !GTK_CHECK_VERSION(3,0,0) |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
895 | gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
896 | #endif |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
897 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
898 | |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
899 | g_signal_connect(G_OBJECT(window), "delete_event", |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
900 | G_CALLBACK(formatted_close_cb), NULL); |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
901 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
902 | /* Setup the main vbox */ |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30812
diff
changeset
|
903 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
904 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
905 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
906 | primary_esc = g_markup_escape_text(primary, -1); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
907 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
908 | g_snprintf(label_text, sizeof(label_text), |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
909 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
910 | primary_esc, |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
911 | (secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
912 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
913 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
914 | g_free(secondary_esc); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
915 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
916 | label = gtk_label_new(NULL); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
917 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
918 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
919 | gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
|
19222
f0fa371d6752
Allow notification labels to be selectable (for copy-and-paste purposes). Fixes #563.
Daniel Atallah <datallah@pidgin.im>
parents:
18802
diff
changeset
|
920 | gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
921 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
922 | gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
923 | gtk_widget_show(label); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
924 | |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
27504
diff
changeset
|
925 | /* Add the webview */ |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33796
diff
changeset
|
926 | frame = pidgin_create_webview(FALSE, &web_view, NULL); |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
27504
diff
changeset
|
927 | gtk_widget_set_name(web_view, "pidgin_notify_webview"); |
|
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
27504
diff
changeset
|
928 | gtk_widget_set_size_request(web_view, 300, 250); |
|
10181
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
929 | gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
|
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
930 | gtk_widget_show(frame); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
931 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
932 | /* Add the Close button. */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
933 | button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); |
|
19222
f0fa371d6752
Allow notification labels to be selectable (for copy-and-paste purposes). Fixes #563.
Daniel Atallah <datallah@pidgin.im>
parents:
18802
diff
changeset
|
934 | gtk_widget_grab_focus(button); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
935 | |
| 6872 | 936 | g_signal_connect_swapped(G_OBJECT(button), "clicked", |
|
24658
fdfbe4a9b77c
Fix an assertion failure/unlikely crash when:
Mark Doliner <markdoliner@pidgin.im>
parents:
24194
diff
changeset
|
937 | G_CALLBACK(formatted_close_cb), window); |
| 7455 | 938 | g_signal_connect(G_OBJECT(window), "key_press_event", |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
939 | G_CALLBACK(formatted_input_cb), NULL); |
| 7455 | 940 | |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
941 | /* Make sure URLs are clickable */ |
| 15884 | 942 | linked_text = purple_markup_linkify(text); |
|
32993
d6da54acf528
Remove _with_imgstore suffix on this function. There isn't a version
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
943 | gtk_webview_load_html_string(GTK_WEBVIEW(web_view), linked_text); |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
944 | g_free(linked_text); |
| 7078 | 945 | |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
27504
diff
changeset
|
946 | g_object_set_data(G_OBJECT(window), "webview-widget", web_view); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
947 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
948 | /* Show the window */ |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
949 | pidgin_auto_parent_window(window); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
950 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
951 | gtk_widget_show(window); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
952 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
953 | return window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
954 | } |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
955 | |
| 11359 | 956 | static void |
| 15884 | 957 | pidgin_notify_searchresults_new_rows(PurpleConnection *gc, PurpleNotifySearchResults *results, |
| 13641 | 958 | void *data_) |
| 11359 | 959 | { |
| 15882 | 960 | PidginNotifySearchResultsData *data = data_; |
| 11359 | 961 | GtkListStore *model = data->model; |
| 962 | GtkTreeIter iter; | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
963 | GdkPixbuf *pixbuf; |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
964 | GList *row, *column; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
965 | guint n; |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
966 | |
| 11359 | 967 | gtk_list_store_clear(data->model); |
| 968 | ||
|
33793
f98089ae0e01
Fix some leftover uses of the (very) old scaling API that were using 0.5 instead of PIDGIN_PRPL_ICON_SMALL
Daniel Atallah <datallah@pidgin.im>
parents:
31565
diff
changeset
|
969 | pixbuf = pidgin_create_prpl_icon(purple_connection_get_account(gc), PIDGIN_PRPL_ICON_SMALL); |
| 11359 | 970 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
971 | for (row = results->rows; row != NULL; row = row->next) { |
| 11359 | 972 | |
| 973 | gtk_list_store_append(model, &iter); | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
974 | gtk_list_store_set(model, &iter, 0, pixbuf, -1); |
| 11359 | 975 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
976 | n = 1; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
977 | for (column = row->data; column != NULL; column = column->next) { |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
978 | GValue v; |
| 11359 | 979 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
980 | v.g_type = 0; |
| 11359 | 981 | g_value_init(&v, G_TYPE_STRING); |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
982 | g_value_set_string(&v, column->data); |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
983 | gtk_list_store_set_value(model, &iter, n, &v); |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
984 | n++; |
| 11359 | 985 | } |
| 986 | } | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
987 | |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
988 | if (pixbuf != NULL) |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
989 | g_object_unref(pixbuf); |
| 11359 | 990 | } |
| 991 | ||
| 9797 | 992 | static void * |
| 15884 | 993 | pidgin_notify_searchresults(PurpleConnection *gc, const char *title, |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
994 | const char *primary, const char *secondary, |
| 15884 | 995 | PurpleNotifySearchResults *results, gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
996 | { |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
997 | GtkWidget *window; |
| 11359 | 998 | GtkWidget *treeview; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
999 | GtkWidget *close_button; |
| 11359 | 1000 | GType *col_types; |
| 1001 | GtkListStore *model; | |
| 1002 | GtkCellRenderer *renderer; | |
| 12257 | 1003 | guint col_num; |
|
20980
1599801ecbae
Fix pidgin_notify_searchresults to use the actual title for column headers,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20791
diff
changeset
|
1004 | GList *columniter; |
| 12257 | 1005 | guint i; |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
24658
diff
changeset
|
1006 | GList *l; |
| 11359 | 1007 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1008 | GtkWidget *vbox; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1009 | GtkWidget *label; |
| 15882 | 1010 | PidginNotifySearchResultsData *data; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1011 | char *label_text; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1012 | char *primary_esc, *secondary_esc; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1013 | |
| 12257 | 1014 | g_return_val_if_fail(gc != NULL, NULL); |
| 1015 | g_return_val_if_fail(results != NULL, NULL); | |
| 1016 | ||
| 15882 | 1017 | data = g_malloc(sizeof(PidginNotifySearchResultsData)); |
| 13641 | 1018 | data->user_data = user_data; |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
1019 | data->results = results; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1020 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1021 | /* Create the window */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1022 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1023 | gtk_window_set_title(GTK_WINDOW(window), title ? title :_("Search Results")); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1024 | gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1025 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1026 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1027 | g_signal_connect_swapped(G_OBJECT(window), "delete_event", |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1028 | G_CALLBACK(searchresults_close_cb), data); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1029 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1030 | /* Setup the main vbox */ |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30812
diff
changeset
|
1031 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1032 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1033 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1034 | primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1035 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1036 | label_text = g_strdup_printf( |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1037 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1038 | (primary ? primary_esc : ""), |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1039 | (primary && secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1040 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1041 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1042 | g_free(secondary_esc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1043 | label = gtk_label_new(NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1044 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1045 | gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1046 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1047 | gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1048 | gtk_widget_show(label); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1049 | g_free(label_text); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1050 | |
| 11359 | 1051 | /* +1 is for the automagically created Status column. */ |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
1052 | col_num = g_list_length(results->columns) + 1; |
| 11359 | 1053 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1054 | /* Setup the list model */ |
| 11359 | 1055 | col_types = g_new0(GType, col_num); |
| 1056 | ||
| 1057 | /* There always is this first column. */ | |
| 1058 | col_types[0] = GDK_TYPE_PIXBUF; | |
| 1059 | for (i = 1; i < col_num; i++) { | |
| 1060 | col_types[i] = G_TYPE_STRING; | |
| 1061 | } | |
| 1062 | model = gtk_list_store_newv(col_num, col_types); | |
| 22999 | 1063 | g_free(col_types); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1064 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1065 | /* Setup the treeview */ |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1066 | treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); |
|
22214
e8a9916cb99e
It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
1067 | g_object_unref(G_OBJECT(model)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1068 | gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
| 11359 | 1069 | gtk_widget_set_size_request(treeview, 500, 400); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1070 | gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1071 | GTK_SELECTION_SINGLE); |
| 11359 | 1072 | gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), TRUE); |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30812
diff
changeset
|
1073 | gtk_box_pack_start(GTK_BOX(vbox), |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30812
diff
changeset
|
1074 | pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30812
diff
changeset
|
1075 | TRUE, TRUE, 0); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1076 | gtk_widget_show(treeview); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1077 | |
| 11359 | 1078 | renderer = gtk_cell_renderer_pixbuf_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1079 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
| 11359 | 1080 | -1, "", renderer, "pixbuf", 0, NULL); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1081 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
1082 | i = 1; |
|
20980
1599801ecbae
Fix pidgin_notify_searchresults to use the actual title for column headers,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20791
diff
changeset
|
1083 | for (columniter = results->columns; columniter != NULL; columniter = columniter->next) { |
|
1599801ecbae
Fix pidgin_notify_searchresults to use the actual title for column headers,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20791
diff
changeset
|
1084 | PurpleNotifySearchColumn *column = columniter->data; |
| 11359 | 1085 | renderer = gtk_cell_renderer_text_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1086 | |
| 11359 | 1087 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, |
|
32691
d6eb58903f8b
Hide struct PurpleNotifySearchColumn.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1088 | purple_notify_searchresult_column_get_title(column), renderer, "text", i, NULL); |
| 31696 | 1089 | |
| 1090 | if (!purple_notify_searchresult_column_is_visible(column)) | |
| 1091 | gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); | |
| 1092 | ||
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
1093 | i++; |
| 11359 | 1094 | } |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
1095 | |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
24658
diff
changeset
|
1096 | for (l = results->buttons; l; l = l->next) { |
|
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
24658
diff
changeset
|
1097 | PurpleNotifySearchButton *b = l->data; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1098 | GtkWidget *button = NULL; |
| 11359 | 1099 | switch (b->type) { |
| 15884 | 1100 | case PURPLE_NOTIFY_BUTTON_LABELED: |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1101 | if(b->label) { |
|
32755
de2d88e575ee
Ensure labelled buttons are shown for search results in Pidgin.
Howard Chu <hyc@symas.com>
parents:
32691
diff
changeset
|
1102 | button = gtk_dialog_add_button(GTK_DIALOG(window), b->label, GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1103 | } else { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19546
diff
changeset
|
1104 | purple_debug_warning("gtknotify", "Missing button label\n"); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1105 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1106 | break; |
| 15884 | 1107 | case PURPLE_NOTIFY_BUTTON_CONTINUE: |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1108 | button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_GO_FORWARD, GTK_RESPONSE_NONE); |
| 11359 | 1109 | break; |
| 15884 | 1110 | case PURPLE_NOTIFY_BUTTON_ADD: |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1111 | button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_ADD, GTK_RESPONSE_NONE); |
| 11359 | 1112 | break; |
| 15884 | 1113 | case PURPLE_NOTIFY_BUTTON_INFO: |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1114 | button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_TOOLBAR_USER_INFO, GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1115 | break; |
| 15884 | 1116 | case PURPLE_NOTIFY_BUTTON_IM: |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1117 | button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1118 | break; |
| 15884 | 1119 | case PURPLE_NOTIFY_BUTTON_JOIN: |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1120 | button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_CHAT, GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1121 | break; |
| 15884 | 1122 | case PURPLE_NOTIFY_BUTTON_INVITE: |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1123 | button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_INVITE, GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1124 | break; |
| 11359 | 1125 | default: |
| 15884 | 1126 | purple_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); |
| 11359 | 1127 | } |
| 1128 | if (button != NULL) { | |
| 15882 | 1129 | PidginNotifySearchResultsButtonData *bd; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1130 | |
| 15882 | 1131 | bd = g_new0(PidginNotifySearchResultsButtonData, 1); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1132 | bd->button = b; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1133 | bd->data = data; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1134 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1135 | g_signal_connect(G_OBJECT(button), "clicked", |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1136 | G_CALLBACK(searchresults_callback_wrapper_cb), bd); |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
1137 | g_signal_connect_swapped(G_OBJECT(button), "destroy", G_CALLBACK(g_free), bd); |
| 11359 | 1138 | } |
| 1139 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1140 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1141 | /* Add the Close button */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1142 | close_button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1143 | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1144 | g_signal_connect_swapped(G_OBJECT(close_button), "clicked", |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1145 | G_CALLBACK(searchresults_close_cb), data); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1146 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32521
diff
changeset
|
1147 | data->account = purple_connection_get_account(gc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1148 | data->model = model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1149 | data->treeview = treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1150 | data->window = window; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1151 | |
| 11359 | 1152 | /* Insert rows. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1153 | pidgin_notify_searchresults_new_rows(gc, results, data); |
| 11359 | 1154 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1155 | /* Show the window */ |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
1156 | pidgin_auto_parent_window(window); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
1157 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1158 | gtk_widget_show(window); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1159 | return data; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1160 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1161 | |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1162 | /** Xerox'ed from Finch! How the tables have turned!! ;) **/ |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1163 | /** User information. **/ |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1164 | static GHashTable *userinfo; |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1165 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1166 | static char * |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1167 | userinfo_hash(PurpleAccount *account, const char *who) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1168 | { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1169 | char key[256]; |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1170 | snprintf(key, sizeof(key), "%s - %s", purple_account_get_username(account), purple_normalize(account, who)); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1171 | return g_utf8_strup(key, -1); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1172 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1173 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1174 | static void |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1175 | remove_userinfo(GtkWidget *widget, gpointer key) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1176 | { |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1177 | PidginUserInfo *pinfo = g_hash_table_lookup(userinfo, key); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1178 | |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1179 | while (pinfo->count--) |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1180 | purple_notify_close(PURPLE_NOTIFY_USERINFO, widget); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1181 | |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1182 | g_hash_table_remove(userinfo, key); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1183 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1184 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1185 | static void * |
| 15884 | 1186 | pidgin_notify_userinfo(PurpleConnection *gc, const char *who, |
| 1187 | PurpleNotifyUserInfo *user_info) | |
| 9797 | 1188 | { |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1189 | char *info; |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
1190 | void *ui_handle; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1191 | char *key = userinfo_hash(purple_connection_get_account(gc), who); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1192 | PidginUserInfo *pinfo = NULL; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1193 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1194 | if (!userinfo) { |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1195 | userinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1196 | } |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
1197 | |
| 15884 | 1198 | info = purple_notify_user_info_get_text_with_newline(user_info, "<br />"); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1199 | pinfo = g_hash_table_lookup(userinfo, key); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1200 | if (pinfo != NULL) { |
|
32439
2c681e5daeeb
Webkit Message views.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
27504
diff
changeset
|
1201 | GtkWidget *webview = g_object_get_data(G_OBJECT(pinfo->window), "webview-widget"); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1202 | char *linked_text = purple_markup_linkify(info); |
|
32993
d6da54acf528
Remove _with_imgstore suffix on this function. There isn't a version
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
1203 | gtk_webview_load_html_string(GTK_WEBVIEW(webview), linked_text); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1204 | g_free(linked_text); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1205 | g_free(key); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1206 | ui_handle = pinfo->window; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1207 | pinfo->count++; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1208 | } else { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1209 | char *primary = g_strdup_printf(_("Info for %s"), who); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1210 | ui_handle = pidgin_notify_formatted(_("Buddy Information"), primary, NULL, info); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1211 | g_signal_handlers_disconnect_by_func(G_OBJECT(ui_handle), G_CALLBACK(formatted_close_cb), NULL); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1212 | g_signal_connect(G_OBJECT(ui_handle), "destroy", G_CALLBACK(remove_userinfo), key); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1213 | g_free(primary); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1214 | pinfo = g_new0(PidginUserInfo, 1); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1215 | pinfo->window = ui_handle; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1216 | pinfo->count = 1; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
1217 | g_hash_table_insert(userinfo, key, pinfo); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1218 | } |
|
15206
70520a610969
[gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents:
14865
diff
changeset
|
1219 | g_free(info); |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
1220 | return ui_handle; |
| 9797 | 1221 | } |
| 1222 | ||
| 5437 | 1223 | static void |
| 15884 | 1224 | pidgin_close_notify(PurpleNotifyType type, void *ui_handle) |
| 5437 | 1225 | { |
| 15884 | 1226 | if (type == PURPLE_NOTIFY_EMAIL || type == PURPLE_NOTIFY_EMAILS) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1227 | { |
| 15882 | 1228 | PidginNotifyMailData *data = (PidginNotifyMailData *)ui_handle; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
1229 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1230 | if (data) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1231 | g_free(data->url); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1232 | g_free(data); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1233 | } |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
1234 | } |
| 15884 | 1235 | else if (type == PURPLE_NOTIFY_SEARCHRESULTS) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1236 | { |
| 15882 | 1237 | PidginNotifySearchResultsData *data = (PidginNotifySearchResultsData *)ui_handle; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1238 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1239 | gtk_widget_destroy(data->window); |
| 15884 | 1240 | purple_notify_searchresults_free(data->results); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1241 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1242 | g_free(data); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1243 | } |
|
10750
455f5dc6e2f2
[gaim-migrate @ 12353]
Daniel Atallah <datallah@pidgin.im>
parents:
10732
diff
changeset
|
1244 | else if (ui_handle != NULL) |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
1245 | gtk_widget_destroy(GTK_WIDGET(ui_handle)); |
| 5437 | 1246 | } |
| 1247 | ||
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1248 | #ifndef _WIN32 |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1249 | static gint |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1250 | uri_command(const char *command, gboolean sync) |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1251 | { |
|
13520
f89ab3c41f4b
[gaim-migrate @ 15895]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13415
diff
changeset
|
1252 | gchar *tmp; |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1253 | GError *error = NULL; |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1254 | gint ret = 0; |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1255 | |
| 15884 | 1256 | purple_debug_misc("gtknotify", "Executing %s\n", command); |
|
8278
5fecd24d863c
[gaim-migrate @ 9002]
Mark Doliner <markdoliner@pidgin.im>
parents:
8277
diff
changeset
|
1257 | |
| 15884 | 1258 | if (!purple_program_is_valid(command)) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1259 | { |
|
13540
3c709ce41cfe
[gaim-migrate @ 15916]
Richard Laager <rlaager@pidgin.im>
parents:
13520
diff
changeset
|
1260 | tmp = g_strdup_printf(_("The browser command \"%s\" is invalid."), |
|
13520
f89ab3c41f4b
[gaim-migrate @ 15895]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13415
diff
changeset
|
1261 | command ? command : "(none)"); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
1262 | purple_notify_error(NULL, NULL, _("Unable to open URL"), tmp, NULL); |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1263 | g_free(tmp); |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1264 | |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1265 | } |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1266 | else if (sync) |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1267 | { |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1268 | gint status; |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1269 | |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1270 | if (!g_spawn_command_line_sync(command, NULL, NULL, &status, &error)) |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1271 | { |
|
13540
3c709ce41cfe
[gaim-migrate @ 15916]
Richard Laager <rlaager@pidgin.im>
parents:
13520
diff
changeset
|
1272 | tmp = g_strdup_printf(_("Error launching \"%s\": %s"), |
|
13520
f89ab3c41f4b
[gaim-migrate @ 15895]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13415
diff
changeset
|
1273 | command, error->message); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
1274 | purple_notify_error(NULL, NULL, _("Unable to open URL"), tmp, NULL); |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1275 | g_free(tmp); |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1276 | g_error_free(error); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1277 | } |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1278 | else |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1279 | ret = status; |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1280 | } |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1281 | else |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1282 | { |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1283 | if (!g_spawn_command_line_async(command, &error)) |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1284 | { |
|
13540
3c709ce41cfe
[gaim-migrate @ 15916]
Richard Laager <rlaager@pidgin.im>
parents:
13520
diff
changeset
|
1285 | tmp = g_strdup_printf(_("Error launching \"%s\": %s"), |
|
13520
f89ab3c41f4b
[gaim-migrate @ 15895]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13415
diff
changeset
|
1286 | command, error->message); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
1287 | purple_notify_error(NULL, NULL, _("Unable to open URL"), tmp, NULL); |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1288 | g_free(tmp); |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1289 | g_error_free(error); |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1290 | } |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1291 | } |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1292 | |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1293 | return ret; |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1294 | } |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1295 | #endif /* _WIN32 */ |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1296 | |
| 7136 | 1297 | static void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1298 | pidgin_notify_uri(const char *uri) |
| 7136 | 1299 | { |
| 1300 | #ifndef _WIN32 | |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1301 | char *escaped = g_shell_quote(uri); |
| 7136 | 1302 | char *command = NULL; |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1303 | char *remote_command = NULL; |
| 7136 | 1304 | const char *web_browser; |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1305 | int place; |
| 7136 | 1306 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1307 | web_browser = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/browsers/browser"); |
|
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1308 | place = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/browsers/place"); |
| 7136 | 1309 | |
| 10060 | 1310 | /* if they are running gnome, use the gnome web browser */ |
| 15884 | 1311 | if (purple_running_gnome() == TRUE) |
| 10060 | 1312 | { |
|
22330
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1313 | char *tmp = g_find_program_in_path("xdg-open"); |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1314 | if (tmp == NULL) |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1315 | command = g_strdup_printf("gnome-open %s", escaped); |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1316 | else |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1317 | command = g_strdup_printf("xdg-open %s", escaped); |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1318 | g_free(tmp); |
|
10061
2833056ea11c
[gaim-migrate @ 11033]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10060
diff
changeset
|
1319 | } |
| 15884 | 1320 | else if (purple_running_osx() == TRUE) |
|
14709
9b6f1cc24c6a
[gaim-migrate @ 17393]
Evan Schoenberg <evands@pidgin.im>
parents:
14676
diff
changeset
|
1321 | { |
|
9b6f1cc24c6a
[gaim-migrate @ 17393]
Evan Schoenberg <evands@pidgin.im>
parents:
14676
diff
changeset
|
1322 | command = g_strdup_printf("open %s", escaped); |
|
9b6f1cc24c6a
[gaim-migrate @ 17393]
Evan Schoenberg <evands@pidgin.im>
parents:
14676
diff
changeset
|
1323 | } |
| 10060 | 1324 | else if (!strcmp(web_browser, "epiphany") || |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1325 | !strcmp(web_browser, "galeon")) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1326 | { |
| 15568 | 1327 | if (place == PIDGIN_BROWSER_NEW_WINDOW) |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1328 | command = g_strdup_printf("%s -w %s", web_browser, escaped); |
| 15568 | 1329 | else if (place == PIDGIN_BROWSER_NEW_TAB) |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1330 | command = g_strdup_printf("%s -n %s", web_browser, escaped); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1331 | else |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1332 | command = g_strdup_printf("%s %s", web_browser, escaped); |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1333 | } |
|
22330
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1334 | else if (!strcmp(web_browser, "xdg-open")) |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1335 | { |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1336 | command = g_strdup_printf("xdg-open %s", escaped); |
|
c9ac9657f47a
Use xdg-open instead of gnome-open, if possible. We might want to use
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
22214
diff
changeset
|
1337 | } |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1338 | else if (!strcmp(web_browser, "gnome-open")) |
|
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1339 | { |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1340 | command = g_strdup_printf("gnome-open %s", escaped); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1341 | } |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1342 | else if (!strcmp(web_browser, "kfmclient")) |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1343 | { |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1344 | command = g_strdup_printf("kfmclient openURL %s", escaped); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1345 | /* |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1346 | * Does Konqueror have options to open in new tab |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1347 | * and/or current window? |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1348 | */ |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1349 | } |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1350 | else if (!strcmp(web_browser, "mozilla") || |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1351 | !strcmp(web_browser, "mozilla-firebird") || |
|
14676
70f04fbec17b
[gaim-migrate @ 17342]
Hendrik-Jan Heins <hjheins@gmail.com>
parents:
14636
diff
changeset
|
1352 | !strcmp(web_browser, "firefox") || |
|
70f04fbec17b
[gaim-migrate @ 17342]
Hendrik-Jan Heins <hjheins@gmail.com>
parents:
14636
diff
changeset
|
1353 | !strcmp(web_browser, "seamonkey")) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1354 | { |
|
9399
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1355 | char *args = ""; |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1356 | |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1357 | command = g_strdup_printf("%s %s", web_browser, escaped); |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1358 | |
|
9399
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1359 | /* |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1360 | * Firefox 0.9 and higher require a "-a firefox" option when |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1361 | * using -remote commands. This breaks older versions of |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1362 | * mozilla. So we include this other handly little string |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1363 | * when calling firefox. If the API for remote calls changes |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1364 | * any more in firefox then firefox should probably be split |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1365 | * apart from mozilla-firebird and mozilla... but this is good |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1366 | * for now. |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1367 | */ |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1368 | if (!strcmp(web_browser, "firefox")) |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1369 | args = "-a firefox"; |
|
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1370 | |
| 15568 | 1371 | if (place == PIDGIN_BROWSER_NEW_WINDOW) |
|
9399
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1372 | remote_command = g_strdup_printf("%s %s -remote " |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1373 | "openURL(%s,new-window)", |
|
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1374 | web_browser, args, escaped); |
| 15568 | 1375 | else if (place == PIDGIN_BROWSER_NEW_TAB) |
|
9399
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1376 | remote_command = g_strdup_printf("%s %s -remote " |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1377 | "openURL(%s,new-tab)", |
|
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1378 | web_browser, args, escaped); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1379 | } |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1380 | else if (!strcmp(web_browser, "opera")) |
|
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1381 | { |
| 15568 | 1382 | if (place == PIDGIN_BROWSER_NEW_WINDOW) |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1383 | command = g_strdup_printf("opera -newwindow %s", escaped); |
| 15568 | 1384 | else if (place == PIDGIN_BROWSER_NEW_TAB) |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1385 | command = g_strdup_printf("opera -newpage %s", escaped); |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1386 | else |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1387 | command = g_strdup_printf("opera %s", escaped); |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1388 | |
|
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1389 | } |
|
30799
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1390 | else if (!strcmp(web_browser, "google-chrome")) |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1391 | { |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1392 | /* Google Chrome doesn't have command-line arguments that control the |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1393 | * opening of links from external calls. This is controlled solely from |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1394 | * a preference within Google Chrome. */ |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1395 | command = g_strdup_printf("google-chrome %s", escaped); |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1396 | } |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1397 | else if (!strcmp(web_browser, "chrome")) |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1398 | { |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1399 | /* Chromium doesn't have command-line arguments that control the |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1400 | * opening of links from external calls. This is controlled solely from |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1401 | * a preference within Chromium. */ |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1402 | command = g_strdup_printf("chrome %s", escaped); |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1403 | } |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1404 | else if (!strcmp(web_browser, "chromium-browser")) |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1405 | { |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1406 | /* Chromium doesn't have command-line arguments that control the |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1407 | * opening of links from external calls. This is controlled solely from |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1408 | * a preference within Chromium. */ |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1409 | command = g_strdup_printf("chromium-browser %s", escaped); |
|
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1410 | } |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1411 | else if (!strcmp(web_browser, "custom")) |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1412 | { |
| 7136 | 1413 | const char *web_command; |
| 1414 | ||
|
30812
77e8d4906cfe
I thought I had done this in my last commit. Clearly I'm an idiot. This fixes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30800
diff
changeset
|
1415 | web_command = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/browsers/manual_command"); |
| 7136 | 1416 | |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1417 | if (web_command == NULL || *web_command == '\0') |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1418 | { |
| 15884 | 1419 | purple_notify_error(NULL, NULL, _("Unable to open URL"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
1420 | _("The 'Manual' browser command has been " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
1421 | "chosen, but no command has been set."), NULL); |
| 7136 | 1422 | return NULL; |
| 1423 | } | |
| 1424 | ||
| 1425 | if (strstr(web_command, "%s")) | |
| 15884 | 1426 | command = purple_strreplace(web_command, "%s", escaped); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1427 | else |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1428 | { |
| 7136 | 1429 | /* |
| 1430 | * There is no "%s" in the browser command. Assume the user | |
| 1431 | * wanted the URL tacked on to the end of the command. | |
| 1432 | */ | |
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1433 | command = g_strdup_printf("%s %s", web_command, escaped); |
| 7136 | 1434 | } |
| 1435 | } | |
| 1436 | ||
|
12477
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1437 | g_free(escaped); |
|
9328971aff14
[gaim-migrate @ 14788]
Richard Laager <rlaager@pidgin.im>
parents:
12257
diff
changeset
|
1438 | |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1439 | if (remote_command != NULL) |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1440 | { |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1441 | /* try the remote command first */ |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1442 | if (uri_command(remote_command, TRUE) != 0) |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1443 | uri_command(command, FALSE); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1444 | |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1445 | g_free(remote_command); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1446 | |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1447 | } |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1448 | else |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1449 | uri_command(command, FALSE); |
| 7136 | 1450 | |
| 1451 | g_free(command); | |
| 1452 | ||
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1453 | #else /* !_WIN32 */ |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15570
diff
changeset
|
1454 | winpidgin_notify_uri(uri); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1455 | #endif /* !_WIN32 */ |
| 7136 | 1456 | |
| 1457 | return NULL; | |
| 1458 | } | |
| 1459 | ||
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1460 | void |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1461 | pidgin_notify_pounce_add(PurpleAccount *account, PurplePounce *pounce, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1462 | const char *alias, const char *event, const char *message, const char *date) |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1463 | { |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1464 | GdkPixbuf *icon; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1465 | GtkTreeIter iter; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1466 | PidginNotifyPounceData *pounce_data; |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1467 | gboolean first = (pounce_dialog == NULL); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1468 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
1469 | if (pounce_dialog == NULL) |
|
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
1470 | pounce_dialog = pidgin_create_notification_dialog(PIDGIN_NOTIFY_POUNCE); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1471 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1472 | icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1473 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1474 | pounce_data = g_new(PidginNotifyPounceData, 1); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1475 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1476 | pounce_data->account = account; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1477 | pounce_data->pounce = pounce; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1478 | pounce_data->pouncee = g_strdup(purple_pounce_get_pouncee(pounce)); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1479 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1480 | gtk_tree_store_append(pounce_dialog->treemodel, &iter, NULL); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1481 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1482 | gtk_tree_store_set(pounce_dialog->treemodel, &iter, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1483 | PIDGIN_POUNCE_ICON, icon, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1484 | PIDGIN_POUNCE_ALIAS, alias, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1485 | PIDGIN_POUNCE_EVENT, event, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1486 | PIDGIN_POUNCE_TEXT, (message != NULL)? message : _("No message"), |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1487 | PIDGIN_POUNCE_DATE, date, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1488 | PIDGIN_POUNCE_DATA, pounce_data, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1489 | -1); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1490 | |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1491 | if (first) { |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1492 | GtkTreeSelection *selection = |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1493 | gtk_tree_view_get_selection(GTK_TREE_VIEW(pounce_dialog->treeview)); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1494 | gtk_tree_selection_select_iter(selection, &iter); |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1495 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1496 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1497 | if (icon) |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1498 | g_object_unref(icon); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1499 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
1500 | gtk_widget_show_all(pounce_dialog->dialog); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1501 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1502 | return; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1503 | } |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1504 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1505 | static PidginNotifyDialog * |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
1506 | pidgin_create_notification_dialog(PidginNotifyType type) |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1507 | { |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1508 | GtkTreeStore *model = NULL; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1509 | GtkWidget *dialog = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1510 | GtkWidget *label = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1511 | GtkCellRenderer *rend; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1512 | GtkTreeViewColumn *column; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1513 | GtkWidget *button = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1514 | GtkWidget *vbox = NULL; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1515 | GtkTreeSelection *sel; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1516 | PidginNotifyDialog *spec_dialog = NULL; |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
1517 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1518 | g_return_val_if_fail(type < PIDGIN_NOTIFY_TYPES, NULL); |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
1519 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1520 | if (type == PIDGIN_NOTIFY_MAIL) { |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
1521 | g_return_val_if_fail(mail_dialog == NULL, mail_dialog); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1522 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1523 | model = gtk_tree_store_new(COLUMNS_PIDGIN_MAIL, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1524 | GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1525 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1526 | } else if (type == PIDGIN_NOTIFY_POUNCE) { |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
1527 | g_return_val_if_fail(pounce_dialog == NULL, pounce_dialog); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1528 | |
|
27504
4ca60e3ea919
Use mail_dialog consistently, instead of switching from one line to the next. Various other cleanups, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27492
diff
changeset
|
1529 | model = gtk_tree_store_new(COLUMNS_PIDGIN_POUNCE, |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1530 | GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1531 | G_TYPE_STRING, G_TYPE_POINTER); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1532 | } |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1533 | |
|
28364
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1534 | dialog = gtk_dialog_new(); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1535 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
1536 | /* Vertical box */ |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
1537 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
1538 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1539 | /* Setup the dialog */ |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1540 | gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BOX_SPACE); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
1541 | gtk_container_set_border_width(GTK_CONTAINER(vbox), PIDGIN_HIG_BOX_SPACE); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
1542 | gtk_box_set_spacing(GTK_BOX(vbox), PIDGIN_HIG_BORDER); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1543 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1544 | /* Golden ratio it up! */ |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1545 | gtk_widget_set_size_request(dialog, 550, 400); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1546 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1547 | spec_dialog = g_new0(PidginNotifyDialog, 1); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1548 | spec_dialog->dialog = dialog; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1549 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1550 | spec_dialog->treemodel = model; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1551 | spec_dialog->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1552 | g_object_unref(G_OBJECT(model)); |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
1553 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1554 | gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(spec_dialog->treeview), TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1555 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1556 | if (type == PIDGIN_NOTIFY_MAIL) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1557 | gtk_window_set_title(GTK_WINDOW(dialog), _("New Mail")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1558 | gtk_window_set_role(GTK_WINDOW(dialog), "new_mail_detailed"); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1559 | g_signal_connect(G_OBJECT(dialog), "focus-in-event", |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1560 | G_CALLBACK(mail_window_focus_cb), NULL); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1561 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1562 | gtk_dialog_add_button(GTK_DIALOG(dialog), |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1563 | _("Open All Messages"), GTK_RESPONSE_ACCEPT); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1564 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1565 | button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1566 | PIDGIN_STOCK_OPEN_MAIL, GTK_RESPONSE_YES); |
|
27254
e1eec4dda0d2
Setting `dialog->open_button = button` when `button` is not yet assigned
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27063
diff
changeset
|
1567 | spec_dialog->open_button = button; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1568 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1569 | gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(spec_dialog->treeview), FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1570 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1571 | gtk_tree_view_set_search_column(GTK_TREE_VIEW(spec_dialog->treeview), PIDGIN_MAIL_TEXT); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1572 | gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(spec_dialog->treeview), |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1573 | pidgin_tree_view_search_equal_func, NULL, NULL); |
|
32765
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
1574 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(spec_dialog->treeview)); |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
1575 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_BROWSE); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1576 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1577 | g_signal_connect(G_OBJECT(dialog), "response", |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1578 | G_CALLBACK(email_response_cb), spec_dialog); |
|
32765
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
1579 | g_signal_connect(G_OBJECT(sel), "changed", |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
1580 | G_CALLBACK(selection_changed_cb), spec_dialog); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1581 | g_signal_connect(G_OBJECT(spec_dialog->treeview), "row-activated", G_CALLBACK(email_row_activated_cb), NULL); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1582 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1583 | column = gtk_tree_view_column_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1584 | gtk_tree_view_column_set_resizable(column, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1585 | rend = gtk_cell_renderer_pixbuf_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1586 | gtk_tree_view_column_pack_start(column, rend, FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1587 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1588 | gtk_tree_view_column_set_attributes(column, rend, "pixbuf", PIDGIN_MAIL_ICON, NULL); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1589 | rend = gtk_cell_renderer_text_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1590 | gtk_tree_view_column_pack_start(column, rend, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1591 | gtk_tree_view_column_set_attributes(column, rend, "markup", PIDGIN_MAIL_TEXT, NULL); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1592 | gtk_tree_view_append_column(GTK_TREE_VIEW(spec_dialog->treeview), column); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1593 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1594 | label = gtk_label_new(NULL); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1595 | gtk_label_set_markup(GTK_LABEL(label), _("<span weight=\"bold\" size=\"larger\">You have mail!</span>")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1596 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1597 | } else if (type == PIDGIN_NOTIFY_POUNCE) { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1598 | gtk_window_set_title(GTK_WINDOW(dialog), _("New Pounces")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1599 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1600 | button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1601 | _("IM"), GTK_RESPONSE_YES); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1602 | gtk_widget_set_sensitive(button, FALSE); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1603 | spec_dialog->open_button = button; |
|
28364
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1604 | |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1605 | button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1606 | PIDGIN_STOCK_MODIFY, GTK_RESPONSE_APPLY); |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1607 | gtk_widget_set_sensitive(button, FALSE); |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1608 | spec_dialog->edit_button = button; |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1609 | |
|
31531
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1610 | /* Translators: Make sure you translate "Dismiss" differently than |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1611 | "close"! This string is used in the "You have pounced" dialog |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1612 | that appears when one of your Buddy Pounces is triggered. In |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1613 | this context "Dismiss" means "I acknowledge that I've seen that |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1614 | this pounce was triggered--remove it from this list." Translating |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1615 | it as "Remove" is acceptable if you can't think of a more precise |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1616 | word. */ |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1617 | button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("Dismiss"), |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1618 | GTK_RESPONSE_NO); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1619 | gtk_widget_set_sensitive(button, FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1620 | spec_dialog->dismiss_button = button; |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1621 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1622 | g_signal_connect(G_OBJECT(dialog), "response", |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1623 | G_CALLBACK(pounce_response_cb), spec_dialog); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1624 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1625 | column = gtk_tree_view_column_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1626 | gtk_tree_view_column_set_title(column, _("Buddy")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1627 | gtk_tree_view_column_set_resizable(column, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1628 | rend = gtk_cell_renderer_pixbuf_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1629 | gtk_tree_view_column_pack_start(column, rend, FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1630 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1631 | gtk_tree_view_column_set_attributes(column, rend, "pixbuf", PIDGIN_POUNCE_ICON, NULL); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1632 | rend = gtk_cell_renderer_text_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1633 | gtk_tree_view_column_pack_start(column, rend, FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1634 | gtk_tree_view_column_add_attribute(column, rend, "text", PIDGIN_POUNCE_ALIAS); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1635 | gtk_tree_view_append_column(GTK_TREE_VIEW(spec_dialog->treeview), column); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1636 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1637 | column = gtk_tree_view_column_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1638 | gtk_tree_view_column_set_title(column, _("Event")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1639 | gtk_tree_view_column_set_resizable(column, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1640 | rend = gtk_cell_renderer_text_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1641 | gtk_tree_view_column_pack_start(column, rend, FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1642 | gtk_tree_view_column_add_attribute(column, rend, "text", PIDGIN_POUNCE_EVENT); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1643 | gtk_tree_view_append_column(GTK_TREE_VIEW(spec_dialog->treeview), column); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1644 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1645 | column = gtk_tree_view_column_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1646 | gtk_tree_view_column_set_title(column, _("Message")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1647 | gtk_tree_view_column_set_resizable(column, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1648 | rend = gtk_cell_renderer_text_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1649 | gtk_tree_view_column_pack_start(column, rend, FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1650 | gtk_tree_view_column_add_attribute(column, rend, "text", PIDGIN_POUNCE_TEXT); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1651 | gtk_tree_view_append_column(GTK_TREE_VIEW(spec_dialog->treeview), column); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1652 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1653 | column = gtk_tree_view_column_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1654 | gtk_tree_view_column_set_title(column, _("Date")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1655 | gtk_tree_view_column_set_resizable(column, TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1656 | rend = gtk_cell_renderer_text_new(); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1657 | gtk_tree_view_column_pack_start(column, rend, FALSE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1658 | gtk_tree_view_column_add_attribute(column, rend, "text", PIDGIN_POUNCE_DATE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1659 | gtk_tree_view_append_column(GTK_TREE_VIEW(spec_dialog->treeview), column); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1660 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1661 | label = gtk_label_new(NULL); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1662 | gtk_label_set_markup(GTK_LABEL(label), _("<span weight=\"bold\" size=\"larger\">You have pounced!</span>")); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1663 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1664 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(spec_dialog->treeview)); |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1665 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1666 | g_signal_connect(G_OBJECT(sel), "changed", |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1667 | G_CALLBACK(pounce_row_selected_cb), NULL); |
|
28338
ff80b2a9fc85
Add a row-activation event for the Pounces dialog to open a new conversation window.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
27504
diff
changeset
|
1668 | g_signal_connect(G_OBJECT(spec_dialog->treeview), "row-activated", |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1669 | G_CALLBACK(pounce_response_open_ims), NULL); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1670 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1671 | |
|
28364
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1672 | button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1673 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1674 | |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1675 | gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1676 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1677 | gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32507
diff
changeset
|
1678 | gtk_box_pack_start(GTK_BOX(vbox), |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30812
diff
changeset
|
1679 | pidgin_make_scrollable(spec_dialog->treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30812
diff
changeset
|
1680 | TRUE, TRUE, 2); |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1681 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1682 | return spec_dialog; |
|
26467
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1683 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1684 | |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1685 | static void |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1686 | signed_off_cb(PurpleConnection *gc, gpointer unused) |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1687 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1688 | /* Clear any pending emails for this account */ |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1689 | pidgin_notify_emails(gc, 0, FALSE, NULL, NULL, NULL, NULL); |
|
27490
6076e2aee8c9
Close the mail dialog at signoff if it's empty. Closes #9345.
Paul Aurich <darkrain42@pidgin.im>
parents:
27489
diff
changeset
|
1690 | |
|
27492
6c98764968bb
Fix the mail_dialog->total_count and use that to tell when the dialog is empty.
Paul Aurich <darkrain42@pidgin.im>
parents:
27490
diff
changeset
|
1691 | if (mail_dialog != NULL && mail_dialog->total_count == 0) |
|
27490
6076e2aee8c9
Close the mail dialog at signoff if it's empty. Closes #9345.
Paul Aurich <darkrain42@pidgin.im>
parents:
27489
diff
changeset
|
1692 | reset_mail_dialog(NULL); |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1693 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1694 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1695 | static void* |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1696 | pidgin_notify_get_handle(void) |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1697 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1698 | static int handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1699 | return &handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1700 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1701 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1702 | void pidgin_notify_init(void) |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1703 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1704 | void *handle = pidgin_notify_get_handle(); |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1705 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1706 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1707 | handle, PURPLE_CALLBACK(signed_off_cb), NULL); |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1708 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1709 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1710 | void pidgin_notify_uninit(void) |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1711 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1712 | purple_signals_disconnect_by_handle(pidgin_notify_get_handle()); |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1713 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1714 | |
| 15884 | 1715 | static PurpleNotifyUiOps ops = |
| 5437 | 1716 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1717 | pidgin_notify_message, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1718 | pidgin_notify_email, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1719 | pidgin_notify_emails, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1720 | pidgin_notify_formatted, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1721 | pidgin_notify_searchresults, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1722 | pidgin_notify_searchresults_new_rows, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1723 | pidgin_notify_userinfo, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1724 | pidgin_notify_uri, |
|
16752
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1725 | pidgin_close_notify, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1726 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1727 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1728 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1729 | NULL |
| 5437 | 1730 | }; |
| 1731 | ||
| 15884 | 1732 | PurpleNotifyUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1733 | pidgin_notify_get_ui_ops(void) |
| 5437 | 1734 | { |
| 1735 | return &ops; | |
| 1736 | } |