Mercurial > pidgin.yaz
annotate src/gtknotify.c @ 10449:0349cb9aa5a4
[gaim-migrate @ 11714]
sf patch #1045370, from Nathan Fredrickson
Make the X on conversation tabs not get cut off with gtk 2.4.2 and newer
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 29 Dec 2004 23:42:54 +0000 |
parents | 911530134bf8 |
children | e6b87f7e8988 |
rev | line source |
---|---|
5437 | 1 /** |
2 * @file gtknotify.c GTK+ Notification API | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
10 * |
5437 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9791 | 25 #include "internal.h" |
26 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
27 |
7455 | 28 #include <gdk/gdkkeysyms.h> |
29 | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
30 #include "connection.h" |
8284 | 31 #include "debug.h" |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
32 #include "prefs.h" |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10260
diff
changeset
|
33 #include "gtkstock.h" |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
34 #include "util.h" |
5437 | 35 |
10439 | 36 #include "gtkblist.h" |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
37 #include "gtkimhtml.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
38 #include "gtknotify.h" |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
39 #include "gtkutils.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
40 |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
41 typedef struct |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
42 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5543
diff
changeset
|
43 GaimConnection *gc; |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
44 char *url; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
45 GtkWidget *dialog; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
46 GtkWidget *label; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
47 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
48 } GaimNotifyMailData; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
49 |
10439 | 50 typedef struct |
51 { | |
52 GaimAccount *account; | |
53 GtkListStore *model; | |
54 GtkWidget *treeview; | |
55 GtkWidget *window; | |
56 | |
57 } GaimNotifySearchResultsData; | |
58 | |
59 enum | |
60 { | |
61 COLUMN_ICON, | |
62 COLUMN_SCREENNAME, | |
63 NUM_COLUMNS | |
64 }; | |
65 | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
66 static void *gaim_gtk_notify_emails(size_t count, gboolean detailed, |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
67 const char **subjects, |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
68 const char **froms, const char **tos, |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
69 const char **urls, GCallback cb, |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
70 void *user_data); |
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
71 |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
72 static void |
6354
76af8c066f8c
[gaim-migrate @ 6853]
Christian Hammond <chipx86@chipx86.com>
parents:
6106
diff
changeset
|
73 message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) |
6104 | 74 { |
6357 | 75 gaim_notify_close(GAIM_NOTIFY_MESSAGE, widget); |
6104 | 76 } |
77 | |
78 static void | |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
79 email_response_cb(GtkDialog *dialog, gint id, GaimNotifyMailData *data) |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
80 { |
10260 | 81 if (id == GTK_RESPONSE_YES) |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
82 gaim_notify_uri(NULL, data->url); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
83 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
84 gaim_notify_close(GAIM_NOTIFY_EMAILS, data); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
85 } |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
86 |
7007
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
87 static void |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
88 formatted_close_cb(GtkWidget *win, GdkEvent *event, void *user_data) |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
89 { |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
90 gaim_notify_close(GAIM_NOTIFY_FORMATTED, win); |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
91 } |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
92 |
10439 | 93 static void |
94 searchresults_close_cb(GaimNotifySearchResultsData *data, GdkEvent *event, void *user_data) | |
95 { | |
96 gaim_notify_close(GAIM_NOTIFY_SEARCHRESULTS, data); | |
97 } | |
98 | |
99 static void | |
100 add_buddy_helper_cb(GtkWidget *widget, GaimNotifySearchResultsData *data) | |
101 { | |
102 GtkTreeSelection *selection; | |
103 GtkTreeModel *model; | |
104 GtkTreeIter iter; | |
105 gchar *buddy; | |
106 | |
107 g_return_if_fail(data != NULL); | |
108 | |
109 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->treeview)); | |
110 | |
111 if (gtk_tree_selection_get_selected(selection, &model, &iter)) | |
112 { | |
113 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | |
114 COLUMN_SCREENNAME, &buddy, -1); | |
115 gaim_blist_request_add_buddy(data->account, buddy, NULL, NULL); | |
116 g_free(buddy); | |
117 } | |
118 } | |
119 | |
5437 | 120 static void * |
121 gaim_gtk_notify_message(GaimNotifyMsgType type, const char *title, | |
122 const char *primary, const char *secondary, | |
123 GCallback cb, void *user_data) | |
124 { | |
125 GtkWidget *dialog; | |
126 GtkWidget *hbox; | |
127 GtkWidget *label; | |
128 GtkWidget *img = NULL; | |
129 char label_text[2048]; | |
130 const char *icon_name = NULL; | |
131 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
132 switch (type) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
133 { |
5437 | 134 case GAIM_NOTIFY_MSG_ERROR: |
135 icon_name = GAIM_STOCK_DIALOG_ERROR; | |
136 break; | |
137 | |
138 case GAIM_NOTIFY_MSG_WARNING: | |
139 icon_name = GAIM_STOCK_DIALOG_WARNING; | |
140 break; | |
141 | |
142 case GAIM_NOTIFY_MSG_INFO: | |
143 icon_name = GAIM_STOCK_DIALOG_INFO; | |
144 break; | |
145 | |
146 default: | |
147 icon_name = NULL; | |
148 break; | |
149 } | |
150 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
151 if (icon_name != NULL) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
152 { |
5437 | 153 img = gtk_image_new_from_stock(icon_name, GTK_ICON_SIZE_DIALOG); |
154 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
155 } | |
156 | |
7678 | 157 dialog = gtk_dialog_new_with_buttons(title ? title : GAIM_ALERT_TITLE, |
10260 | 158 NULL, 0, GTK_STOCK_CLOSE, |
159 GTK_RESPONSE_CLOSE, NULL); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
160 |
8523
013d256e8ded
[gaim-migrate @ 9262]
Christian Hammond <chipx86@chipx86.com>
parents:
8356
diff
changeset
|
161 gtk_window_set_role(GTK_WINDOW(dialog), "notify_dialog"); |
013d256e8ded
[gaim-migrate @ 9262]
Christian Hammond <chipx86@chipx86.com>
parents:
8356
diff
changeset
|
162 |
5437 | 163 g_signal_connect(G_OBJECT(dialog), "response", |
6104 | 164 G_CALLBACK(message_response_cb), dialog); |
5437 | 165 |
166 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6); | |
167 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); | |
168 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
169 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12); | |
170 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6); | |
171 | |
172 hbox = gtk_hbox_new(FALSE, 12); | |
173 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); | |
174 | |
175 if (img != NULL) | |
176 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
177 | |
178 g_snprintf(label_text, sizeof(label_text), | |
179 "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", | |
180 primary, (secondary ? secondary : "")); | |
181 | |
182 label = gtk_label_new(NULL); | |
183 | |
184 gtk_label_set_markup(GTK_LABEL(label), label_text); | |
185 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
186 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
187 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
188 | |
189 gtk_widget_show_all(dialog); | |
190 | |
191 return dialog; | |
192 } | |
193 | |
194 static void * | |
195 gaim_gtk_notify_email(const char *subject, const char *from, | |
196 const char *to, const char *url, | |
197 GCallback cb, void *user_data) | |
198 { | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
199 return gaim_gtk_notify_emails(1, TRUE, |
5524
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
200 (subject == NULL ? NULL : &subject), |
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
201 (from == NULL ? NULL : &from), |
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
202 (to == NULL ? NULL : &to), |
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
203 (url == NULL ? NULL : &url), |
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
204 cb, user_data); |
5437 | 205 } |
206 | |
207 static void * | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
208 gaim_gtk_notify_emails(size_t count, gboolean detailed, |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
209 const char **subjects, const char **froms, |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
210 const char **tos, const char **urls, |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
211 GCallback cb, void *user_data) |
5437 | 212 { |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
213 GaimNotifyMailData *data; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
214 GtkWidget *dialog; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
215 GtkWidget *vbox; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
216 GtkWidget *hbox; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
217 GtkWidget *label; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
218 GtkWidget *img; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
219 char *detail_text; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
220 char *label_text; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
221 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
222 data = g_new0(GaimNotifyMailData, 1); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
223 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
224 data->url = g_strdup(urls[0]); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
225 |
10260 | 226 /* Create the dialog */ |
227 dialog = gtk_dialog_new_with_buttons("New Mail", NULL, 0, | |
228 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
229 NULL); | |
230 data->dialog = dialog; | |
5524
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
231 |
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
232 if (urls != NULL) |
10260 | 233 gtk_dialog_add_button(GTK_DIALOG(dialog), |
234 GAIM_STOCK_OPEN_MAIL, GTK_RESPONSE_YES); | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
235 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
236 g_signal_connect(G_OBJECT(dialog), "response", |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
237 G_CALLBACK(email_response_cb), data); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
238 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
239 /* Setup the dialog */ |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
240 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
241 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
242 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
243 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
244 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
245 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
246 /* Setup the main horizontal box */ |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
247 hbox = gtk_hbox_new(FALSE, 12); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
248 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
249 |
10260 | 250 /* Dialog icon */ |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
251 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_INFO, |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
252 GTK_ICON_SIZE_DIALOG); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
253 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
254 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
255 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
256 /* Vertical box */ |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
257 vbox = gtk_vbox_new(FALSE, 12); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
258 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
259 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
260 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
261 /* Descriptive label */ |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
262 detail_text = g_strdup_printf(ngettext("%s has %d new message.", |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
263 "%s has %d new messages.", |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
264 (int)count), |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
265 *tos, (int)count); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
266 |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
267 if (count == 1) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
268 { |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
269 char *from_text = NULL, *subject_text = NULL; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
270 |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
271 if (froms != NULL) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
272 { |
8920 | 273 char *from_enc; |
274 from_enc = g_markup_escape_text(*froms, -1); | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
275 from_text = g_strdup_printf( |
8920 | 276 _("<span weight=\"bold\">From:</span> %s\n"), from_enc); |
277 g_free(from_enc); | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
278 } |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
279 |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
280 if (subjects != NULL) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
281 { |
8920 | 282 char *subject_enc; |
283 subject_enc = g_markup_escape_text(*subjects, -1); | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
284 subject_text = g_strdup_printf( |
8920 | 285 _("<span weight=\"bold\">Subject:</span> %s\n"), subject_enc); |
286 g_free(subject_enc); | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
287 } |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
288 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
289 label_text = g_strdup_printf( |
5543 | 290 _("<span weight=\"bold\" size=\"larger\">You have mail!</span>" |
291 "\n\n%s%s%s%s"), | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
292 detail_text, |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
293 (from_text == NULL && subject_text == NULL ? "" : "\n\n"), |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
294 (from_text == NULL ? "" : from_text), |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
295 (subject_text == NULL ? "" : subject_text)); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
296 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
297 if (from_text != NULL) |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
298 g_free(from_text); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
299 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
300 if (subject_text != NULL) |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
301 g_free(subject_text); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
302 } |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
303 else |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
304 { |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
305 label_text = g_strdup_printf( |
5543 | 306 _("<span weight=\"bold\" size=\"larger\">You have mail!</span>" |
307 "\n\n%s"), detail_text); | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
308 } |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
309 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
310 g_free(detail_text); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
311 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
312 label = gtk_label_new(NULL); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
313 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
314 gtk_label_set_markup(GTK_LABEL(label), label_text); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
315 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
316 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
317 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
318 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
319 g_free(label_text); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
320 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
321 /* Show everything. */ |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
322 gtk_widget_show_all(dialog); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
323 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
324 return data; |
5437 | 325 } |
326 | |
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
327 static gboolean |
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
328 formatted_input_cb(GtkWidget *dialog, GdkEventKey *event, gpointer data) |
7455 | 329 { |
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
330 if (event->keyval == GDK_Escape) |
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
331 { |
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
332 gtk_widget_destroy(dialog); |
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
333 |
7455 | 334 return TRUE; |
335 } | |
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
336 |
7455 | 337 return FALSE; |
338 } | |
339 | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
340 static void * |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
341 gaim_gtk_notify_formatted(const char *title, const char *primary, |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
342 const char *secondary, const char *text, |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
343 GCallback cb, void *user_data) |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
344 { |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
345 GtkWidget *window; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
346 GtkWidget *vbox; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
347 GtkWidget *label; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
348 GtkWidget *button; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
349 GtkWidget *imhtml; |
10181 | 350 GtkWidget *frame; |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
351 int options = 0; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
352 char label_text[2048]; |
8272 | 353 char *linked_text; |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
354 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
355 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
8345 | 356 gtk_window_set_title(GTK_WINDOW(window), title); |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
357 gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
358 gtk_container_set_border_width(GTK_CONTAINER(window), 12); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
359 |
7007
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
360 g_signal_connect(G_OBJECT(window), "delete_event", |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
361 G_CALLBACK(formatted_close_cb), NULL); |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
362 |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
363 /* Setup the main vbox */ |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
364 vbox = gtk_vbox_new(FALSE, 12); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
365 gtk_container_add(GTK_CONTAINER(window), vbox); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
366 gtk_widget_show(vbox); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
367 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
368 /* Setup the descriptive label */ |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
369 g_snprintf(label_text, sizeof(label_text), |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
370 "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
371 primary, |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
372 (secondary ? "\n" : ""), |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
373 (secondary ? secondary : "")); |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
374 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
375 label = gtk_label_new(NULL); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
376 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
377 gtk_label_set_markup(GTK_LABEL(label), label_text); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
378 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
379 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
380 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
381 gtk_widget_show(label); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
382 |
10181 | 383 /* Add the imhtml */ |
384 frame = gaim_gtk_create_imhtml(FALSE, &imhtml, NULL); | |
9005 | 385 gtk_widget_set_name(imhtml, "gaim_gtknotify_imhtml"); |
10181 | 386 gtk_widget_set_size_request(imhtml, 300, 250); |
387 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
388 gtk_widget_show(frame); | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
389 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
390 /* Add the Close button. */ |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
391 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
392 gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
393 gtk_widget_show(button); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
394 |
6872 | 395 g_signal_connect_swapped(G_OBJECT(button), "clicked", |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
396 G_CALLBACK(formatted_close_cb), window); |
7455 | 397 g_signal_connect(G_OBJECT(window), "key_press_event", |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
398 G_CALLBACK(formatted_input_cb), NULL); |
7455 | 399 |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
400 /* Add the text to the gtkimhtml */ |
9049 | 401 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
402 options ^= GTK_IMHTML_NO_COLOURS; | |
403 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
404 options ^= GTK_IMHTML_NO_FONTS; | |
405 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
406 options ^= GTK_IMHTML_NO_SIZES; | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
407 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
408 options ^= GTK_IMHTML_NO_COMMENTS; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
409 options ^= GTK_IMHTML_NO_TITLE; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
410 options ^= GTK_IMHTML_NO_NEWLINE; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
411 options ^= GTK_IMHTML_NO_SCROLL; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
412 |
8882 | 413 /* Make sure URLs are clickable */ |
414 linked_text = gaim_markup_linkify(text); | |
10181 | 415 gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text, options); |
8882 | 416 g_free(linked_text); |
7078 | 417 |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
418 /* Show the window */ |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
419 gtk_widget_show(window); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
420 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
421 return window; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
422 } |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
423 |
9797 | 424 static void * |
10439 | 425 gaim_gtk_notify_searchresults(GaimConnection *gc, const char *title, |
426 const char *primary, const char *secondary, | |
427 const char **results, GCallback cb, | |
428 void *user_data) | |
429 { | |
430 GtkWidget *window; | |
431 GtkWidget *vbox; | |
432 GtkWidget *button_area; | |
433 GtkWidget *label; | |
434 GtkWidget *close_button; | |
435 GtkWidget *add_button; | |
436 GtkWidget *sw; | |
437 GtkWidget *treeview; | |
438 GdkPixbuf *icon, *scaled; | |
439 GaimNotifySearchResultsData *data; | |
440 GtkListStore *model; | |
441 GtkCellRenderer *renderer; | |
442 GtkTreeIter iter; | |
443 int i; | |
444 char *label_text; | |
445 | |
446 data = g_malloc(sizeof(GaimNotifySearchResultsData)); | |
447 | |
448 /* Create the window */ | |
449 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
450 gtk_window_set_title(GTK_WINDOW(window), (title ? title :_("Search Results"))); | |
451 gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); | |
452 gtk_container_set_border_width(GTK_CONTAINER(window), 12); | |
453 | |
454 g_signal_connect_swapped(G_OBJECT(window), "delete_event", | |
455 G_CALLBACK(searchresults_close_cb), data); | |
456 | |
457 /* Setup the main vbox */ | |
458 vbox = gtk_vbox_new(FALSE, 12); | |
459 gtk_container_add(GTK_CONTAINER(window), vbox); | |
460 gtk_widget_show(vbox); | |
461 | |
462 /* Setup the descriptive label */ | |
463 label_text = g_strdup_printf( | |
464 "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", | |
465 (primary ? primary : ""), | |
466 (primary && secondary ? "\n" : ""), | |
467 (secondary ? secondary : "")); | |
468 label = gtk_label_new(NULL); | |
469 gtk_label_set_markup(GTK_LABEL(label), label_text); | |
470 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
471 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
472 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
473 gtk_widget_show(label); | |
474 g_free(label_text); | |
475 | |
476 /* Setup the list model */ | |
477 model = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING); | |
478 | |
479 /* Setup the scrolled window containing the treeview */ | |
480 sw = gtk_scrolled_window_new(NULL, NULL); | |
481 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
482 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
483 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
484 GTK_SHADOW_IN); | |
485 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
486 gtk_widget_show(sw); | |
487 | |
488 /* Setup the treeview */ | |
489 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); | |
490 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | |
491 gtk_widget_set_size_request(treeview, 250, 150); | |
492 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), | |
493 GTK_SELECTION_SINGLE); | |
494 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); | |
495 gtk_container_add(GTK_CONTAINER(sw), treeview); | |
496 gtk_widget_show(treeview); | |
497 | |
498 /* icon column */ | |
499 renderer = gtk_cell_renderer_pixbuf_new (); | |
500 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
501 -1, "Icon", renderer, | |
502 "pixbuf", COLUMN_ICON, | |
503 NULL); | |
504 | |
505 /* screenname column */ | |
506 renderer = gtk_cell_renderer_text_new(); | |
507 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), | |
508 -1, "Screenname", renderer, | |
509 "text", COLUMN_SCREENNAME, | |
510 NULL); | |
511 | |
512 /* Setup the button area */ | |
513 button_area = gtk_hbutton_box_new(); | |
514 gtk_box_pack_start(GTK_BOX(vbox), button_area, FALSE, FALSE, 0); | |
515 gtk_button_box_set_layout(GTK_BUTTON_BOX(button_area), GTK_BUTTONBOX_END); | |
516 gtk_box_set_spacing(GTK_BOX(button_area), 12); | |
517 gtk_widget_show(button_area); | |
518 | |
519 /* Add the Add button */ | |
520 add_button = gtk_button_new_from_stock(GTK_STOCK_ADD); | |
521 gtk_box_pack_start(GTK_BOX(button_area), add_button, FALSE, FALSE, 0); | |
522 gtk_widget_show(add_button); | |
523 | |
524 /* Add the Close button */ | |
525 close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
526 gtk_box_pack_start(GTK_BOX(button_area), close_button, FALSE, FALSE, 0); | |
527 gtk_widget_show(close_button); | |
528 | |
529 /* Add the buddies to the tree view */ | |
530 icon = create_prpl_icon(gc->account); | |
531 scaled = gdk_pixbuf_scale_simple(icon, 16, 16, GDK_INTERP_BILINEAR); | |
532 | |
533 for (i = 0; results[i] != NULL; i++) | |
534 { | |
535 gtk_list_store_append(model, &iter); | |
536 gtk_list_store_set(model, &iter, | |
537 COLUMN_ICON, scaled, | |
538 COLUMN_SCREENNAME, results[i], | |
539 -1); | |
540 } | |
541 | |
542 data->account = gc->account; | |
543 data->model = model; | |
544 data->treeview = treeview; | |
545 data->window = window; | |
546 | |
547 /* Connect Signals */ | |
548 g_signal_connect(G_OBJECT(add_button), "clicked", | |
549 G_CALLBACK(add_buddy_helper_cb), data); | |
550 g_signal_connect_swapped(G_OBJECT(close_button), "clicked", | |
551 G_CALLBACK(searchresults_close_cb), data); | |
552 | |
553 /* Show the window */ | |
554 gtk_widget_show(window); | |
555 return data; | |
556 } | |
557 | |
558 static void * | |
9797 | 559 gaim_gtk_notify_userinfo(GaimConnection *gc, const char *who, |
560 const char *title, const char *primary, | |
561 const char *secondary, const char *text, | |
562 GCallback cb, void *user_data) | |
563 { | |
9800 | 564 return gaim_gtk_notify_formatted(title, primary, secondary, |
565 text, cb, user_data); | |
9797 | 566 } |
567 | |
5437 | 568 static void |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
569 gaim_gtk_close_notify(GaimNotifyType type, void *ui_handle) |
5437 | 570 { |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
571 if (type == GAIM_NOTIFY_EMAIL || type == GAIM_NOTIFY_EMAILS) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
572 { |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
573 GaimNotifyMailData *data = (GaimNotifyMailData *)ui_handle; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
574 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
575 gtk_widget_destroy(data->dialog); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
576 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
577 g_free(data->url); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
578 g_free(data); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
579 } |
10439 | 580 else if (type == GAIM_NOTIFY_SEARCHRESULTS) |
581 { | |
582 GaimNotifySearchResultsData *data = (GaimNotifySearchResultsData *)ui_handle; | |
583 | |
584 gtk_widget_destroy(data->window); | |
585 | |
586 g_free(data); | |
587 } | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
588 else |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
589 gtk_widget_destroy(GTK_WIDGET(ui_handle)); |
5437 | 590 } |
591 | |
8272 | 592 #ifndef _WIN32 |
593 static gint | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
594 uri_command(const char *command, gboolean sync) |
8272 | 595 { |
9777 | 596 gchar *escaped, *tmp; |
8272 | 597 GError *error = NULL; |
598 gint ret = 0; | |
599 | |
9777 | 600 escaped = gaim_escape_html(command); |
601 gaim_debug_misc("gtknotify", "Executing %s\n", escaped); | |
8278 | 602 |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
603 if (!gaim_program_is_valid(command)) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
604 { |
9777 | 605 tmp = g_strdup_printf(_("The browser command <b>%s</b> is invalid."), |
606 escaped ? escaped : "(none)"); | |
8272 | 607 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
608 g_free(tmp); | |
609 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
610 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
611 else if (sync) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
612 { |
8272 | 613 gint status; |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
614 |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
615 if (!g_spawn_command_line_sync(command, NULL, NULL, &status, &error)) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
616 { |
9777 | 617 tmp = g_strdup_printf(_("Error launching <b>%s</b>: %s"), |
618 escaped, error->message); | |
8272 | 619 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
620 g_free(tmp); | |
621 g_error_free(error); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
622 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
623 else |
8272 | 624 ret = status; |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
625 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
626 else |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
627 { |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
628 if (!g_spawn_command_line_async(command, &error)) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
629 { |
9777 | 630 tmp = g_strdup_printf(_("Error launching <b>%s</b>: %s"), |
631 escaped, error->message); | |
8272 | 632 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
633 g_free(tmp); | |
634 g_error_free(error); | |
635 } | |
636 } | |
637 | |
9777 | 638 g_free(escaped); |
639 | |
8272 | 640 return ret; |
641 } | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
642 #endif /* _WIN32 */ |
8272 | 643 |
7136 | 644 static void * |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
645 gaim_gtk_notify_uri(const char *uri) |
7136 | 646 { |
647 #ifndef _WIN32 | |
648 char *command = NULL; | |
8272 | 649 char *remote_command = NULL; |
7136 | 650 const char *web_browser; |
8272 | 651 int place; |
7136 | 652 |
653 web_browser = gaim_prefs_get_string("/gaim/gtk/browsers/browser"); | |
8272 | 654 place = gaim_prefs_get_int("/gaim/gtk/browsers/place"); |
7136 | 655 |
10060 | 656 /* if they are running gnome, use the gnome web browser */ |
10061 | 657 if (gaim_running_gnome() == TRUE) |
10060 | 658 { |
659 command = g_strdup_printf("gnome-open \"%s\"", uri); | |
10061 | 660 } |
10060 | 661 else if (!strcmp(web_browser, "epiphany") || |
9405 | 662 !strcmp(web_browser, "galeon")) |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
663 { |
8272 | 664 if (place == GAIM_BROWSER_NEW_WINDOW) |
9405 | 665 command = g_strdup_printf("%s -w \"%s\"", web_browser, uri); |
8272 | 666 else if (place == GAIM_BROWSER_NEW_TAB) |
9405 | 667 command = g_strdup_printf("%s -n \"%s\"", web_browser, uri); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
668 else |
9405 | 669 command = g_strdup_printf("%s \"%s\"", web_browser, uri); |
670 } | |
671 else if (!strcmp(web_browser, "gnome-open")) | |
672 { | |
673 command = g_strdup_printf("gnome-open \"%s\"", uri); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
674 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
675 else if (!strcmp(web_browser, "kfmclient")) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
676 { |
7136 | 677 command = g_strdup_printf("kfmclient openURL \"%s\"", uri); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
678 /* |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
679 * Does Konqueror have options to open in new tab |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
680 * and/or current window? |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
681 */ |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
682 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
683 else if (!strcmp(web_browser, "mozilla") || |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
684 !strcmp(web_browser, "mozilla-firebird") || |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
685 !strcmp(web_browser, "firefox")) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
686 { |
9399 | 687 char *args = ""; |
688 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
689 command = g_strdup_printf("%s \"%s\"", web_browser, uri); |
8272 | 690 |
9399 | 691 /* |
692 * Firefox 0.9 and higher require a "-a firefox" option when | |
693 * using -remote commands. This breaks older versions of | |
694 * mozilla. So we include this other handly little string | |
695 * when calling firefox. If the API for remote calls changes | |
696 * any more in firefox then firefox should probably be split | |
697 * apart from mozilla-firebird and mozilla... but this is good | |
698 * for now. | |
699 */ | |
700 if (!strcmp(web_browser, "firefox")) | |
701 args = "-a firefox"; | |
702 | |
8272 | 703 if (place == GAIM_BROWSER_NEW_WINDOW) |
9399 | 704 remote_command = g_strdup_printf("%s %s -remote " |
9777 | 705 "\"openURL(%s,new-window)\"", |
9399 | 706 web_browser, args, uri); |
8272 | 707 else if (place == GAIM_BROWSER_NEW_TAB) |
9399 | 708 remote_command = g_strdup_printf("%s %s -remote " |
9777 | 709 "\"openURL(%s,new-tab)\"", |
9399 | 710 web_browser, args, uri); |
8272 | 711 else if (place == GAIM_BROWSER_CURRENT) |
9399 | 712 remote_command = g_strdup_printf("%s %s -remote " |
9777 | 713 "\"openURL(%s)\"", |
9399 | 714 web_browser, args, uri); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
715 } |
9405 | 716 else if (!strcmp(web_browser, "netscape")) |
717 { | |
718 command = g_strdup_printf("netscape \"%s\"", uri); | |
719 | |
720 if (place == GAIM_BROWSER_NEW_WINDOW) | |
721 { | |
722 remote_command = g_strdup_printf("netscape -remote " | |
9777 | 723 "\"openURL(%s,new-window)\"", |
9405 | 724 uri); |
725 } | |
726 else if (place == GAIM_BROWSER_CURRENT) | |
727 { | |
728 remote_command = g_strdup_printf("netscape -remote " | |
9777 | 729 "\"openURL(%s)\"", uri); |
9405 | 730 } |
731 } | |
732 else if (!strcmp(web_browser, "opera")) | |
733 { | |
734 if (place == GAIM_BROWSER_NEW_WINDOW) | |
735 command = g_strdup_printf("opera -newwindow \"%s\"", uri); | |
736 else if (place == GAIM_BROWSER_NEW_TAB) | |
737 command = g_strdup_printf("opera -newpage \"%s\"", uri); | |
738 else if (place == GAIM_BROWSER_CURRENT) | |
739 { | |
740 remote_command = g_strdup_printf("opera -remote " | |
9777 | 741 "\"openURL(%s)\"", uri); |
9405 | 742 command = g_strdup_printf("opera \"%s\"", uri); |
743 } | |
744 else | |
745 command = g_strdup_printf("opera \"%s\"", uri); | |
746 | |
747 } | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
748 else if (!strcmp(web_browser, "custom")) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
749 { |
7136 | 750 const char *web_command; |
751 | |
752 web_command = gaim_prefs_get_string("/gaim/gtk/browsers/command"); | |
753 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
754 if (web_command == NULL || *web_command == '\0') |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
755 { |
7136 | 756 gaim_notify_error(NULL, NULL, _("Unable to open URL"), |
757 _("The 'Manual' browser command has been " | |
758 "chosen, but no command has been set.")); | |
759 return NULL; | |
760 } | |
761 | |
762 if (strstr(web_command, "%s")) | |
763 command = gaim_strreplace(web_command, "%s", uri); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
764 else |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
765 { |
7136 | 766 /* |
767 * There is no "%s" in the browser command. Assume the user | |
768 * wanted the URL tacked on to the end of the command. | |
769 */ | |
770 command = g_strdup_printf("%s %s", web_command, uri); | |
771 } | |
772 } | |
773 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
774 if (remote_command != NULL) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
775 { |
8272 | 776 /* try the remote command first */ |
777 if (uri_command(remote_command, TRUE) != 0) | |
778 uri_command(command, FALSE); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
779 |
8272 | 780 g_free(remote_command); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
781 |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
782 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
783 else |
8272 | 784 uri_command(command, FALSE); |
7136 | 785 |
786 g_free(command); | |
787 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
788 #else /* !_WIN32 */ |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
789 wgaim_notify_uri(uri); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
790 #endif /* !_WIN32 */ |
7136 | 791 |
792 return NULL; | |
793 } | |
794 | |
5437 | 795 static GaimNotifyUiOps ops = |
796 { | |
797 gaim_gtk_notify_message, | |
798 gaim_gtk_notify_email, | |
799 gaim_gtk_notify_emails, | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
800 gaim_gtk_notify_formatted, |
10439 | 801 gaim_gtk_notify_searchresults, |
9797 | 802 gaim_gtk_notify_userinfo, |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
803 gaim_gtk_notify_uri, |
5437 | 804 gaim_gtk_close_notify |
805 }; | |
806 | |
807 GaimNotifyUiOps * | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7007
diff
changeset
|
808 gaim_gtk_notify_get_ui_ops(void) |
5437 | 809 { |
810 return &ops; | |
811 } |