Sun, 07 Jun 2020 02:39:43 -0500
closing merged branch
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20113
diff
changeset
|
1 | /* pidgin |
| 5437 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
6 | * |
| 5437 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * 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
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5437 | 20 | */ |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
21 | #include <gdk/gdkkeysyms.h> |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
22 | #include <talkatu.h> |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
23 | |
| 9791 | 24 | #include "internal.h" |
| 15577 | 25 | #include "pidgin.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
26 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
27 | #include <purple.h> |
| 7455 | 28 | |
|
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
|
29 | #include "pidginstock.h" |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
30 | #include "gtkblist.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
31 | #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
|
32 | #include "gtkpounce.h" |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
33 | #include "gtkutils.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
34 | |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
35 | typedef struct |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
36 | { |
|
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
|
37 | 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
|
38 | 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
|
39 | } 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
|
40 | |
|
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
|
41 | 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
|
42 | { |
| 15884 | 43 | PurpleAccount *account; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
44 | char *url; |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
45 | GtkWidget *label; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
46 | int count; |
| 22999 | 47 | gboolean purple_has_handle; |
| 15882 | 48 | } PidginNotifyMailData; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
49 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
50 | typedef struct |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
51 | { |
| 15884 | 52 | 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
|
53 | PurplePounce *pounce; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
54 | 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
|
55 | } 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
|
56 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
57 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
58 | 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
|
59 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
60 | PurpleAccount *account; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
61 | GtkListStore *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
62 | GtkWidget *treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
63 | GtkWidget *window; |
| 13641 | 64 | gpointer user_data; |
| 15884 | 65 | PurpleNotifySearchResults *results; |
| 13641 | 66 | |
| 15882 | 67 | } PidginNotifySearchResultsData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
68 | |
| 11359 | 69 | typedef struct |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
70 | { |
| 15884 | 71 | PurpleNotifySearchButton *button; |
| 15882 | 72 | PidginNotifySearchResultsData *data; |
| 11359 | 73 | |
| 15882 | 74 | } PidginNotifySearchResultsButtonData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
75 | |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
76 | enum |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
77 | { |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
78 | PIDGIN_MAIL_ICON, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
79 | PIDGIN_MAIL_TEXT, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
80 | PIDGIN_MAIL_DATA, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
81 | COLUMNS_PIDGIN_MAIL |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
82 | }; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
83 | |
|
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
|
84 | 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
|
85 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
86 | 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
|
87 | 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
|
88 | 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
|
89 | 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
|
90 | 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
|
91 | 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
|
92 | 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
|
93 | }; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
94 | |
|
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
|
95 | |
|
39556
622bf98df0ac
Remove unnecessary struct tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39214
diff
changeset
|
96 | typedef struct |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
97 | { |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
98 | /* |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
99 | * 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
|
100 | * dialog widget. |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
101 | */ |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
102 | GtkWidget *dialog; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
103 | GtkWidget *treeview; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
104 | GtkTreeStore *treemodel; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
105 | GtkLabel *label; |
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
106 | 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
|
107 | 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
|
108 | GtkWidget *edit_button; |
| 15246 | 109 | int total_count; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
110 | gboolean in_use; |
|
27489
6a8a2099b20a
Remove the PidginMailDialog typedef.
Paul Aurich <darkrain42@pidgin.im>
parents:
27488
diff
changeset
|
111 | } PidginNotifyDialog; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
112 | |
|
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
|
113 | 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
|
114 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
115 | 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
|
116 | 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
|
117 | 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
|
118 | } PidginNotifyType; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
119 | |
|
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
|
120 | 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
|
121 | 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
|
122 | |
|
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
|
123 | static PidginNotifyDialog *pidgin_create_notification_dialog(PidginNotifyType type); |
| 15884 | 124 | 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
|
125 | const char **subjects, |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
126 | const char **froms, const char **tos, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
127 | const char **urls); |
|
5476
6f863ea68018
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
128 | |
| 22999 | 129 | static void pidgin_close_notify(PurpleNotifyType type, void *ui_handle); |
| 130 | ||
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
131 | static void |
|
6354
685303e0c013
[gaim-migrate @ 6853]
Christian Hammond <chipx86@chipx86.com>
parents:
6106
diff
changeset
|
132 | message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
133 | { |
| 15884 | 134 | purple_notify_close(PURPLE_NOTIFY_MESSAGE, widget); |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
135 | } |
|
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
136 | |
|
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
137 | 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
|
138 | 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
|
139 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
140 | 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
|
141 | 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
|
142 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
143 | 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
|
144 | 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
|
145 | 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
|
146 | 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
|
147 | -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
|
148 | 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
|
149 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
150 | 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
|
151 | 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
|
152 | } |
|
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 | |
|
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_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
|
155 | 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
|
156 | 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
|
157 | } |
|
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 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
159 | 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
|
160 | 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
|
161 | 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
|
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 | 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
|
164 | |
|
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 | 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
|
166 | 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
|
167 | -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
|
168 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
169 | if (pounce_data != NULL) { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
170 | 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
|
171 | g_free(pounce_data); |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
172 | } |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
173 | } |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
174 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
175 | static void |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
176 | open_im_foreach(GtkTreeModel *model, GtkTreePath *path, |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
177 | GtkTreeIter *iter, gpointer data) |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
178 | { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
179 | PidginNotifyPounceData *pounce_data; |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
180 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
181 | gtk_tree_model_get(model, iter, |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
182 | PIDGIN_POUNCE_DATA, &pounce_data, |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
183 | -1); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
184 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
185 | 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
|
186 | PurpleIMConversation *im; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
187 | |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
33796
diff
changeset
|
188 | 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
|
189 | purple_conversation_present(PURPLE_CONVERSATION(im)); |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
190 | } |
|
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
|
191 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
192 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
193 | 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
|
194 | 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
|
195 | 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
|
196 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
197 | 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
|
198 | *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
|
199 | } |
|
28343
0f91a1031c00
Close the Pounce dialog when you dismiss the last pounce.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
28338
diff
changeset
|
200 | |
|
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
|
201 | 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
|
202 | 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
|
203 | { |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
204 | 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
|
205 | 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
|
206 | GtkTreeIter iter; |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
207 | 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
|
208 | 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
|
209 | 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
|
210 | |
|
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 | 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
|
212 | 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
|
213 | 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
|
214 | |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
215 | 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
|
216 | |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
217 | 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
|
218 | 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
|
219 | 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
|
220 | found_selection = TRUE; |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
221 | else { |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
222 | /* 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
|
223 | GtkTreePath *path; |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
224 | |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
225 | /* 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
|
226 | 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
|
227 | 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
|
228 | 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
|
229 | 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
|
230 | found_selection = TRUE; |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
231 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
232 | |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
233 | 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
|
234 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
235 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
236 | |
|
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
|
237 | while (list) { |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
238 | 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
|
239 | 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
|
240 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
241 | 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
|
242 | 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
|
243 | } |
|
28343
0f91a1031c00
Close the Pounce dialog when you dismiss the last pounce.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
28338
diff
changeset
|
244 | |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
245 | 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
|
246 | if (found_selection) |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
247 | 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
|
248 | else |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
249 | 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
|
250 | } else |
|
28343
0f91a1031c00
Close the Pounce dialog when you dismiss the last pounce.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
28338
diff
changeset
|
251 | 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
|
252 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
253 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
254 | static void |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
255 | pounce_response_open_ims() |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
256 | { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
257 | GtkTreeSelection *selection; |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
258 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
259 | 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
|
260 | 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
|
261 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
262 | pounce_response_dismiss(); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
263 | } |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
264 | |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
265 | 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
|
266 | 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
|
267 | 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
|
268 | { |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
269 | 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
|
270 | 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
|
271 | 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
|
272 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
273 | 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
|
274 | |
|
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 | 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
|
276 | 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
|
277 | -1); |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
278 | |
|
40043
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39922
diff
changeset
|
279 | if (g_list_find(list, pounce_data->pounce) != NULL) { |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39922
diff
changeset
|
280 | pidgin_pounce_editor_show(pounce_data->account, NULL, pounce_data->pounce); |
|
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39922
diff
changeset
|
281 | return; |
|
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
|
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 | |
|
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 | 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
|
285 | } |
|
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 | |
|
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 | 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
|
288 | 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
|
289 | { |
|
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 | 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
|
291 | |
|
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 | 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
|
293 | 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
|
294 | 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
|
295 | 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
|
296 | break; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
297 | case GTK_RESPONSE_YES: |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
298 | pounce_response_open_ims(); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
299 | 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
|
300 | 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
|
301 | 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
|
302 | 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
|
303 | 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
|
304 | 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
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | } |
|
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 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
310 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
311 | 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
|
312 | 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
|
313 | 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
|
314 | { |
|
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 | GtkTreeSelection *selection; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
316 | 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
|
317 | |
|
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 | 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
|
319 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
320 | 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
|
321 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
322 | if (count == 0) { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
323 | 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
|
324 | 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
|
325 | 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
|
326 | } else if (count == 1) { |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
327 | GList *pounces; |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
328 | 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
|
329 | PidginNotifyPounceData *pounce_data; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
330 | 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
|
331 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
332 | 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
|
333 | 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
|
334 | &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
|
335 | 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
|
336 | 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
|
337 | -1); |
|
39897
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39556
diff
changeset
|
338 | g_list_free_full(list, (GDestroyNotify)gtk_tree_path_free); |
|
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
|
339 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
340 | pounces = purple_pounces_get_all(); |
| 40048 | 341 | if (g_list_find(pounces, pounce_data->pounce) != NULL) { |
|
40043
90446617d967
Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39922
diff
changeset
|
342 | gtk_widget_set_sensitive(pounce_dialog->edit_button, TRUE); |
| 40048 | 343 | } |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
344 | |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
345 | 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
|
346 | 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
|
347 | } else { |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
348 | 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
|
349 | 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
|
350 | 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
|
351 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
352 | |
|
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 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
354 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
355 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
356 | static void |
|
40128
9b64a2d80f8c
Remove redundant callback type casts
qarkai <qarkai@gmail.com>
parents:
40094
diff
changeset
|
357 | reset_mail_dialog(gpointer unused) |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
358 | { |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
359 | 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
|
360 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
361 | if (mail_dialog->in_use) |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
362 | return; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
363 | gtk_widget_destroy(mail_dialog->dialog); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
364 | g_free(mail_dialog); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
365 | mail_dialog = NULL; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
366 | 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
|
367 | } |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
368 | |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
369 | gboolean |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
370 | pidgin_notify_emails_pending() |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
371 | { |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
372 | return mail_dialog != NULL |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
373 | && !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
|
374 | } |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
375 | |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
376 | 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
|
377 | { |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
378 | if (pidgin_notify_emails_pending()) { |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
379 | 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
|
380 | mail_dialog->in_use = TRUE; |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
381 | 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
|
382 | mail_dialog->in_use = FALSE; |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33170
diff
changeset
|
383 | } |
|
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"); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
385 | } |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
386 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
387 | 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
|
388 | email_response_cb(GtkDialog *unused, gint id, PidginNotifyDialog *unused2) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
389 | { |
| 15882 | 390 | 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
|
391 | GtkTreeModel *model = GTK_TREE_MODEL(mail_dialog->treemodel); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
392 | GtkTreeIter iter; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
393 | |
|
10260
76253312081f
[gaim-migrate @ 11403]
Matthew A. Nicholson <therealman11@users.sourceforge.net>
parents:
10240
diff
changeset
|
394 | if (id == GTK_RESPONSE_YES) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
395 | { |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
396 | /* A single row activated. Remove that row. */ |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
397 | GtkTreeSelection *selection; |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
398 | |
|
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
|
399 | 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
|
400 | |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
401 | if (gtk_tree_selection_get_selected(selection, NULL, &iter)) |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
402 | { |
|
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
|
403 | gtk_tree_model_get(model, &iter, PIDGIN_MAIL_DATA, &data, -1); |
| 15884 | 404 | purple_notify_uri(NULL, data->url); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
405 | |
|
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 | 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
|
407 | 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
|
408 | 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
|
409 | 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
|
410 | pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
411 | |
|
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
|
412 | if (gtk_tree_model_get_iter_first(model, &iter)) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
413 | return; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
414 | } |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
415 | else |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
416 | return; |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
417 | } |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
418 | else |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
419 | { |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
420 | /* 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
|
421 | while (gtk_tree_model_get_iter_first(model, &iter)) |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
422 | { |
|
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
|
423 | 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
|
424 | |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
425 | if (id == GTK_RESPONSE_ACCEPT) |
| 15884 | 426 | purple_notify_uri(NULL, data->url); |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
427 | |
|
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
|
428 | gtk_tree_store_remove(mail_dialog->treemodel, &iter); |
| 22999 | 429 | if (data->purple_has_handle) |
| 430 | purple_notify_close(PURPLE_NOTIFY_EMAILS, data); | |
| 431 | else | |
| 432 | pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); | |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
433 | } |
|
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
434 | } |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
435 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
436 | reset_mail_dialog(NULL); |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
437 | } |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
438 | |
|
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 | 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
|
440 | 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
|
441 | 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
|
442 | { |
|
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
|
443 | 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
|
444 | } |
|
99985a434ef8
Open emails by doubleclicking the row.
Daniel Atallah <datallah@pidgin.im>
parents:
19222
diff
changeset
|
445 | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22007
diff
changeset
|
446 | static gboolean |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
447 | formatted_close_cb(GtkWidget *win, GdkEvent *event, void *user_data) |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
448 | { |
| 15884 | 449 | 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
|
450 | return FALSE; |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
451 | } |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
452 | |
|
22032
8136dd5eeda3
Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22007
diff
changeset
|
453 | static gboolean |
| 15882 | 454 | 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
|
455 | { |
| 15884 | 456 | 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
|
457 | return FALSE; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
458 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
459 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
460 | static void |
| 15882 | 461 | searchresults_callback_wrapper_cb(GtkWidget *widget, PidginNotifySearchResultsButtonData *bd) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
462 | { |
| 15882 | 463 | PidginNotifySearchResultsData *data = bd->data; |
| 11359 | 464 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
465 | GtkTreeSelection *selection; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
466 | GtkTreeModel *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
467 | GtkTreeIter iter; |
| 15884 | 468 | PurpleNotifySearchButton *button; |
| 11359 | 469 | GList *row = NULL; |
| 470 | gchar *str; | |
| 471 | int i; | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
472 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
473 | g_return_if_fail(data != NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
474 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
475 | 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
|
476 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
477 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
478 | { |
| 11359 | 479 | for (i = 1; i < gtk_tree_model_get_n_columns(GTK_TREE_MODEL(model)); i++) { |
| 480 | gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, i, &str, -1); | |
| 481 | row = g_list_append(row, str); | |
| 482 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
483 | } |
| 11359 | 484 | |
| 485 | button = bd->button; | |
| 15884 | 486 | button->callback(purple_account_get_connection(data->account), row, data->user_data); |
|
39897
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39556
diff
changeset
|
487 | g_list_free_full(row, g_free); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
488 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
489 | |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
490 | /* 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
|
491 | static void |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
492 | 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
|
493 | { |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
494 | GtkWidget *image; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
495 | GdkPixbuf *pixbuf; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
496 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
497 | if (!account) |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
498 | return; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
499 | |
| 36782 | 500 | pixbuf = pidgin_create_protocol_icon(account, PIDGIN_PROTOCOL_ICON_SMALL); |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
501 | 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
|
502 | 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
|
503 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
504 | 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
|
505 | 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
|
506 | |
|
40162
a8bdd1227991
Remove GtkDialog handling in pidgin_widget_decorate_account.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40150
diff
changeset
|
507 | if (GTK_IS_BOX(cont)) { |
|
37990
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
508 | gtk_widget_set_halign(image, GTK_ALIGN_START); |
|
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
509 | gtk_widget_set_valign(image, GTK_ALIGN_START); |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
510 | 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
|
511 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
512 | gtk_widget_show(image); |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
513 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
514 | |
| 5437 | 515 | static void * |
|
37409
9dadde8529a8
Change enum name from PurpleNotifyMsgType to PurpleNotifyMessageType
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37144
diff
changeset
|
516 | pidgin_notify_message(PurpleNotifyMessageType type, const char *title, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
517 | const char *primary, const char *secondary, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
518 | PurpleRequestCommonParameters *cpar) |
| 5437 | 519 | { |
| 14865 | 520 | GtkWidget *dialog; |
| 521 | GtkWidget *hbox; | |
| 522 | GtkWidget *label; | |
| 523 | GtkWidget *img = NULL; | |
| 524 | char label_text[2048]; | |
| 525 | const char *icon_name = NULL; | |
| 526 | char *primary_esc, *secondary_esc; | |
| 5437 | 527 | |
| 14865 | 528 | switch (type) |
| 529 | { | |
| 15884 | 530 | case PURPLE_NOTIFY_MSG_ERROR: |
|
39146
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
531 | icon_name = "dialog-error"; |
| 14865 | 532 | break; |
| 5437 | 533 | |
| 15884 | 534 | case PURPLE_NOTIFY_MSG_WARNING: |
|
39146
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
535 | icon_name = "dialog-warning"; |
| 14865 | 536 | break; |
| 5437 | 537 | |
| 15884 | 538 | case PURPLE_NOTIFY_MSG_INFO: |
|
39146
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
539 | icon_name = "dialog-information"; |
| 14865 | 540 | break; |
| 5437 | 541 | |
| 14865 | 542 | default: |
| 543 | icon_name = NULL; | |
| 544 | break; | |
| 545 | } | |
| 5437 | 546 | |
| 14865 | 547 | if (icon_name != NULL) |
| 548 | { | |
|
39146
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
549 | img = gtk_image_new_from_icon_name(icon_name, |
|
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
550 | GTK_ICON_SIZE_DIALOG); |
|
37990
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
551 | gtk_widget_set_halign(img, GTK_ALIGN_START); |
|
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
552 | gtk_widget_set_valign(img, GTK_ALIGN_START); |
| 14865 | 553 | } |
| 5437 | 554 | |
| 15882 | 555 | dialog = gtk_dialog_new_with_buttons(title ? title : PIDGIN_ALERT_TITLE, |
| 14865 | 556 | NULL, 0, GTK_STOCK_CLOSE, |
| 557 | GTK_RESPONSE_CLOSE, NULL); | |
| 558 | ||
| 559 | gtk_window_set_role(GTK_WINDOW(dialog), "notify_dialog"); | |
| 560 | ||
| 561 | g_signal_connect(G_OBJECT(dialog), "response", | |
| 562 | G_CALLBACK(message_response_cb), dialog); | |
| 563 | ||
| 15882 | 564 | gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER); |
| 14865 | 565 | 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
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | PIDGIN_HIG_BOX_SPACE); |
| 14865 | 570 | |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
571 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
572 | 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
|
573 | hbox); |
| 5437 | 574 | |
| 14865 | 575 | if (img != NULL) |
| 576 | gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
| 5437 | 577 | |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
578 | 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
|
579 | 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
|
580 | |
| 14865 | 581 | primary_esc = g_markup_escape_text(primary, -1); |
| 582 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
| 583 | 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
|
584 | "<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
|
585 | 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
|
586 | (secondary ? secondary_esc : "")); |
| 14865 | 587 | g_free(primary_esc); |
| 588 | g_free(secondary_esc); | |
| 5437 | 589 | |
| 14865 | 590 | label = gtk_label_new(NULL); |
| 5437 | 591 | |
| 14865 | 592 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
| 593 | 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
|
594 | gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
595 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
596 | gtk_label_set_yalign(GTK_LABEL(label), 0); |
| 14865 | 597 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 5437 | 598 | |
|
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
|
599 | 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
|
600 | 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
|
601 | 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
|
602 | |
| 14865 | 603 | gtk_widget_show_all(dialog); |
| 5437 | 604 | |
| 14865 | 605 | return dialog; |
| 5437 | 606 | } |
| 607 | ||
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
608 | static void |
|
27489
6a8a2099b20a
Remove the PidginMailDialog typedef.
Paul Aurich <darkrain42@pidgin.im>
parents:
27488
diff
changeset
|
609 | selection_changed_cb(GtkTreeSelection *sel, PidginNotifyDialog *dialog) |
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
610 | { |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
611 | GtkTreeIter iter; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
612 | GtkTreeModel *model; |
| 15882 | 613 | PidginNotifyMailData *data; |
|
13415
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
614 | gboolean active = TRUE; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
615 | |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
616 | if (gtk_tree_selection_get_selected(sel, &model, &iter) == FALSE) |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
617 | active = FALSE; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
618 | else |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
619 | { |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
620 | 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
|
621 | if (data->url == NULL) |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
622 | active = FALSE; |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
623 | } |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
624 | |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
625 | gtk_widget_set_sensitive(dialog->open_button, active); |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
626 | } |
|
c8090b1fe17a
[gaim-migrate @ 15789]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13414
diff
changeset
|
627 | |
| 5437 | 628 | static void * |
| 15884 | 629 | 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
|
630 | const char *to, const char *url) |
| 5437 | 631 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
632 | return pidgin_notify_emails(gc, 1, (subject != NULL), |
|
5524
753be2126684
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
633 | (subject == NULL ? NULL : &subject), |
|
753be2126684
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
634 | (from == NULL ? NULL : &from), |
|
753be2126684
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
635 | (to == NULL ? NULL : &to), |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
636 | (url == NULL ? NULL : &url)); |
| 5437 | 637 | } |
| 638 | ||
|
15789
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
639 | static int |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
640 | 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
|
641 | { |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
642 | pidgin_set_urgent(GTK_WINDOW(widget), FALSE); |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
643 | return 0; |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
644 | } |
|
f7026b5ebe55
Fix the last change.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15788
diff
changeset
|
645 | |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
646 | /* count == 0 means this is a detailed mail notification. |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
647 | * count > 0 mean non-detailed. |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
648 | */ |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
649 | 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
|
650 | 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
|
651 | { |
| 15882 | 652 | PidginNotifyMailData *data = NULL; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
653 | GtkTreeIter iter; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
654 | GdkPixbuf *icon; |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
655 | gboolean new_n = TRUE; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
656 | |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
657 | if (count > 0 || clear) { |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
658 | /* Allow only one non-detailed email notification for each account */ |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
659 | 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
|
660 | gboolean advanced; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
661 | do { |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
662 | advanced = FALSE; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
663 | 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
|
664 | 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
|
665 | if (data && data->account == account) { |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
666 | if (clear) { |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
667 | 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
|
668 | 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
|
669 | |
|
27410
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
670 | 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
|
671 | 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
|
672 | else |
|
69470d6cbabd
Make sure uninitialized variable is not used. This might fix #9345,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27254
diff
changeset
|
673 | pidgin_close_notify(PURPLE_NOTIFY_EMAILS, data); |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
674 | /* We're completely done if we've processed all entries */ |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
675 | if (!advanced) |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
676 | return NULL; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
677 | } else if (data->count > 0) { |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
678 | new_n = FALSE; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
679 | g_free(data->url); |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
680 | data->url = NULL; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
681 | mail_dialog->total_count -= data->count; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
682 | break; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
683 | } |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
684 | } |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
685 | } 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
|
686 | } |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
687 | } |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
688 | |
|
20149
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
689 | if (clear) |
|
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
690 | return NULL; |
|
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
691 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34874
diff
changeset
|
692 | icon = pidgin_create_protocol_icon(account, PIDGIN_PROTOCOL_ICON_MEDIUM); |
|
20149
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
693 | |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
694 | if (new_n) { |
| 15882 | 695 | data = g_new0(PidginNotifyMailData, 1); |
| 22999 | 696 | data->purple_has_handle = TRUE; |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
697 | gtk_tree_store_append(treemodel, &iter, NULL); |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
698 | } |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
699 | |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
700 | if (url != NULL) |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
701 | data->url = g_strdup(url); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
702 | |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
703 | gtk_tree_store_set(treemodel, &iter, |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
704 | PIDGIN_MAIL_ICON, icon, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
705 | PIDGIN_MAIL_TEXT, notification, |
|
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15789
diff
changeset
|
706 | PIDGIN_MAIL_DATA, data, |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
707 | -1); |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
708 | 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
|
709 | /* 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
|
710 | data->count = count > 0 ? count : 1; |
| 22999 | 711 | |
|
15395
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
712 | if (icon) |
|
ce9f0fe6a77a
[gaim-migrate @ 18125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15393
diff
changeset
|
713 | 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
|
714 | |
|
e5fdd0edf679
Fix a double free caused by my previous leak fix not covering all possible
Daniel Atallah <datallah@pidgin.im>
parents:
22999
diff
changeset
|
715 | 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
|
716 | *new_data = new_n; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
717 | return data; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
718 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
719 | |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
720 | static void * |
| 15884 | 721 | 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
|
722 | const char **subjects, const char **froms, |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
723 | const char **tos, const char **urls) |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
724 | { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
725 | char *notification; |
| 15884 | 726 | 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
|
727 | 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
|
728 | 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
|
729 | GtkTreeSelection *sel; |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
730 | GtkTreeIter iter; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
731 | |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
732 | /* 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
|
733 | if (count == 0 && mail_dialog == NULL) |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
734 | return NULL; |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
735 | |
| 15884 | 736 | 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
|
737 | 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
|
738 | mail_dialog = pidgin_create_notification_dialog(PIDGIN_NOTIFY_MAIL); |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
739 | |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
740 | mail_dialog->total_count += count; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
741 | 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
|
742 | for ( ; count; --count) { |
|
13414
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
743 | char *to_text = NULL; |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
744 | char *from_text = NULL; |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
745 | char *subject_text = NULL; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
746 | char *tmp; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
747 | gboolean first = TRUE; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
748 | |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
749 | if (tos != NULL) { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
750 | tmp = g_markup_escape_text(*tos, -1); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
751 | 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
|
752 | g_free(tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
753 | first = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
754 | tos++; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
755 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
756 | if (froms != NULL) { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
757 | tmp = g_markup_escape_text(*froms, -1); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
758 | 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
|
759 | g_free(tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
760 | first = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
761 | froms++; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
762 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
763 | if (subjects != NULL) { |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
764 | tmp = g_markup_escape_text(*subjects, -1); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
765 | 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
|
766 | g_free(tmp); |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
767 | first = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
768 | subjects++; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
769 | } |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
770 | #define SAFE(x) ((x) ? (x) : "") |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
771 | 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
|
772 | #undef SAFE |
|
13414
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
773 | g_free(to_text); |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
774 | g_free(from_text); |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
775 | g_free(subject_text); |
|
35689
1e257009ac10
Fix Pidgin clang scan-build warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
776 | (void)first; |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
777 | |
| 22999 | 778 | /* 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
|
779 | 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
|
780 | 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
|
781 | 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
|
782 | 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
|
783 | 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
|
784 | } |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
785 | g_free(notification); |
|
13414
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
786 | |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
787 | if (urls != NULL) |
|
eadfdb95f030
[gaim-migrate @ 15788]
Richard Laager <rlaager@pidgin.im>
parents:
13281
diff
changeset
|
788 | urls++; |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
789 | } |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
790 | } else { |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
791 | if (count > 0) { |
|
40150
eda298799a8e
Add some NULL checks to silence scan-build.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40131
diff
changeset
|
792 | notification = g_strdup_printf( |
|
eda298799a8e
Add some NULL checks to silence scan-build.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40131
diff
changeset
|
793 | ngettext("%s has %d new message.", |
|
eda298799a8e
Add some NULL checks to silence scan-build.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40131
diff
changeset
|
794 | "%s has %d new messages.", (int)count), |
|
eda298799a8e
Add some NULL checks to silence scan-build.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40131
diff
changeset
|
795 | tos ? *tos : "(unknown)", (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
|
796 | 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
|
797 | 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
|
798 | 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
|
799 | } |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
800 | g_free(notification); |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
801 | } else { |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
802 | /* 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
|
803 | 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
|
804 | |
|
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
|
805 | 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
|
806 | /* |
|
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
|
807 | * 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
|
808 | * 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
|
809 | */ |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
810 | pidgin_blist_set_headline(NULL, NULL, NULL, NULL, NULL); |
|
20149
1c03148f1668
applied changes from c0104c111e903cfec5d0a95e0ae9dafb72f0dcbf
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
811 | return NULL; |
|
20113
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
812 | } |
|
3bb2fec99650
applied changes from 4bb1d6cbfe69a2e7782336a7e6e93e438a8bdbfc
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
813 | } |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
814 | } |
|
12647
b00d9913117e
[gaim-migrate @ 14985]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12624
diff
changeset
|
815 | |
|
32765
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
816 | /* 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
|
817 | 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
|
818 | 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
|
819 | && 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
|
820 | 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
|
821 | } |
|
8bbf4ee0dc42
Select the first item in the mail-notification dialog. Also,
Tim Retout <tim@retout.co.uk>
parents:
32755
diff
changeset
|
822 | |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32912
diff
changeset
|
823 | if (!gtk_widget_get_visible(mail_dialog->dialog)) { |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23031
diff
changeset
|
824 | 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
|
825 | "<b>%d new emails.</b>", |
| 15246 | 826 | mail_dialog->total_count), mail_dialog->total_count); |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
827 | 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
|
828 | remove the notifications when replacing an |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
829 | old notification. */ |
|
39144
2a3a4a3019f5
Port pidgin_blist_set_headline() from GdkPixbuf to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
38929
diff
changeset
|
830 | pidgin_blist_set_headline(label_text, "mail-unread", |
|
2a3a4a3019f5
Port pidgin_blist_set_headline() from GdkPixbuf to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
38929
diff
changeset
|
831 | G_CALLBACK(pidgin_notify_emails_present), |
|
2a3a4a3019f5
Port pidgin_blist_set_headline() from GdkPixbuf to GtkIconTheme
Mike Ruprecht <cmaiku@gmail.com>
parents:
38929
diff
changeset
|
832 | mail_dialog->dialog, |
|
40128
9b64a2d80f8c
Remove redundant callback type casts
qarkai <qarkai@gmail.com>
parents:
40094
diff
changeset
|
833 | reset_mail_dialog); |
|
15389
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
834 | mail_dialog->in_use = FALSE; |
|
2427b3d24858
[gaim-migrate @ 18118]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15388
diff
changeset
|
835 | g_free(label_text); |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32912
diff
changeset
|
836 | } 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
|
837 | pidgin_set_urgent(GTK_WINDOW(mail_dialog->dialog), TRUE); |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
838 | |
| 22999 | 839 | return data; |
| 5437 | 840 | } |
| 841 | ||
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
842 | static gboolean |
|
10875
bd4a5904e395
[gaim-migrate @ 12566]
Daniel Atallah <datallah@pidgin.im>
parents:
10774
diff
changeset
|
843 | formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) |
| 7455 | 844 | { |
|
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
|
845 | if (event->keyval == GDK_KEY_Escape) |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
846 | { |
| 15884 | 847 | purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
848 | |
| 7455 | 849 | return TRUE; |
| 850 | } | |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
851 | |
| 7455 | 852 | return FALSE; |
| 853 | } | |
| 854 | ||
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
855 | static void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
856 | pidgin_notify_formatted(const char *title, const char *primary, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
857 | const char *secondary, const char *text) |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
858 | { |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
859 | GtkWidget *window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
860 | GtkWidget *vbox; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
861 | GtkWidget *label; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
862 | GtkWidget *button; |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
863 | GtkWidget *sw; |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
864 | GtkWidget *view; |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
865 | GtkTextBuffer *buffer; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
866 | char label_text[2048]; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
867 | char *linked_text, *primary_esc, *secondary_esc; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
868 | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
869 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
870 | gtk_window_set_title(GTK_WINDOW(window), title); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
871 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
872 | |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
873 | g_signal_connect(G_OBJECT(window), "delete_event", |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
874 | G_CALLBACK(formatted_close_cb), NULL); |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
875 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
876 | /* 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
|
877 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
878 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
879 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
880 | primary_esc = g_markup_escape_text(primary, -1); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
881 | 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
|
882 | g_snprintf(label_text, sizeof(label_text), |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
883 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
884 | primary_esc, |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
885 | (secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
886 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
887 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
888 | g_free(secondary_esc); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
889 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
890 | label = gtk_label_new(NULL); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
891 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
892 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
893 | 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
|
894 | gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
895 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
896 | gtk_label_set_yalign(GTK_LABEL(label), 0); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
897 | gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
898 | gtk_widget_show(label); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
899 | |
| 39214 | 900 | /* Add the view */ |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
901 | sw = gtk_scrolled_window_new(NULL, NULL); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
902 | gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
903 | |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
904 | buffer = talkatu_html_buffer_new(); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
905 | view = talkatu_view_new_with_buffer(buffer); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
906 | gtk_container_add(GTK_CONTAINER(sw), view); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
907 | gtk_widget_set_name(view, "pidgin_notify_view"); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
908 | gtk_widget_set_size_request(view, 300, 250); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
909 | gtk_widget_show_all(sw); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
910 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
911 | /* Add the Close button. */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
912 | 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
|
913 | gtk_widget_grab_focus(button); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
914 | |
| 6872 | 915 | 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
|
916 | G_CALLBACK(formatted_close_cb), window); |
| 7455 | 917 | g_signal_connect(G_OBJECT(window), "key_press_event", |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
918 | G_CALLBACK(formatted_input_cb), NULL); |
| 7455 | 919 | |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
920 | /* Make sure URLs are clickable */ |
| 15884 | 921 | linked_text = purple_markup_linkify(text); |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
922 | talkatu_markup_set_html(TALKATU_BUFFER(buffer), linked_text, -1); |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
923 | g_free(linked_text); |
| 7078 | 924 | |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
925 | g_object_set_data(G_OBJECT(window), "view-widget", view); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
926 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
927 | /* 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
|
928 | 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
|
929 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
930 | gtk_widget_show(window); |
|
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 | return window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
933 | } |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
934 | |
| 11359 | 935 | static void |
| 15884 | 936 | pidgin_notify_searchresults_new_rows(PurpleConnection *gc, PurpleNotifySearchResults *results, |
| 13641 | 937 | void *data_) |
| 11359 | 938 | { |
| 15882 | 939 | PidginNotifySearchResultsData *data = data_; |
| 11359 | 940 | GtkListStore *model = data->model; |
| 941 | GtkTreeIter iter; | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
942 | GdkPixbuf *pixbuf; |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
943 | GList *row, *column; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
944 | guint n; |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
945 | |
| 11359 | 946 | gtk_list_store_clear(data->model); |
| 947 | ||
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34874
diff
changeset
|
948 | pixbuf = pidgin_create_protocol_icon(purple_connection_get_account(gc), PIDGIN_PROTOCOL_ICON_SMALL); |
| 11359 | 949 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
950 | for (row = results->rows; row != NULL; row = row->next) { |
| 11359 | 951 | |
| 952 | gtk_list_store_append(model, &iter); | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
953 | gtk_list_store_set(model, &iter, 0, pixbuf, -1); |
| 11359 | 954 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
955 | n = 1; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
956 | for (column = row->data; column != NULL; column = column->next) { |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
957 | GValue v; |
| 11359 | 958 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
959 | v.g_type = 0; |
| 11359 | 960 | 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
|
961 | 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
|
962 | 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
|
963 | n++; |
| 11359 | 964 | } |
| 965 | } | |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
966 | |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
967 | if (pixbuf != NULL) |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
968 | g_object_unref(pixbuf); |
| 11359 | 969 | } |
| 970 | ||
| 9797 | 971 | static void * |
| 15884 | 972 | pidgin_notify_searchresults(PurpleConnection *gc, const char *title, |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
973 | const char *primary, const char *secondary, |
| 15884 | 974 | PurpleNotifySearchResults *results, gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
975 | { |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
976 | GtkWidget *window; |
| 11359 | 977 | GtkWidget *treeview; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
978 | GtkWidget *close_button; |
| 11359 | 979 | GType *col_types; |
| 980 | GtkListStore *model; | |
| 981 | GtkCellRenderer *renderer; | |
| 12257 | 982 | 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
|
983 | GList *columniter; |
| 12257 | 984 | 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
|
985 | GList *l; |
| 11359 | 986 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
987 | GtkWidget *vbox; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
988 | GtkWidget *label; |
| 15882 | 989 | PidginNotifySearchResultsData *data; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
990 | char *label_text; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
991 | char *primary_esc, *secondary_esc; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
992 | |
| 12257 | 993 | g_return_val_if_fail(gc != NULL, NULL); |
| 994 | g_return_val_if_fail(results != NULL, NULL); | |
| 995 | ||
|
39922
113b93e2bd2a
Replace malloc(sizeof(...)) with g_new0(..., 1).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
996 | data = g_new0(PidginNotifySearchResultsData, 1); |
| 13641 | 997 | data->user_data = user_data; |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
998 | data->results = results; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
999 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1000 | /* Create the window */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1001 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1002 | 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
|
1003 | 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
|
1004 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1005 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1006 | g_signal_connect_swapped(G_OBJECT(window), "delete_event", |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1007 | G_CALLBACK(searchresults_close_cb), data); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1008 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1009 | /* 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
|
1010 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1011 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1012 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1013 | primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1014 | 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
|
1015 | label_text = g_strdup_printf( |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1016 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1017 | (primary ? primary_esc : ""), |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1018 | (primary && secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1019 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1020 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
1021 | g_free(secondary_esc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1022 | label = gtk_label_new(NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1023 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1024 | gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
1025 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
1026 | gtk_label_set_yalign(GTK_LABEL(label), 0); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1027 | 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
|
1028 | gtk_widget_show(label); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1029 | g_free(label_text); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1030 | |
| 11359 | 1031 | /* +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
|
1032 | col_num = g_list_length(results->columns) + 1; |
| 11359 | 1033 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1034 | /* Setup the list model */ |
| 11359 | 1035 | col_types = g_new0(GType, col_num); |
| 1036 | ||
| 1037 | /* There always is this first column. */ | |
| 1038 | col_types[0] = GDK_TYPE_PIXBUF; | |
| 1039 | for (i = 1; i < col_num; i++) { | |
| 1040 | col_types[i] = G_TYPE_STRING; | |
| 1041 | } | |
| 1042 | model = gtk_list_store_newv(col_num, col_types); | |
| 22999 | 1043 | g_free(col_types); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1044 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1045 | /* Setup the treeview */ |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1046 | 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
|
1047 | g_object_unref(G_OBJECT(model)); |
| 11359 | 1048 | gtk_widget_set_size_request(treeview, 500, 400); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1049 | 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
|
1050 | GTK_SELECTION_SINGLE); |
| 11359 | 1051 | 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
|
1052 | 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
|
1053 | 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
|
1054 | TRUE, TRUE, 0); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1055 | gtk_widget_show(treeview); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1056 | |
| 11359 | 1057 | renderer = gtk_cell_renderer_pixbuf_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1058 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
| 11359 | 1059 | -1, "", renderer, "pixbuf", 0, NULL); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1060 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
1061 | 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
|
1062 | 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
|
1063 | PurpleNotifySearchColumn *column = columniter->data; |
| 11359 | 1064 | renderer = gtk_cell_renderer_text_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1065 | |
| 11359 | 1066 | 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
|
1067 | purple_notify_searchresult_column_get_title(column), renderer, "text", i, NULL); |
| 31696 | 1068 | |
| 1069 | if (!purple_notify_searchresult_column_is_visible(column)) | |
| 1070 | gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); | |
| 1071 | ||
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
1072 | i++; |
| 11359 | 1073 | } |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
1074 | |
|
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
|
1075 | 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
|
1076 | PurpleNotifySearchButton *b = l->data; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1077 | GtkWidget *button = NULL; |
| 11359 | 1078 | switch (b->type) { |
| 15884 | 1079 | case PURPLE_NOTIFY_BUTTON_LABELED: |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1080 | if(b->label) { |
|
38789
ad3e9caa955b
Ensure labelled buttons are shown for search results in Pidgin.
Howard Chu <hyc@symas.com>
parents:
38737
diff
changeset
|
1081 | 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
|
1082 | } else { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19546
diff
changeset
|
1083 | purple_debug_warning("gtknotify", "Missing button label\n"); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1084 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1085 | break; |
| 15884 | 1086 | 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
|
1087 | button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_GO_FORWARD, GTK_RESPONSE_NONE); |
| 11359 | 1088 | break; |
| 15884 | 1089 | 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
|
1090 | button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_ADD, GTK_RESPONSE_NONE); |
| 11359 | 1091 | break; |
| 15884 | 1092 | 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
|
1093 | 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
|
1094 | break; |
| 15884 | 1095 | 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
|
1096 | 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
|
1097 | break; |
| 15884 | 1098 | 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
|
1099 | 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
|
1100 | break; |
| 15884 | 1101 | 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
|
1102 | 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
|
1103 | break; |
| 11359 | 1104 | default: |
| 15884 | 1105 | purple_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); |
| 11359 | 1106 | } |
| 1107 | if (button != NULL) { | |
| 15882 | 1108 | PidginNotifySearchResultsButtonData *bd; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1109 | |
| 15882 | 1110 | bd = g_new0(PidginNotifySearchResultsButtonData, 1); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1111 | bd->button = b; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1112 | bd->data = data; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1113 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1114 | g_signal_connect(G_OBJECT(button), "clicked", |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1115 | G_CALLBACK(searchresults_callback_wrapper_cb), bd); |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
1116 | g_signal_connect_swapped(G_OBJECT(button), "destroy", G_CALLBACK(g_free), bd); |
| 11359 | 1117 | } |
| 1118 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1119 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1120 | /* Add the Close button */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
1121 | 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
|
1122 | |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1123 | g_signal_connect_swapped(G_OBJECT(close_button), "clicked", |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1124 | G_CALLBACK(searchresults_close_cb), data); |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1125 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32521
diff
changeset
|
1126 | data->account = purple_connection_get_account(gc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1127 | data->model = model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1128 | data->treeview = treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1129 | data->window = window; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1130 | |
| 11359 | 1131 | /* Insert rows. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1132 | pidgin_notify_searchresults_new_rows(gc, results, data); |
| 11359 | 1133 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1134 | /* 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
|
1135 | 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
|
1136 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1137 | gtk_widget_show(window); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1138 | return data; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1139 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1140 | |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1141 | /** Xerox'ed from Finch! How the tables have turned!! ;) **/ |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1142 | /** User information. **/ |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1143 | static GHashTable *userinfo; |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1144 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1145 | static char * |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1146 | userinfo_hash(PurpleAccount *account, const char *who) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1147 | { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1148 | char key[256]; |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40048
diff
changeset
|
1149 | g_snprintf(key, sizeof(key), "%s - %s", |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40048
diff
changeset
|
1150 | purple_account_get_username(account), |
|
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40048
diff
changeset
|
1151 | purple_normalize(account, who)); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1152 | return g_utf8_strup(key, -1); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1153 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1154 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1155 | static void |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1156 | remove_userinfo(GtkWidget *widget, gpointer key) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1157 | { |
|
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
|
1158 | 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
|
1159 | |
|
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
|
1160 | 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
|
1161 | 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
|
1162 | |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1163 | g_hash_table_remove(userinfo, key); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1164 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1165 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1166 | static void * |
| 15884 | 1167 | pidgin_notify_userinfo(PurpleConnection *gc, const char *who, |
| 1168 | PurpleNotifyUserInfo *user_info) | |
| 9797 | 1169 | { |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1170 | char *info; |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
1171 | void *ui_handle; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1172 | 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
|
1173 | PidginUserInfo *pinfo = NULL; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1174 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1175 | 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
|
1176 | 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
|
1177 | } |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
1178 | |
| 15884 | 1179 | 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
|
1180 | 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
|
1181 | if (pinfo != NULL) { |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
1182 | GtkWidget *view = g_object_get_data(G_OBJECT(pinfo->window), "view-widget"); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
1183 | GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1184 | char *linked_text = purple_markup_linkify(info); |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
1185 | talkatu_markup_set_html(TALKATU_BUFFER(buffer), linked_text, -1); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1186 | g_free(linked_text); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1187 | 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
|
1188 | 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
|
1189 | pinfo->count++; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1190 | } else { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1191 | char *primary = g_strdup_printf(_("Info for %s"), who); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1192 | 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
|
1193 | 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
|
1194 | 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
|
1195 | 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
|
1196 | 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
|
1197 | 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
|
1198 | 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
|
1199 | g_hash_table_insert(userinfo, key, pinfo); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
1200 | } |
|
15206
70520a610969
[gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents:
14865
diff
changeset
|
1201 | g_free(info); |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
1202 | return ui_handle; |
| 9797 | 1203 | } |
| 1204 | ||
| 5437 | 1205 | static void |
| 15884 | 1206 | pidgin_close_notify(PurpleNotifyType type, void *ui_handle) |
| 5437 | 1207 | { |
| 15884 | 1208 | if (type == PURPLE_NOTIFY_EMAIL || type == PURPLE_NOTIFY_EMAILS) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1209 | { |
| 15882 | 1210 | PidginNotifyMailData *data = (PidginNotifyMailData *)ui_handle; |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
1211 | |
|
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
|
1212 | 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
|
1213 | 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
|
1214 | 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
|
1215 | } |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
1216 | } |
| 15884 | 1217 | else if (type == PURPLE_NOTIFY_SEARCHRESULTS) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1218 | { |
| 15882 | 1219 | PidginNotifySearchResultsData *data = (PidginNotifySearchResultsData *)ui_handle; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1220 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1221 | gtk_widget_destroy(data->window); |
| 15884 | 1222 | purple_notify_searchresults_free(data->results); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1223 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1224 | g_free(data); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
1225 | } |
|
10750
455f5dc6e2f2
[gaim-migrate @ 12353]
Daniel Atallah <datallah@pidgin.im>
parents:
10732
diff
changeset
|
1226 | else if (ui_handle != NULL) |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
1227 | gtk_widget_destroy(GTK_WIDGET(ui_handle)); |
| 5437 | 1228 | } |
| 1229 | ||
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1230 | #ifndef _WIN32 |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1231 | static gboolean |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1232 | uri_command(GSList *arg_list, gboolean sync) |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1233 | { |
|
13520
f89ab3c41f4b
[gaim-migrate @ 15895]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13415
diff
changeset
|
1234 | gchar *tmp; |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1235 | GError *error = NULL; |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1236 | GSList *it; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1237 | gchar **argv; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1238 | gint argc, i; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1239 | gchar *program; |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1240 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1241 | g_return_val_if_fail(arg_list != NULL, FALSE); |
|
8278
5fecd24d863c
[gaim-migrate @ 9002]
Mark Doliner <markdoliner@pidgin.im>
parents:
8277
diff
changeset
|
1242 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1243 | program = arg_list->data; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1244 | purple_debug_misc("gtknotify", "Executing %s (%s)\n", program, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1245 | sync ? "sync" : "async"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1246 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1247 | if (!purple_program_is_valid(program)) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1248 | purple_debug_error("gtknotify", "Command \"%s\" is invalid\n", |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1249 | program); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1250 | tmp = g_strdup_printf( |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1251 | _("The browser command \"%s\" is invalid."), |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1252 | program ? program : "(null)"); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
1253 | 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
|
1254 | g_free(tmp); |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1255 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1256 | return FALSE; |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1257 | } |
|
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1258 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1259 | argc = g_slist_length(arg_list); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1260 | argv = g_new(gchar*, argc + 1); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1261 | i = 0; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1262 | for (it = arg_list; it; it = g_slist_next(it)) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1263 | if (purple_debug_is_verbose()) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1264 | purple_debug_misc("gtknotify", "argv[%d] = \"%s\"\n", |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1265 | i, (gchar*)it->data); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1266 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1267 | argv[i++] = it->data; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1268 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1269 | argv[i] = NULL; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1270 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1271 | if (sync) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1272 | gint exit_status = 0; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1273 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1274 | if (g_spawn_sync(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1275 | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1276 | NULL, NULL, NULL, NULL, &exit_status, &error) && |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1277 | exit_status == 0) |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1278 | { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1279 | g_free(argv); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1280 | return TRUE; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1281 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1282 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1283 | purple_debug_error("gtknotify", |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1284 | "Error launching \"%s\": %s (status: %d)\n", program, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1285 | error ? error->message : "(null)", exit_status); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1286 | tmp = g_strdup_printf(_("Error launching \"%s\": %s"), program, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1287 | error ? error->message : "(null)"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1288 | g_error_free(error); |
|
35265
77664079d0f0
Merge with a fair number of conflicts. Nothing too crazy.
Mark Doliner <mark@kingant.net>
diff
changeset
|
1289 | purple_notify_error(NULL, NULL, _("Unable to open URL"), tmp, NULL); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1290 | g_free(tmp); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1291 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1292 | g_free(argv); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1293 | return FALSE; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1294 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1295 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1296 | if (g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1297 | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, NULL, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1298 | NULL, NULL, &error)) |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1299 | { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1300 | g_free(argv); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1301 | return TRUE; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1302 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1303 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1304 | purple_debug_warning("gtknotify", "Error launching \"%s\": %s\n", |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1305 | program, error ? error->message : "(null)"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1306 | g_error_free(error); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1307 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1308 | g_free(argv); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1309 | return FALSE; |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1310 | } |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1311 | #endif /* _WIN32 */ |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1312 | |
| 7136 | 1313 | static void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1314 | pidgin_notify_uri(const char *uri) |
| 7136 | 1315 | { |
| 1316 | #ifndef _WIN32 | |
| 1317 | const char *web_browser; | |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1318 | int place; |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1319 | gchar *uri_escaped, *uri_custom = NULL; |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1320 | GSList *argv = NULL, *argv_remote = NULL; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1321 | gchar **usercmd_argv = NULL; |
| 7136 | 1322 | |
|
38737
d85c241e3183
Add unit tests for xdg-open URI escaping
Daniel Kamil Kozar <dkk089@gmail.com>
parents:
38722
diff
changeset
|
1323 | uri_escaped = purple_uri_escape_for_open(uri); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1324 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1325 | web_browser = purple_prefs_get_string(PIDGIN_PREFS_ROOT |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1326 | "/browsers/browser"); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
1327 | place = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/browsers/place"); |
| 7136 | 1328 | |
| 10060 | 1329 | /* if they are running gnome, use the gnome web browser */ |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1330 | if (purple_running_gnome() == TRUE) { |
|
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
|
1331 | 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
|
1332 | if (tmp == NULL) |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1333 | argv = g_slist_append(argv, "gnome-open"); |
|
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 |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1335 | argv = g_slist_append(argv, "xdg-open"); |
|
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
|
1336 | g_free(tmp); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1337 | argv = g_slist_append(argv, uri_escaped); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1338 | } else if (purple_running_osx() == TRUE) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1339 | argv = g_slist_append(argv, "open"); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1340 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1341 | } else if (purple_strequal(web_browser, "epiphany") || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1342 | purple_strequal(web_browser, "galeon")) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1343 | { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1344 | argv = g_slist_append(argv, (gpointer)web_browser); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1345 | |
| 15568 | 1346 | if (place == PIDGIN_BROWSER_NEW_WINDOW) |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1347 | argv = g_slist_append(argv, "-w"); |
| 15568 | 1348 | else if (place == PIDGIN_BROWSER_NEW_TAB) |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1349 | argv = g_slist_append(argv, "-n"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1350 | |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1351 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1352 | } else if (purple_strequal(web_browser, "xdg-open")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1353 | argv = g_slist_append(argv, "xdg-open"); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1354 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1355 | } else if (purple_strequal(web_browser, "gnome-open")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1356 | argv = g_slist_append(argv, "gnome-open"); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1357 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1358 | } else if (purple_strequal(web_browser, "kfmclient")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1359 | argv = g_slist_append(argv, "kfmclient"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1360 | argv = g_slist_append(argv, "openURL"); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1361 | argv = g_slist_append(argv, uri_escaped); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1362 | /* |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1363 | * Does Konqueror have options to open in new tab |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1364 | * and/or current window? |
|
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1365 | */ |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1366 | } else if (purple_strequal(web_browser, "mozilla") || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1367 | purple_strequal(web_browser, "mozilla-firebird") || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1368 | purple_strequal(web_browser, "firefox") || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1369 | purple_strequal(web_browser, "seamonkey")) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1370 | { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1371 | argv = g_slist_append(argv, (gpointer)web_browser); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1372 | argv = g_slist_append(argv, uri_escaped); |
|
9399
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1373 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1374 | g_assert(uri_custom == NULL); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1375 | if (place == PIDGIN_BROWSER_NEW_WINDOW) { |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1376 | uri_custom = g_strdup_printf("openURL(%s,new-window)", |
|
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1377 | uri_escaped); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1378 | } else if (place == PIDGIN_BROWSER_NEW_TAB) { |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1379 | uri_custom = g_strdup_printf("openURL(%s,new-tab)", |
|
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1380 | uri_escaped); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1381 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1382 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1383 | if (uri_custom != NULL) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1384 | argv_remote = g_slist_append(argv_remote, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1385 | (gpointer)web_browser); |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1386 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1387 | /* Firefox 0.9 and higher require a "-a firefox" option |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1388 | * when using -remote commands. This breaks older |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1389 | * versions of mozilla. So we include this other handly |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1390 | * little string when calling firefox. If the API for |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1391 | * remote calls changes any more in firefox then firefox |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1392 | * should probably be split apart from mozilla-firebird |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1393 | * and mozilla... but this is good for now. |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1394 | */ |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1395 | if (purple_strequal(web_browser, "firefox")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1396 | argv_remote = g_slist_append(argv_remote, "-a"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1397 | argv_remote = g_slist_append(argv_remote, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1398 | "firefox"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1399 | } |
|
9399
aeb9f3ace003
[gaim-migrate @ 10213]
Mark Doliner <markdoliner@pidgin.im>
parents:
9393
diff
changeset
|
1400 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1401 | argv_remote = g_slist_append(argv_remote, "-remote"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1402 | argv_remote = g_slist_append(argv_remote, uri_custom); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1403 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1404 | } else if (purple_strequal(web_browser, "opera")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1405 | argv = g_slist_append(argv, "opera"); |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1406 | |
| 15568 | 1407 | if (place == PIDGIN_BROWSER_NEW_WINDOW) |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1408 | argv = g_slist_append(argv, "-newwindow"); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1409 | else if (place == PIDGIN_BROWSER_NEW_TAB) |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1410 | argv = g_slist_append(argv, "-newpage"); |
|
35265
77664079d0f0
Merge with a fair number of conflicts. Nothing too crazy.
Mark Doliner <mark@kingant.net>
diff
changeset
|
1411 | /* `opera -remote "openURL(%s)"` command causes Pidgin to hang, |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1412 | * if there is no Opera instance running. |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1413 | */ |
|
9405
3413b3694435
[gaim-migrate @ 10219]
Mark Doliner <markdoliner@pidgin.im>
parents:
9399
diff
changeset
|
1414 | |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1415 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1416 | } else if (purple_strequal(web_browser, "google-chrome")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1417 | /* Google Chrome doesn't have command-line arguments that |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1418 | * control the opening of links from external calls. This is |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1419 | * controlled solely from a preference within Google Chrome. |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1420 | */ |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1421 | argv = g_slist_append(argv, "google-chrome"); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1422 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1423 | } else if (purple_strequal(web_browser, "chrome")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1424 | /* Chromium doesn't have command-line arguments that control |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1425 | * the opening of links from external calls. This is controlled |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1426 | * solely from a preference within Chromium. |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1427 | */ |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1428 | argv = g_slist_append(argv, "chrome"); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1429 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1430 | } else if (purple_strequal(web_browser, "chromium-browser")) { |
|
30799
02888122ed85
Add the new browsers here so they do useful stuff by default.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29503
diff
changeset
|
1431 | /* Chromium doesn't have command-line arguments that control the |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1432 | * opening of links from external calls. This is controlled |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1433 | * solely from a preference within Chromium. |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1434 | */ |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1435 | argv = g_slist_append(argv, "chromium-browser"); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1436 | argv = g_slist_append(argv, uri_escaped); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1437 | } else if (purple_strequal(web_browser, "custom")) { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1438 | GError *error = NULL; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1439 | const char *usercmd_command; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1440 | gint usercmd_argc, i; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1441 | gboolean uri_added = FALSE; |
| 7136 | 1442 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1443 | usercmd_command = purple_prefs_get_string(PIDGIN_PREFS_ROOT |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1444 | "/browsers/manual_command"); |
| 7136 | 1445 | |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1446 | if (usercmd_command == NULL || *usercmd_command == '\0') { |
| 15884 | 1447 | purple_notify_error(NULL, NULL, _("Unable to open URL"), |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1448 | _("The 'Manual' browser command has been " |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
1449 | "chosen, but no command has been set."), NULL); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1450 | g_free(uri_escaped); |
| 7136 | 1451 | return NULL; |
| 1452 | } | |
| 1453 | ||
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1454 | if (!g_shell_parse_argv(usercmd_command, &usercmd_argc, |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1455 | &usercmd_argv, &error)) |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1456 | { |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1457 | purple_notify_error(NULL, NULL, _("Unable to open URL: " |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1458 | "the 'Manual' browser command seems invalid."), |
|
35265
77664079d0f0
Merge with a fair number of conflicts. Nothing too crazy.
Mark Doliner <mark@kingant.net>
diff
changeset
|
1459 | error ? error->message : NULL, NULL); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1460 | g_error_free(error); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1461 | g_free(uri_escaped); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1462 | return NULL; |
| 7136 | 1463 | } |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1464 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1465 | for (i = 0; i < usercmd_argc; i++) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1466 | gchar *cmd_part = usercmd_argv[i]; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1467 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1468 | if (uri_added || strstr(cmd_part, "%s") == NULL) { |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1469 | argv = g_slist_append(argv, cmd_part); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1470 | continue; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1471 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1472 | |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1473 | uri_custom = purple_strreplace(cmd_part, "%s", |
|
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1474 | uri_escaped); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1475 | argv = g_slist_append(argv, uri_custom); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1476 | uri_added = TRUE; |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1477 | } |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1478 | |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1479 | /* There is no "%s" in the browser command. Assume the user |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1480 | * wanted the URL tacked on to the end of the command. |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1481 | */ |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1482 | if (!uri_added) |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1483 | argv = g_slist_append(argv, uri_escaped); |
| 7136 | 1484 | } |
| 1485 | ||
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1486 | if (argv_remote != NULL) { |
|
8272
c1e38e0ec1d5
[gaim-migrate @ 8996]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8267
diff
changeset
|
1487 | /* try the remote command first */ |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1488 | if (!uri_command(argv_remote, TRUE)) |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1489 | uri_command(argv, FALSE); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1490 | } else |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1491 | uri_command(argv, FALSE); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1492 | |
|
35231
98f3f47f8382
g_strfreev checks for NULL itself, so we don't need to do it.
Mark Doliner <mark@kingant.net>
parents:
35209
diff
changeset
|
1493 | g_strfreev(usercmd_argv); |
|
35241
dc08416b884f
Bring back the URL escaping code, but use a better character whitelist.
Mark Doliner <mark@kingant.net>
parents:
35240
diff
changeset
|
1494 | g_free(uri_escaped); |
|
35209
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1495 | g_free(uri_custom); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1496 | g_slist_free(argv); |
|
0f7e07af75fc
Fix security-related url notification issues: xdg-open remote execution, replacing g_spawn_command_line_ with g_spawn_ and opera 'open in current tab' bug
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33793
diff
changeset
|
1497 | g_slist_free(argv_remote); |
| 7136 | 1498 | |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1499 | #else /* !_WIN32 */ |
|
35281
bbb57182e566
Fix win32 build issue with pidgin_notify_uri
Daniel Atallah <datallah@pidgin.im>
parents:
35241
diff
changeset
|
1500 | winpidgin_notify_uri(uri); |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1501 | #endif /* !_WIN32 */ |
| 7136 | 1502 | |
| 1503 | return NULL; | |
| 1504 | } | |
| 1505 | ||
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1506 | void |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1507 | 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
|
1508 | 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
|
1509 | { |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1510 | GdkPixbuf *icon; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1511 | GtkTreeIter iter; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1512 | 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
|
1513 | gboolean first = (pounce_dialog == NULL); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1514 | |
|
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
|
1515 | 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
|
1516 | 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
|
1517 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34874
diff
changeset
|
1518 | icon = pidgin_create_protocol_icon(account, PIDGIN_PROTOCOL_ICON_SMALL); |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1519 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1520 | pounce_data = g_new(PidginNotifyPounceData, 1); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1521 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1522 | pounce_data->account = account; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1523 | pounce_data->pounce = pounce; |
|
28355
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1524 | 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
|
1525 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1526 | 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
|
1527 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1528 | 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
|
1529 | PIDGIN_POUNCE_ICON, icon, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1530 | PIDGIN_POUNCE_ALIAS, alias, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1531 | PIDGIN_POUNCE_EVENT, event, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1532 | 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
|
1533 | PIDGIN_POUNCE_DATE, date, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1534 | PIDGIN_POUNCE_DATA, pounce_data, |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1535 | -1); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1536 | |
|
28365
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1537 | if (first) { |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1538 | GtkTreeSelection *selection = |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1539 | 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
|
1540 | 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
|
1541 | } |
|
edb57781bf9b
pounce dialog: Try to always have a row selected. Fixes #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28364
diff
changeset
|
1542 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1543 | if (icon) |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1544 | g_object_unref(icon); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1545 | |
|
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
|
1546 | 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
|
1547 | } |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1548 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1549 | 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
|
1550 | pidgin_create_notification_dialog(PidginNotifyType type) |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1551 | { |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1552 | 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
|
1553 | 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
|
1554 | 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
|
1555 | 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
|
1556 | 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
|
1557 | 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
|
1558 | 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
|
1559 | 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
|
1560 | PidginNotifyDialog *spec_dialog = NULL; |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
1561 | |
|
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
|
1562 | g_return_val_if_fail(type < PIDGIN_NOTIFY_TYPES, NULL); |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
1563 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1564 | 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
|
1565 | 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
|
1566 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1567 | 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
|
1568 | 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
|
1569 | |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1570 | } 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
|
1571 | 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
|
1572 | |
|
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
|
1573 | 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
|
1574 | 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
|
1575 | G_TYPE_STRING, G_TYPE_POINTER); |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1576 | } |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1577 | |
|
28364
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1578 | 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
|
1579 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
1580 | /* Vertical box */ |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33146
diff
changeset
|
1581 | 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
|
1582 | |
|
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
|
1583 | /* 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
|
1584 | 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
|
1585 | 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
|
1586 | 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
|
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 | /* 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
|
1589 | 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
|
1590 | |
|
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 | 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
|
1592 | 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
|
1593 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1594 | spec_dialog->treemodel = model; |
|
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1595 | 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
|
1596 | g_object_unref(G_OBJECT(model)); |
|
27487
3fe841d5a8e8
Remove trailing whitespace
Paul Aurich <darkrain42@pidgin.im>
parents:
27476
diff
changeset
|
1597 | |
|
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
|
1598 | 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
|
1599 | 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
|
1600 | 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
|
1601 | 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
|
1602 | 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
|
1603 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1604 | 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
|
1605 | _("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
|
1606 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1607 | 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
|
1608 | 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
|
1609 | 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
|
1610 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1611 | 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
|
1612 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1613 | 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
|
1614 | 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
|
1615 | 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
|
1616 | 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
|
1617 | 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
|
1618 | |
|
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 | 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
|
1620 | 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
|
1621 | 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
|
1622 | 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
|
1623 | 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
|
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_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
|
1627 | 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
|
1628 | 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
|
1629 | |
|
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 | 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
|
1631 | 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
|
1632 | 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
|
1633 | 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
|
1634 | 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
|
1635 | |
|
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 | 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
|
1637 | 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
|
1638 | |
|
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 | } 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
|
1640 | 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
|
1641 | |
|
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 | 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
|
1643 | _("IM"), GTK_RESPONSE_YES); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1644 | gtk_widget_set_sensitive(button, FALSE); |
|
d8aac6fa1cdc
Further pounce dialog improvements. Refs #10037.
Paul Aurich <darkrain42@pidgin.im>
parents:
28343
diff
changeset
|
1645 | spec_dialog->open_button = button; |
|
28364
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1646 | |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1647 | 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
|
1648 | PIDGIN_STOCK_MODIFY, GTK_RESPONSE_APPLY); |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1649 | gtk_widget_set_sensitive(button, FALSE); |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1650 | spec_dialog->edit_button = button; |
|
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1651 | |
|
31531
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1652 | /* 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
|
1653 | "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
|
1654 | 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
|
1655 | 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
|
1656 | 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
|
1657 | 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
|
1658 | word. */ |
|
e595953836e3
Add a hint to translators on how to translate this string. Italian and
Mark Doliner <markdoliner@pidgin.im>
parents:
30812
diff
changeset
|
1659 | 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
|
1660 | 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
|
1661 | 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
|
1662 | 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
|
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 | 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
|
1665 | 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
|
1666 | |
|
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 | 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
|
1668 | 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
|
1669 | 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
|
1670 | 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
|
1671 | 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
|
1672 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1673 | 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
|
1674 | 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
|
1675 | 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
|
1676 | 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
|
1677 | 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
|
1678 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1679 | 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
|
1680 | 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
|
1681 | 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
|
1682 | 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
|
1683 | 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
|
1684 | 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
|
1685 | 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
|
1686 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1687 | 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
|
1688 | 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
|
1689 | 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
|
1690 | 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
|
1691 | 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
|
1692 | 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
|
1693 | 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
|
1694 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1695 | 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
|
1696 | 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
|
1697 | 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
|
1698 | 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
|
1699 | 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
|
1700 | 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
|
1701 | 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
|
1702 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1703 | 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
|
1704 | 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
|
1705 | |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1706 | 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
|
1707 | 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
|
1708 | 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
|
1709 | 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
|
1710 | 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
|
1711 | 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
|
1712 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1713 | |
|
35998
aeaebd2ba4af
Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35281
diff
changeset
|
1714 | gtk_dialog_add_button(GTK_DIALOG(dialog), |
|
aeaebd2ba4af
Silence more already dismissed coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35281
diff
changeset
|
1715 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); |
|
28364
ef0c1c5cbad8
Reorder the New Pounces/New Mail dialog buttons.
Paul Aurich <darkrain42@pidgin.im>
parents:
28355
diff
changeset
|
1716 | |
|
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
|
1717 | gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
1718 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
1719 | gtk_label_set_yalign(GTK_LABEL(label), 0); |
|
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
|
1720 | gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35998
diff
changeset
|
1721 | 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
|
1722 | 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
|
1723 | 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
|
1724 | |
|
27488
5de4bfb850c5
Remove a few layers of evil abstraction.
Paul Aurich <darkrain42@pidgin.im>
parents:
27487
diff
changeset
|
1725 | 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
|
1726 | } |
|
ca1524dbcbf0
A patch from Jorge Villaseñor which makes all pounces share a single window.
Kevin Stange <kstange@pidgin.im>
parents:
24816
diff
changeset
|
1727 | |
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1728 | static void |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1729 | 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
|
1730 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1731 | /* 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
|
1732 | 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
|
1733 | |
|
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
|
1734 | 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
|
1735 | 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
|
1736 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1737 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1738 | static void* |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1739 | 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
|
1740 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1741 | static int handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1742 | return &handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1743 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1744 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1745 | 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
|
1746 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1747 | 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
|
1748 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1749 | 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
|
1750 | 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
|
1751 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1752 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1753 | 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
|
1754 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1755 | 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
|
1756 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
1757 | |
| 15884 | 1758 | static PurpleNotifyUiOps ops = |
| 5437 | 1759 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1760 | pidgin_notify_message, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1761 | pidgin_notify_email, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1762 | pidgin_notify_emails, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1763 | pidgin_notify_formatted, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1764 | pidgin_notify_searchresults, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1765 | pidgin_notify_searchresults_new_rows, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1766 | pidgin_notify_userinfo, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1767 | 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
|
1768 | 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
|
1769 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1770 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1771 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16259
diff
changeset
|
1772 | NULL |
| 5437 | 1773 | }; |
| 1774 | ||
| 15884 | 1775 | PurpleNotifyUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
1776 | pidgin_notify_get_ui_ops(void) |
| 5437 | 1777 | { |
| 1778 | return &ops; | |
| 1779 | } |