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