Mercurial > pidgin
annotate src/gtknotify.c @ 9777:8d891252f2ac
[gaim-migrate @ 10645]
URLs containing ' will open correctly. There was some over-zealous
double-quotation mark usage in gtknotify.c. That may have been my fault.
Also escape the URLs in debug and gaim_notify messages.
Also refactored gaim_escape_html() a tad bit. There is nothing wrong
with exiting out of a function early. In the abnormal case that
html==NULL, we just exit the function. It makes the meat of the function
nested one fewer level.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Thu, 19 Aug 2004 01:45:30 +0000 |
| parents | c9ac1976ef01 |
| children | 4a15962c344a |
| 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 */ | |
|
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6357
diff
changeset
|
25 #include "gtkinternal.h" |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
26 |
| 7455 | 27 #include <gdk/gdkkeysyms.h> |
| 28 | |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
29 #include "connection.h" |
| 8284 | 30 #include "debug.h" |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
31 #include "prefs.h" |
| 5437 | 32 #include "stock.h" |
|
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
33 #include "util.h" |
| 5437 | 34 |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
35 #include "gtkimhtml.h" |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
36 #include "gtknotify.h" |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
37 #include "gtkutils.h" |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
38 |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
39 typedef struct |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
40 { |
|
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5543
diff
changeset
|
41 GaimConnection *gc; |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
42 char *url; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
43 GtkWidget *dialog; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
44 GtkWidget *label; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
45 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
46 } GaimNotifyMailData; |
|
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 static void *gaim_gtk_notify_emails(size_t count, gboolean detailed, |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
49 const char **subjects, |
|
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
50 const char **froms, const char **tos, |
|
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
51 const char **urls, GCallback cb, |
|
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
52 void *user_data); |
|
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
53 |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
54 static void |
|
6354
76af8c066f8c
[gaim-migrate @ 6853]
Christian Hammond <chipx86@chipx86.com>
parents:
6106
diff
changeset
|
55 message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) |
| 6104 | 56 { |
| 6357 | 57 gaim_notify_close(GAIM_NOTIFY_MESSAGE, widget); |
| 6104 | 58 } |
| 59 | |
| 60 static void | |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
61 email_response_cb(GtkDialog *dialog, gint id, GaimNotifyMailData *data) |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
62 { |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
63 if (id == 0) |
|
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
64 gaim_notify_uri(NULL, data->url); |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
65 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
66 gaim_notify_close(GAIM_NOTIFY_EMAILS, data); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
67 } |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
68 |
|
7007
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
69 static void |
|
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
70 formatted_close_cb(GtkWidget *win, GdkEvent *event, void *user_data) |
|
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
71 { |
|
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
72 gaim_notify_close(GAIM_NOTIFY_FORMATTED, win); |
|
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
73 } |
|
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
74 |
| 5437 | 75 static void * |
| 76 gaim_gtk_notify_message(GaimNotifyMsgType type, const char *title, | |
| 77 const char *primary, const char *secondary, | |
| 78 GCallback cb, void *user_data) | |
| 79 { | |
| 80 GtkWidget *dialog; | |
| 81 GtkWidget *hbox; | |
| 82 GtkWidget *label; | |
| 83 GtkWidget *img = NULL; | |
| 84 char label_text[2048]; | |
| 85 const char *icon_name = NULL; | |
| 86 | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
87 switch (type) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
88 { |
| 5437 | 89 case GAIM_NOTIFY_MSG_ERROR: |
| 90 icon_name = GAIM_STOCK_DIALOG_ERROR; | |
| 91 break; | |
| 92 | |
| 93 case GAIM_NOTIFY_MSG_WARNING: | |
| 94 icon_name = GAIM_STOCK_DIALOG_WARNING; | |
| 95 break; | |
| 96 | |
| 97 case GAIM_NOTIFY_MSG_INFO: | |
| 98 icon_name = GAIM_STOCK_DIALOG_INFO; | |
| 99 break; | |
| 100 | |
| 101 default: | |
| 102 icon_name = NULL; | |
| 103 break; | |
| 104 } | |
| 105 | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
106 if (icon_name != NULL) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
107 { |
| 5437 | 108 img = gtk_image_new_from_stock(icon_name, GTK_ICON_SIZE_DIALOG); |
| 109 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
| 110 } | |
| 111 | |
| 7678 | 112 dialog = gtk_dialog_new_with_buttons(title ? title : GAIM_ALERT_TITLE, |
|
9444
a88c8ca91518
[gaim-migrate @ 10265]
Christian Hammond <chipx86@chipx86.com>
parents:
9405
diff
changeset
|
113 NULL, 0, GTK_STOCK_CLOSE, |
| 7678 | 114 GTK_RESPONSE_ACCEPT, NULL); |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
115 |
|
8523
013d256e8ded
[gaim-migrate @ 9262]
Christian Hammond <chipx86@chipx86.com>
parents:
8356
diff
changeset
|
116 gtk_window_set_role(GTK_WINDOW(dialog), "notify_dialog"); |
|
013d256e8ded
[gaim-migrate @ 9262]
Christian Hammond <chipx86@chipx86.com>
parents:
8356
diff
changeset
|
117 |
| 5437 | 118 g_signal_connect(G_OBJECT(dialog), "response", |
| 6104 | 119 G_CALLBACK(message_response_cb), dialog); |
| 5437 | 120 |
| 121 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6); | |
| 122 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); | |
| 123 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
| 124 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12); | |
| 125 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6); | |
| 126 | |
| 127 hbox = gtk_hbox_new(FALSE, 12); | |
| 128 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); | |
| 129 | |
| 130 if (img != NULL) | |
| 131 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
| 132 | |
| 133 g_snprintf(label_text, sizeof(label_text), | |
| 134 "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", | |
| 135 primary, (secondary ? secondary : "")); | |
| 136 | |
| 137 label = gtk_label_new(NULL); | |
| 138 | |
| 139 gtk_label_set_markup(GTK_LABEL(label), label_text); | |
| 140 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
| 141 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
| 142 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 143 | |
| 144 gtk_widget_show_all(dialog); | |
| 145 | |
| 146 return dialog; | |
| 147 } | |
| 148 | |
| 149 static void * | |
| 150 gaim_gtk_notify_email(const char *subject, const char *from, | |
| 151 const char *to, const char *url, | |
| 152 GCallback cb, void *user_data) | |
| 153 { | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
154 return gaim_gtk_notify_emails(1, TRUE, |
|
5524
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
155 (subject == NULL ? NULL : &subject), |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
156 (from == NULL ? NULL : &from), |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
157 (to == NULL ? NULL : &to), |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
158 (url == NULL ? NULL : &url), |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
159 cb, user_data); |
| 5437 | 160 } |
| 161 | |
| 162 static void * | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
163 gaim_gtk_notify_emails(size_t count, gboolean detailed, |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
164 const char **subjects, const char **froms, |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
165 const char **tos, const char **urls, |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
166 GCallback cb, void *user_data) |
| 5437 | 167 { |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
168 GaimNotifyMailData *data; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
169 GtkWidget *dialog; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
170 GtkWidget *vbox; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
171 GtkWidget *hbox; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
172 GtkWidget *label; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
173 GtkWidget *img; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
174 char *detail_text; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
175 char *label_text; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
176 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
177 data = g_new0(GaimNotifyMailData, 1); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
178 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
179 data->url = g_strdup(urls[0]); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
180 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
181 /* Create the dialog. */ |
|
5524
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
182 data->dialog = dialog = gtk_dialog_new(); |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
183 |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
184 gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, 1); |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
185 |
|
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
186 if (urls != NULL) |
|
5536
8bf28c2d100e
[gaim-migrate @ 5936]
Christian Hammond <chipx86@chipx86.com>
parents:
5524
diff
changeset
|
187 gtk_dialog_add_button(GTK_DIALOG(dialog), GAIM_STOCK_OPEN_MAIL, 0); |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
188 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
189 g_signal_connect(G_OBJECT(dialog), "response", |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
190 G_CALLBACK(email_response_cb), data); |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
191 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
192 /* Setup the dialog */ |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
193 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
194 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
|
195 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
196 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
197 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
198 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
199 /* Setup the main horizontal box */ |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
200 hbox = gtk_hbox_new(FALSE, 12); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
201 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
202 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
203 /* Dialog icon. */ |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
204 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_INFO, |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
205 GTK_ICON_SIZE_DIALOG); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
206 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
207 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
208 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
209 /* Vertical box */ |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
210 vbox = gtk_vbox_new(FALSE, 12); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
211 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
212 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
213 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
214 /* Descriptive label */ |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
215 detail_text = g_strdup_printf(ngettext("%s has %d new message.", |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
216 "%s has %d new messages.", |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
217 (int)count), |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
218 *tos, (int)count); |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
219 |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
220 if (count == 1) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
221 { |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
222 char *from_text = NULL, *subject_text = NULL; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
223 |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
224 if (froms != NULL) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
225 { |
| 8920 | 226 char *from_enc; |
| 227 from_enc = g_markup_escape_text(*froms, -1); | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
228 from_text = g_strdup_printf( |
| 8920 | 229 _("<span weight=\"bold\">From:</span> %s\n"), from_enc); |
| 230 g_free(from_enc); | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
231 } |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
232 |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
233 if (subjects != NULL) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
234 { |
| 8920 | 235 char *subject_enc; |
| 236 subject_enc = g_markup_escape_text(*subjects, -1); | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
237 subject_text = g_strdup_printf( |
| 8920 | 238 _("<span weight=\"bold\">Subject:</span> %s\n"), subject_enc); |
| 239 g_free(subject_enc); | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
240 } |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
241 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
242 label_text = g_strdup_printf( |
| 5543 | 243 _("<span weight=\"bold\" size=\"larger\">You have mail!</span>" |
| 244 "\n\n%s%s%s%s"), | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
245 detail_text, |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
246 (from_text == NULL && subject_text == NULL ? "" : "\n\n"), |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
247 (from_text == NULL ? "" : from_text), |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
248 (subject_text == NULL ? "" : subject_text)); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
249 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
250 if (from_text != NULL) |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
251 g_free(from_text); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
252 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
253 if (subject_text != NULL) |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
254 g_free(subject_text); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
255 } |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
256 else |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
257 { |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
258 label_text = g_strdup_printf( |
| 5543 | 259 _("<span weight=\"bold\" size=\"larger\">You have mail!</span>" |
| 260 "\n\n%s"), detail_text); | |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
261 } |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
262 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
263 g_free(detail_text); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
264 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
265 label = gtk_label_new(NULL); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
266 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
267 gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
268 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
269 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
270 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
271 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
272 g_free(label_text); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
273 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
274 /* Show everything. */ |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
275 gtk_widget_show_all(dialog); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
276 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
277 return data; |
| 5437 | 278 } |
| 279 | |
|
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
280 static gboolean |
|
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
281 formatted_input_cb(GtkWidget *dialog, GdkEventKey *event, gpointer data) |
| 7455 | 282 { |
|
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
283 if (event->keyval == GDK_Escape) |
|
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
284 { |
|
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
285 gtk_widget_destroy(dialog); |
|
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
286 |
| 7455 | 287 return TRUE; |
| 288 } | |
|
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
289 |
| 7455 | 290 return FALSE; |
| 291 } | |
| 292 | |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
293 static void * |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
294 gaim_gtk_notify_formatted(const char *title, const char *primary, |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
295 const char *secondary, const char *text, |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
296 GCallback cb, void *user_data) |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
297 { |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
298 GtkWidget *window; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
299 GtkWidget *vbox; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
300 GtkWidget *label; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
301 GtkWidget *button; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
302 GtkWidget *imhtml; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
303 GtkWidget *sw; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
304 int options = 0; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
305 char label_text[2048]; |
| 8272 | 306 char *linked_text; |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
307 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
308 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
| 8345 | 309 gtk_window_set_title(GTK_WINDOW(window), title); |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
310 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
|
311 gtk_container_set_border_width(GTK_CONTAINER(window), 12); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
312 |
|
7007
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
313 g_signal_connect(G_OBJECT(window), "delete_event", |
|
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
314 G_CALLBACK(formatted_close_cb), NULL); |
|
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
315 |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
316 /* Setup the main vbox */ |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
317 vbox = gtk_vbox_new(FALSE, 12); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
318 gtk_container_add(GTK_CONTAINER(window), vbox); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
319 gtk_widget_show(vbox); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
320 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
321 /* Setup the descriptive label */ |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
322 g_snprintf(label_text, sizeof(label_text), |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
323 "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
324 primary, |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
325 (secondary ? "\n" : ""), |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
326 (secondary ? secondary : "")); |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
327 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
328 label = gtk_label_new(NULL); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
329 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
330 gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
331 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
332 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
333 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
334 gtk_widget_show(label); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
335 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
336 /* Setup the scrolled window that we're putting the gtkimhtml in. */ |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
337 sw = gtk_scrolled_window_new(NULL, NULL); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
338 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
339 GTK_POLICY_NEVER, |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
340 GTK_POLICY_ALWAYS); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
341 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
342 GTK_SHADOW_IN); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
343 gtk_widget_set_size_request(sw, 300, 250); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
344 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
345 gtk_widget_show(sw); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
346 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
347 /* Now build that gtkimhtml */ |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
348 imhtml = gtk_imhtml_new(NULL, NULL); |
| 9005 | 349 gtk_widget_set_name(imhtml, "gaim_gtknotify_imhtml"); |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
350 gtk_container_add(GTK_CONTAINER(sw), imhtml); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
351 gtk_widget_show(imhtml); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
352 gaim_setup_imhtml(imhtml); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
353 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
354 /* Add the Close button. */ |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
355 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
356 gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
357 gtk_widget_show(button); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
358 |
| 6872 | 359 g_signal_connect_swapped(G_OBJECT(button), "clicked", |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
360 G_CALLBACK(formatted_close_cb), window); |
| 7455 | 361 g_signal_connect(G_OBJECT(window), "key_press_event", |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
362 G_CALLBACK(formatted_input_cb), NULL); |
| 7455 | 363 |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
364 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
365 /* Add the text to the gtkimhtml */ |
| 9049 | 366 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
| 367 options ^= GTK_IMHTML_NO_COLOURS; | |
| 368 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) | |
| 369 options ^= GTK_IMHTML_NO_FONTS; | |
| 370 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) | |
| 371 options ^= GTK_IMHTML_NO_SIZES; | |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
372 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
373 options ^= GTK_IMHTML_NO_COMMENTS; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
374 options ^= GTK_IMHTML_NO_TITLE; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
375 options ^= GTK_IMHTML_NO_NEWLINE; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
376 options ^= GTK_IMHTML_NO_SCROLL; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
377 |
| 8882 | 378 /* Make sure URLs are clickable */ |
| 379 linked_text = gaim_markup_linkify(text); | |
| 8962 | 380 gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text, |
| 381 options); | |
| 8882 | 382 g_free(linked_text); |
| 7078 | 383 |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
384 /* Show the window */ |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
385 gtk_widget_show(window); |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
386 |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
387 return window; |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
388 } |
|
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
389 |
| 5437 | 390 static void |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
391 gaim_gtk_close_notify(GaimNotifyType type, void *ui_handle) |
| 5437 | 392 { |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
393 if (type == GAIM_NOTIFY_EMAIL || type == GAIM_NOTIFY_EMAILS) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
394 { |
|
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
395 GaimNotifyMailData *data = (GaimNotifyMailData *)ui_handle; |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
396 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
397 gtk_widget_destroy(data->dialog); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
398 |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
399 g_free(data->url); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
400 g_free(data); |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
401 } |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
402 else |
|
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
403 gtk_widget_destroy(GTK_WIDGET(ui_handle)); |
| 5437 | 404 } |
| 405 | |
| 8272 | 406 #ifndef _WIN32 |
| 407 static gint | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
408 uri_command(const char *command, gboolean sync) |
| 8272 | 409 { |
| 9777 | 410 gchar *escaped, *tmp; |
| 8272 | 411 GError *error = NULL; |
| 412 gint ret = 0; | |
| 413 | |
| 9777 | 414 escaped = gaim_escape_html(command); |
| 415 gaim_debug_misc("gtknotify", "Executing %s\n", escaped); | |
| 8278 | 416 |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
417 if (!gaim_program_is_valid(command)) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
418 { |
| 9777 | 419 tmp = g_strdup_printf(_("The browser command <b>%s</b> is invalid."), |
| 420 escaped ? escaped : "(none)"); | |
| 8272 | 421 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
| 422 g_free(tmp); | |
| 423 | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
424 } |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
425 else if (sync) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
426 { |
| 8272 | 427 gint status; |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
428 |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
429 if (!g_spawn_command_line_sync(command, NULL, NULL, &status, &error)) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
430 { |
| 9777 | 431 tmp = g_strdup_printf(_("Error launching <b>%s</b>: %s"), |
| 432 escaped, error->message); | |
| 8272 | 433 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
| 434 g_free(tmp); | |
| 435 g_error_free(error); | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
436 } |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
437 else |
| 8272 | 438 ret = status; |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
439 } |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
440 else |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
441 { |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
442 if (!g_spawn_command_line_async(command, &error)) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
443 { |
| 9777 | 444 tmp = g_strdup_printf(_("Error launching <b>%s</b>: %s"), |
| 445 escaped, error->message); | |
| 8272 | 446 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
| 447 g_free(tmp); | |
| 448 g_error_free(error); | |
| 449 } | |
| 450 } | |
| 451 | |
| 9777 | 452 g_free(escaped); |
| 453 | |
| 8272 | 454 return ret; |
| 455 } | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
456 #endif /* _WIN32 */ |
| 8272 | 457 |
| 7136 | 458 static void * |
| 459 gaim_gtk_notify_uri(const char *uri) | |
| 460 { | |
| 461 #ifndef _WIN32 | |
| 462 char *command = NULL; | |
| 8272 | 463 char *remote_command = NULL; |
| 7136 | 464 const char *web_browser; |
| 8272 | 465 int place; |
| 7136 | 466 |
| 467 web_browser = gaim_prefs_get_string("/gaim/gtk/browsers/browser"); | |
| 8272 | 468 place = gaim_prefs_get_int("/gaim/gtk/browsers/place"); |
| 7136 | 469 |
| 9405 | 470 if (!strcmp(web_browser, "epiphany") || |
| 471 !strcmp(web_browser, "galeon")) | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
472 { |
| 8272 | 473 if (place == GAIM_BROWSER_NEW_WINDOW) |
| 9405 | 474 command = g_strdup_printf("%s -w \"%s\"", web_browser, uri); |
| 8272 | 475 else if (place == GAIM_BROWSER_NEW_TAB) |
| 9405 | 476 command = g_strdup_printf("%s -n \"%s\"", web_browser, uri); |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
477 else |
| 9405 | 478 command = g_strdup_printf("%s \"%s\"", web_browser, uri); |
| 479 } | |
| 480 else if (!strcmp(web_browser, "gnome-open")) | |
| 481 { | |
| 482 command = g_strdup_printf("gnome-open \"%s\"", uri); | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
483 } |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
484 else if (!strcmp(web_browser, "kfmclient")) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
485 { |
| 7136 | 486 command = g_strdup_printf("kfmclient openURL \"%s\"", uri); |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
487 /* |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
488 * Does Konqueror have options to open in new tab |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
489 * and/or current window? |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
490 */ |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
491 } |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
492 else if (!strcmp(web_browser, "mozilla") || |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
493 !strcmp(web_browser, "mozilla-firebird") || |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
494 !strcmp(web_browser, "firefox")) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
495 { |
| 9399 | 496 char *args = ""; |
| 497 | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
498 command = g_strdup_printf("%s \"%s\"", web_browser, uri); |
| 8272 | 499 |
| 9399 | 500 /* |
| 501 * Firefox 0.9 and higher require a "-a firefox" option when | |
| 502 * using -remote commands. This breaks older versions of | |
| 503 * mozilla. So we include this other handly little string | |
| 504 * when calling firefox. If the API for remote calls changes | |
| 505 * any more in firefox then firefox should probably be split | |
| 506 * apart from mozilla-firebird and mozilla... but this is good | |
| 507 * for now. | |
| 508 */ | |
| 509 if (!strcmp(web_browser, "firefox")) | |
| 510 args = "-a firefox"; | |
| 511 | |
| 8272 | 512 if (place == GAIM_BROWSER_NEW_WINDOW) |
| 9399 | 513 remote_command = g_strdup_printf("%s %s -remote " |
| 9777 | 514 "\"openURL(%s,new-window)\"", |
| 9399 | 515 web_browser, args, uri); |
| 8272 | 516 else if (place == GAIM_BROWSER_NEW_TAB) |
| 9399 | 517 remote_command = g_strdup_printf("%s %s -remote " |
| 9777 | 518 "\"openURL(%s,new-tab)\"", |
| 9399 | 519 web_browser, args, uri); |
| 8272 | 520 else if (place == GAIM_BROWSER_CURRENT) |
| 9399 | 521 remote_command = g_strdup_printf("%s %s -remote " |
| 9777 | 522 "\"openURL(%s)\"", |
| 9399 | 523 web_browser, args, uri); |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
524 } |
| 9405 | 525 else if (!strcmp(web_browser, "netscape")) |
| 526 { | |
| 527 command = g_strdup_printf("netscape \"%s\"", uri); | |
| 528 | |
| 529 if (place == GAIM_BROWSER_NEW_WINDOW) | |
| 530 { | |
| 531 remote_command = g_strdup_printf("netscape -remote " | |
| 9777 | 532 "\"openURL(%s,new-window)\"", |
| 9405 | 533 uri); |
| 534 } | |
| 535 else if (place == GAIM_BROWSER_CURRENT) | |
| 536 { | |
| 537 remote_command = g_strdup_printf("netscape -remote " | |
| 9777 | 538 "\"openURL(%s)\"", uri); |
| 9405 | 539 } |
| 540 } | |
| 541 else if (!strcmp(web_browser, "opera")) | |
| 542 { | |
| 543 if (place == GAIM_BROWSER_NEW_WINDOW) | |
| 544 command = g_strdup_printf("opera -newwindow \"%s\"", uri); | |
| 545 else if (place == GAIM_BROWSER_NEW_TAB) | |
| 546 command = g_strdup_printf("opera -newpage \"%s\"", uri); | |
| 547 else if (place == GAIM_BROWSER_CURRENT) | |
| 548 { | |
| 549 remote_command = g_strdup_printf("opera -remote " | |
| 9777 | 550 "\"openURL(%s)\"", uri); |
| 9405 | 551 command = g_strdup_printf("opera \"%s\"", uri); |
| 552 } | |
| 553 else | |
| 554 command = g_strdup_printf("opera \"%s\"", uri); | |
| 555 | |
| 556 } | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
557 else if (!strcmp(web_browser, "custom")) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
558 { |
| 7136 | 559 const char *web_command; |
| 560 | |
| 561 web_command = gaim_prefs_get_string("/gaim/gtk/browsers/command"); | |
| 562 | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
563 if (web_command == NULL || *web_command == '\0') |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
564 { |
| 7136 | 565 gaim_notify_error(NULL, NULL, _("Unable to open URL"), |
| 566 _("The 'Manual' browser command has been " | |
| 567 "chosen, but no command has been set.")); | |
| 568 return NULL; | |
| 569 } | |
| 570 | |
| 571 if (strstr(web_command, "%s")) | |
| 572 command = gaim_strreplace(web_command, "%s", uri); | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
573 else |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
574 { |
| 7136 | 575 /* |
| 576 * There is no "%s" in the browser command. Assume the user | |
| 577 * wanted the URL tacked on to the end of the command. | |
| 578 */ | |
| 579 command = g_strdup_printf("%s %s", web_command, uri); | |
| 580 } | |
| 581 } | |
| 582 | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
583 if (remote_command != NULL) |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
584 { |
| 8272 | 585 /* try the remote command first */ |
| 586 if (uri_command(remote_command, TRUE) != 0) | |
| 587 uri_command(command, FALSE); | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
588 |
| 8272 | 589 g_free(remote_command); |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
590 |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
591 } |
|
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
592 else |
| 8272 | 593 uri_command(command, FALSE); |
| 7136 | 594 |
| 595 g_free(command); | |
| 596 | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
597 #else /* !_WIN32 */ |
| 9520 | 598 /** |
| 599 * Since this could be potentially dangerous, | |
| 600 * allowing a URI to try to perform some sort of malicious operation, | |
| 601 * we only allow execution when the URI starts with | |
| 602 * "http://", "https://", "ftp://", "mailto:" | |
| 603 */ | |
| 604 if (g_ascii_strncasecmp(uri, "http://", 7) == 0 | |
| 605 || g_ascii_strncasecmp(uri, "mailto:", 7) == 0 | |
| 606 || g_ascii_strncasecmp(uri, "https://", 8) == 0 | |
| 607 || g_ascii_strncasecmp(uri, "ftp://", 6) == 0 | |
| 608 ) { | |
| 609 ShellExecute(NULL, NULL, uri, NULL, ".\\", 0); | |
| 610 } else { | |
| 611 gaim_debug_misc("gtknotify", "Ignoring '%s' URI as it is not recognized as a secure URI.\n", uri); | |
| 612 } | |
|
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
613 #endif /* !_WIN32 */ |
| 7136 | 614 |
| 615 return NULL; | |
| 616 } | |
| 617 | |
| 5437 | 618 static GaimNotifyUiOps ops = |
| 619 { | |
| 620 gaim_gtk_notify_message, | |
| 621 gaim_gtk_notify_email, | |
| 622 gaim_gtk_notify_emails, | |
|
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
623 gaim_gtk_notify_formatted, |
|
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
624 gaim_gtk_notify_uri, |
| 5437 | 625 gaim_gtk_close_notify |
| 626 }; | |
| 627 | |
| 628 GaimNotifyUiOps * | |
|
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7007
diff
changeset
|
629 gaim_gtk_notify_get_ui_ops(void) |
| 5437 | 630 { |
| 631 return &ops; | |
| 632 } |
