annotate src/gtknotify.c @ 11359:9480e0d0f563

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