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