Mercurial > pidgin.yaz
annotate src/gtknotify.c @ 14092:58c9f678b77a
[gaim-migrate @ 16717]
Fix a bug reported by Jon Oberheide. If there is an extra either 1
or 3 bytes on an incoming oscar message then our ICBM parser gets
into an infinite loop. This could open be caused by a malicious
server or a man-in-the-middle.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 12 Aug 2006 10:59:13 +0000 |
parents | 6a5aaf46bd52 |
children |
rev | line source |
---|---|
5437 | 1 /** |
2 * @file gtknotify.c GTK+ Notification API | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
10 * |
5437 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9791 | 25 #include "internal.h" |
26 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
27 |
7455 | 28 #include <gdk/gdkkeysyms.h> |
29 | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
30 #include "connection.h" |
8284 | 31 #include "debug.h" |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
32 #include "prefs.h" |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10260
diff
changeset
|
33 #include "gtkstock.h" |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
34 #include "util.h" |
5437 | 35 |
10439 | 36 #include "gtkblist.h" |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
37 #include "gtkimhtml.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
38 #include "gtknotify.h" |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
39 #include "gtkutils.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
40 |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
41 typedef struct |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
42 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5543
diff
changeset
|
43 GaimConnection *gc; |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
44 char *url; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
45 GtkWidget *label; |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
46 GtkTreeIter iter; |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
47 } GaimNotifyMailData; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
48 |
10439 | 49 typedef struct |
50 { | |
51 GaimAccount *account; | |
52 GtkListStore *model; | |
53 GtkWidget *treeview; | |
54 GtkWidget *window; | |
13640 | 55 gpointer user_data; |
13976
6a5aaf46bd52
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13975
diff
changeset
|
56 GaimNotifySearchResults *results; |
13640 | 57 |
10439 | 58 } GaimNotifySearchResultsData; |
59 | |
11359 | 60 typedef struct |
10439 | 61 { |
11359 | 62 GaimNotifySearchButton *button; |
63 GaimNotifySearchResultsData *data; | |
64 | |
65 } GaimNotifySearchResultsButtonData; | |
10439 | 66 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
67 enum |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
68 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
69 GAIM_MAIL_ICON, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
70 GAIM_MAIL_TO, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
71 GAIM_MAIL_FROM, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
72 GAIM_MAIL_SUBJECT, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
73 GAIM_MAIL_DATA, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
74 COLUMNS_GAIM_MAIL |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
75 }; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
76 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
77 typedef struct _GaimMailDialog GaimMailDialog; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
78 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
79 struct _GaimMailDialog |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
80 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
81 GtkWidget *dialog; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
82 GtkWidget *treeview; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
83 GtkTreeStore *treemodel; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
84 GtkLabel *label; |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
85 GtkWidget *open_button; |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
86 }; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
87 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
88 static GaimMailDialog *mail_dialog = NULL; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
89 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
90 static void *gaim_gtk_notify_emails(GaimConnection *gc, size_t count, gboolean detailed, |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
91 const char **subjects, |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
92 const char **froms, const char **tos, |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
93 const char **urls); |
5476
9bcd8cd625ae
[gaim-migrate @ 5872]
Christian Hammond <chipx86@chipx86.com>
parents:
5437
diff
changeset
|
94 |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
95 static void |
6354
76af8c066f8c
[gaim-migrate @ 6853]
Christian Hammond <chipx86@chipx86.com>
parents:
6106
diff
changeset
|
96 message_response_cb(GtkDialog *dialog, gint id, GtkWidget *widget) |
6104 | 97 { |
6357 | 98 gaim_notify_close(GAIM_NOTIFY_MESSAGE, widget); |
6104 | 99 } |
100 | |
101 static void | |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
102 email_nondetailed_cb(GtkDialog *dialog, gint id, GaimNotifyMailData *data) |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
103 { |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
104 if (id == GTK_RESPONSE_OK) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
105 gaim_notify_uri(NULL, data->url); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
106 gaim_notify_close(GAIM_NOTIFY_EMAILS, data); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
107 gtk_widget_destroy(GTK_WIDGET(dialog)); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
108 } |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
109 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
110 static void |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
111 email_response_cb(GtkDialog *dlg, gint id, GaimMailDialog *dialog) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
112 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
113 GaimNotifyMailData *data = NULL; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
114 GtkTreeIter iter; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
115 |
10260 | 116 if (id == GTK_RESPONSE_YES) |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
117 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
118 GtkTreeSelection *selection; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
119 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
120 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
121 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
122 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
123 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
124 gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), &iter, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
125 GAIM_MAIL_DATA, &data, -1); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
126 gaim_notify_uri(NULL, data->url); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
127 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
128 gtk_tree_store_remove(dialog->treemodel, &iter); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
129 gaim_notify_close(GAIM_NOTIFY_EMAILS, data); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
130 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
131 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
132 return; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
133 } |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
134 else |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
135 return; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
136 } |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
137 else |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
138 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
139 while (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
140 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
141 gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), &iter, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
142 GAIM_MAIL_DATA, &data, -1); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
143 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
144 if (id == GTK_RESPONSE_ACCEPT) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
145 gaim_notify_uri(NULL, data->url); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
146 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
147 gtk_tree_store_remove(dialog->treemodel, &iter); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
148 gaim_notify_close(GAIM_NOTIFY_EMAILS, data); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
149 } |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
150 } |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
151 gtk_widget_destroy(dialog->dialog); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
152 g_free(dialog); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
153 mail_dialog = NULL; |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
154 } |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
155 |
7007
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
156 static void |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
157 formatted_close_cb(GtkWidget *win, GdkEvent *event, void *user_data) |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
158 { |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
159 gaim_notify_close(GAIM_NOTIFY_FORMATTED, win); |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
160 } |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
161 |
10439 | 162 static void |
13640 | 163 searchresults_close_cb(GaimNotifySearchResultsData *data, GdkEvent *event, gpointer user_data) |
10439 | 164 { |
165 gaim_notify_close(GAIM_NOTIFY_SEARCHRESULTS, data); | |
166 } | |
167 | |
168 static void | |
11359 | 169 searchresults_callback_wrapper_cb(GtkWidget *widget, GaimNotifySearchResultsButtonData *bd) |
10439 | 170 { |
11359 | 171 GaimNotifySearchResultsData *data = bd->data; |
172 | |
10439 | 173 GtkTreeSelection *selection; |
174 GtkTreeModel *model; | |
175 GtkTreeIter iter; | |
11359 | 176 GaimNotifySearchButton *button; |
177 GList *row = NULL; | |
178 gchar *str; | |
179 int i; | |
10439 | 180 |
181 g_return_if_fail(data != NULL); | |
182 | |
183 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->treeview)); | |
184 | |
185 if (gtk_tree_selection_get_selected(selection, &model, &iter)) | |
186 { | |
11359 | 187 for (i = 1; i < gtk_tree_model_get_n_columns(GTK_TREE_MODEL(model)); i++) { |
188 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, i, &str, -1); | |
189 row = g_list_append(row, str); | |
190 } | |
10439 | 191 } |
11359 | 192 |
193 button = bd->button; | |
13640 | 194 button->callback(gaim_account_get_connection(data->account), row, data->user_data); |
13975
8b7d6fce88d5
[gaim-migrate @ 16533]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13640
diff
changeset
|
195 g_list_foreach(row, (GFunc)g_free, NULL); |
8b7d6fce88d5
[gaim-migrate @ 16533]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13640
diff
changeset
|
196 g_list_free(row); |
10439 | 197 } |
198 | |
5437 | 199 static void * |
200 gaim_gtk_notify_message(GaimNotifyMsgType type, const char *title, | |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
201 const char *primary, const char *secondary) |
5437 | 202 { |
203 GtkWidget *dialog; | |
204 GtkWidget *hbox; | |
205 GtkWidget *label; | |
206 GtkWidget *img = NULL; | |
207 char label_text[2048]; | |
208 const char *icon_name = NULL; | |
10774 | 209 char *primary_esc, *secondary_esc; |
5437 | 210 |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
211 switch (type) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
212 { |
5437 | 213 case GAIM_NOTIFY_MSG_ERROR: |
214 icon_name = GAIM_STOCK_DIALOG_ERROR; | |
215 break; | |
216 | |
217 case GAIM_NOTIFY_MSG_WARNING: | |
218 icon_name = GAIM_STOCK_DIALOG_WARNING; | |
219 break; | |
220 | |
221 case GAIM_NOTIFY_MSG_INFO: | |
222 icon_name = GAIM_STOCK_DIALOG_INFO; | |
223 break; | |
224 | |
225 default: | |
226 icon_name = NULL; | |
227 break; | |
228 } | |
229 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
230 if (icon_name != NULL) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
231 { |
5437 | 232 img = gtk_image_new_from_stock(icon_name, GTK_ICON_SIZE_DIALOG); |
233 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
234 } | |
235 | |
7678 | 236 dialog = gtk_dialog_new_with_buttons(title ? title : GAIM_ALERT_TITLE, |
10260 | 237 NULL, 0, GTK_STOCK_CLOSE, |
238 GTK_RESPONSE_CLOSE, NULL); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
239 |
8523
013d256e8ded
[gaim-migrate @ 9262]
Christian Hammond <chipx86@chipx86.com>
parents:
8356
diff
changeset
|
240 gtk_window_set_role(GTK_WINDOW(dialog), "notify_dialog"); |
013d256e8ded
[gaim-migrate @ 9262]
Christian Hammond <chipx86@chipx86.com>
parents:
8356
diff
changeset
|
241 |
5437 | 242 g_signal_connect(G_OBJECT(dialog), "response", |
6104 | 243 G_CALLBACK(message_response_cb), dialog); |
5437 | 244 |
11243 | 245 gtk_container_set_border_width(GTK_CONTAINER(dialog), GAIM_HIG_BORDER); |
5437 | 246 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
247 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
11243 | 248 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER); |
249 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BOX_SPACE); | |
5437 | 250 |
11243 | 251 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
5437 | 252 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
253 | |
254 if (img != NULL) | |
255 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
256 | |
10774 | 257 primary_esc = g_markup_escape_text(primary, -1); |
258 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
5437 | 259 g_snprintf(label_text, sizeof(label_text), |
260 "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", | |
10774 | 261 primary_esc, (secondary ? secondary_esc : "")); |
262 g_free(primary_esc); | |
263 g_free(secondary_esc); | |
5437 | 264 |
265 label = gtk_label_new(NULL); | |
266 | |
267 gtk_label_set_markup(GTK_LABEL(label), label_text); | |
268 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
269 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
270 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
271 | |
272 gtk_widget_show_all(dialog); | |
273 | |
274 return dialog; | |
275 } | |
276 | |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
277 static void |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
278 selection_changed_cb(GtkTreeSelection *sel, GaimMailDialog *dialog) |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
279 { |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
280 GtkTreeIter iter; |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
281 GtkTreeModel *model; |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
282 GaimNotifyMailData *data; |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
283 gboolean active = TRUE; |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
284 |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
285 if (gtk_tree_selection_get_selected(sel, &model, &iter) == FALSE) |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
286 active = FALSE; |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
287 else |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
288 { |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
289 gtk_tree_model_get(model, &iter, GAIM_MAIL_DATA, &data, -1); |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
290 if (data->url == NULL) |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
291 active = FALSE; |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
292 } |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
293 |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
294 gtk_widget_set_sensitive(dialog->open_button, active); |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
295 } |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
296 |
5437 | 297 static void * |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
298 gaim_gtk_notify_email(GaimConnection *gc, const char *subject, const char *from, |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
299 const char *to, const char *url) |
5437 | 300 { |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
301 return gaim_gtk_notify_emails(gc, 1, (subject != NULL), |
5524
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
302 (subject == NULL ? NULL : &subject), |
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
303 (from == NULL ? NULL : &from), |
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
304 (to == NULL ? NULL : &to), |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
305 (url == NULL ? NULL : &url)); |
5437 | 306 } |
307 | |
308 static void * | |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
309 gaim_gtk_notify_emails(GaimConnection *gc, size_t count, gboolean detailed, |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
310 const char **subjects, const char **froms, |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
311 const char **tos, const char **urls) |
5437 | 312 { |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
313 GaimNotifyMailData *data = NULL; |
12911
14a103c0e4d5
[gaim-migrate @ 15264]
Richard Laager <rlaager@wiktel.com>
parents:
12647
diff
changeset
|
314 GtkWidget *dialog = NULL; |
14a103c0e4d5
[gaim-migrate @ 15264]
Richard Laager <rlaager@wiktel.com>
parents:
12647
diff
changeset
|
315 GtkWidget *vbox = NULL; |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
316 GtkWidget *hbox; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
317 GtkWidget *label; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
318 GtkWidget *img; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
319 char *detail_text; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
320 char *label_text; |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
321 GtkTreeIter iter; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
322 GaimAccount *account; |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
323 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
324 account = gaim_connection_get_account(gc); |
5524
101384b068c1
[gaim-migrate @ 5924]
Christian Hammond <chipx86@chipx86.com>
parents:
5519
diff
changeset
|
325 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
326 if (mail_dialog == NULL || !detailed) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
327 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
328 GtkCellRenderer *rend; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
329 GtkTreeViewColumn *column; |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
330 GtkWidget *button = NULL; |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
331 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
332 dialog = gtk_dialog_new_with_buttons(_("New Mail"), NULL, 0, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
333 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
334 NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
335 if (detailed) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
336 gtk_window_set_role(GTK_WINDOW(dialog), "new_mail_detailed"); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
337 else |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
338 gtk_window_set_role(GTK_WINDOW(dialog), "new_mail"); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
339 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
340 if (!detailed && urls) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
341 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
342 gtk_dialog_add_button(GTK_DIALOG(dialog), |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
343 GAIM_STOCK_OPEN_MAIL, GTK_RESPONSE_OK); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
344 } |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
345 else if (detailed && mail_dialog == NULL) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
346 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
347 gtk_dialog_add_button(GTK_DIALOG(dialog), |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
348 _("Open All Messages"), GTK_RESPONSE_ACCEPT); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
349 |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
350 button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
351 GAIM_STOCK_OPEN_MAIL, GTK_RESPONSE_YES); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
352 } |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
353 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
354 /* Setup the dialog */ |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
355 gtk_container_set_border_width(GTK_CONTAINER(dialog), GAIM_HIG_BOX_SPACE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
356 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BOX_SPACE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
357 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
358 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
359 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
360 /* Setup the main horizontal box */ |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
361 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
362 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
363 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
364 /* Dialog icon */ |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
365 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_INFO, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
366 GTK_ICON_SIZE_DIALOG); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
367 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
368 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
369 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
370 /* Vertical box */ |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
371 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
372 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
373 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
374 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
375 if (mail_dialog == NULL && detailed) |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
376 { |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
377 GtkWidget *sw; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
378 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
379 /* Golden ratio it up! */ |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
380 gtk_widget_set_size_request(dialog, 475, 200); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
381 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
382 sw = gtk_scrolled_window_new(NULL, NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
383 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
384 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
385 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
386 mail_dialog = g_new0(GaimMailDialog, 1); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
387 mail_dialog->dialog = dialog; |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
388 mail_dialog->open_button = button; |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
389 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
390 mail_dialog->treemodel = gtk_tree_store_new(COLUMNS_GAIM_MAIL, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
391 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
392 mail_dialog->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(mail_dialog->treemodel)); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
393 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
394 g_signal_connect(G_OBJECT(dialog), "response", |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
395 G_CALLBACK(email_response_cb), mail_dialog); |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
396 g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(mail_dialog->treeview))), |
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
397 "changed", G_CALLBACK(selection_changed_cb), mail_dialog); |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
398 |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
399 /* Account column */ |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
400 column = gtk_tree_view_column_new(); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
401 gtk_tree_view_column_set_resizable(column, TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
402 gtk_tree_view_column_set_title(column, _("Account")); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
403 rend = gtk_cell_renderer_pixbuf_new(); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
404 gtk_tree_view_column_pack_start(column, rend, FALSE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
405 gtk_tree_view_column_set_attributes(column, rend, "pixbuf", GAIM_MAIL_ICON, NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
406 rend = gtk_cell_renderer_text_new(); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
407 gtk_tree_view_column_pack_start(column, rend, TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
408 gtk_tree_view_column_set_attributes(column, rend, "markup", GAIM_MAIL_TO, NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
409 gtk_tree_view_append_column(GTK_TREE_VIEW(mail_dialog->treeview), column); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
410 |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
411 /* From column */ |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
412 column = gtk_tree_view_column_new(); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
413 gtk_tree_view_column_set_resizable(column, TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
414 gtk_tree_view_column_set_title(column, _("From")); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
415 rend = gtk_cell_renderer_text_new(); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
416 gtk_tree_view_column_pack_start(column, rend, TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
417 gtk_tree_view_column_set_attributes(column, rend, "markup", GAIM_MAIL_FROM, NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
418 gtk_tree_view_append_column(GTK_TREE_VIEW(mail_dialog->treeview), column); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
419 |
13414
d624a097dc98
[gaim-migrate @ 15789]
Richard Laager <rlaager@wiktel.com>
parents:
13413
diff
changeset
|
420 /* Subject column */ |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
421 column = gtk_tree_view_column_new(); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
422 gtk_tree_view_column_set_resizable(column, TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
423 gtk_tree_view_column_set_title(column, _("Subject")); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
424 rend = gtk_cell_renderer_text_new(); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
425 gtk_tree_view_column_pack_start(column, rend, TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
426 gtk_tree_view_column_set_attributes(column, rend, "markup", GAIM_MAIL_SUBJECT, NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
427 gtk_tree_view_append_column(GTK_TREE_VIEW(mail_dialog->treeview), column); |
13090 | 428 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
429 gtk_container_add(GTK_CONTAINER(sw), mail_dialog->treeview); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
430 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
431 label = gtk_label_new(NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
432 gtk_label_set_markup(GTK_LABEL(label), _("<span weight=\"bold\" size=\"larger\">You have mail!</span>")); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
433 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
434 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
435 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
436 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
437 } |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
438 } |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
439 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
440 if (detailed) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
441 { |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
442 dialog = mail_dialog->dialog; |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
443 while (count--) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
444 { |
13413
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
445 char *to_text = NULL; |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
446 char *from_text = NULL; |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
447 char *subject_text = NULL; |
13090 | 448 GdkPixbuf *pixbuf; |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
449 |
13413
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
450 if (tos != NULL) |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
451 to_text = g_markup_escape_text(*tos, -1); |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
452 if (froms != NULL) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
453 from_text = g_markup_escape_text(*froms, -1); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
454 if (subjects != NULL) |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
455 subject_text = g_markup_escape_text(*subjects, -1); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
456 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
457 data = g_new0(GaimNotifyMailData, 1); |
13413
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
458 if (urls != NULL) |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
459 data->url = g_strdup(*urls); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
460 |
13090 | 461 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5); |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
462 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
463 gtk_tree_store_append(mail_dialog->treemodel, &iter, NULL); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
464 gtk_tree_store_set(mail_dialog->treemodel, &iter, |
13090 | 465 GAIM_MAIL_ICON, pixbuf, |
13413
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
466 GAIM_MAIL_TO, to_text, |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
467 GAIM_MAIL_FROM, from_text, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
468 GAIM_MAIL_SUBJECT, subject_text, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
469 GAIM_MAIL_DATA, data, |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
470 -1); |
13090 | 471 if (pixbuf != NULL) |
472 g_object_unref(pixbuf); | |
13413
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
473 g_free(to_text); |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
474 g_free(from_text); |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
475 g_free(subject_text); |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
476 data->iter = iter; |
13413
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
477 |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
478 if (urls != NULL) |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
479 urls++; |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
480 if (froms != NULL) |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
481 froms++; |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
482 if (subjects != NULL) |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
483 subjects++; |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
484 if (tos != NULL) |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
485 tos++; |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
486 } |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
487 } |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
488 else |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
489 { |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
490 data = g_new0(GaimNotifyMailData, 1); |
13413
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
491 |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
492 if (urls != NULL) |
79682d6f032e
[gaim-migrate @ 15788]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
493 data->url = g_strdup(*urls); |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
494 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
495 g_signal_connect(G_OBJECT(dialog), "response", |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
496 G_CALLBACK(email_nondetailed_cb), data); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
497 |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
498 detail_text = g_strdup_printf(ngettext("%s has %d new message.", |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
499 "%s has %d new messages.", |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
500 (int)count), |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
501 *tos, (int)count); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
502 label_text = g_strdup_printf( |
5543 | 503 _("<span weight=\"bold\" size=\"larger\">You have mail!</span>" |
504 "\n\n%s"), detail_text); | |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
505 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
506 label = gtk_label_new(NULL); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
507 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
508 gtk_label_set_markup(GTK_LABEL(label), label_text); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
509 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
510 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
511 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
512 |
12647
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
513 g_free(label_text); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
514 g_free(detail_text); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
515 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
852df2d9d4f8
[gaim-migrate @ 14985]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
516 } |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
517 gtk_widget_show_all(dialog); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
518 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
519 return data; |
5437 | 520 } |
521 | |
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
522 static gboolean |
10875
a118e50116df
[gaim-migrate @ 12566]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10774
diff
changeset
|
523 formatted_input_cb(GtkWidget *win, GdkEventKey *event, gpointer data) |
7455 | 524 { |
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
525 if (event->keyval == GDK_Escape) |
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
526 { |
10875
a118e50116df
[gaim-migrate @ 12566]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10774
diff
changeset
|
527 gaim_notify_close(GAIM_NOTIFY_FORMATTED, win); |
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
528 |
7455 | 529 return TRUE; |
530 } | |
8337
65ae6930b45a
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
531 |
7455 | 532 return FALSE; |
533 } | |
534 | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
535 static void * |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
536 gaim_gtk_notify_formatted(const char *title, const char *primary, |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
537 const char *secondary, const char *text) |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
538 { |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
539 GtkWidget *window; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
540 GtkWidget *vbox; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
541 GtkWidget *label; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
542 GtkWidget *button; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
543 GtkWidget *imhtml; |
10181 | 544 GtkWidget *frame; |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
545 int options = 0; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
546 char label_text[2048]; |
10774 | 547 char *linked_text, *primary_esc, *secondary_esc; |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
548 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
549 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
8345 | 550 gtk_window_set_title(GTK_WINDOW(window), title); |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
551 gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); |
11243 | 552 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
|
553 |
7007
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
554 g_signal_connect(G_OBJECT(window), "delete_event", |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
555 G_CALLBACK(formatted_close_cb), NULL); |
da1430478acf
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
556 |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
557 /* Setup the main vbox */ |
11243 | 558 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
559 gtk_container_add(GTK_CONTAINER(window), vbox); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
560 gtk_widget_show(vbox); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
561 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
562 /* Setup the descriptive label */ |
10774 | 563 primary_esc = g_markup_escape_text(primary, -1); |
564 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
|
565 g_snprintf(label_text, sizeof(label_text), |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
566 "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
10774 | 567 primary_esc, |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
568 (secondary ? "\n" : ""), |
10774 | 569 (secondary ? secondary_esc : "")); |
570 g_free(primary_esc); | |
571 g_free(secondary_esc); | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
572 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
573 label = gtk_label_new(NULL); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
574 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
575 gtk_label_set_markup(GTK_LABEL(label), label_text); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
576 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
577 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
578 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
579 gtk_widget_show(label); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
580 |
10181 | 581 /* Add the imhtml */ |
13280
3de53fe8345f
[gaim-migrate @ 15646]
Richard Laager <rlaager@wiktel.com>
parents:
13090
diff
changeset
|
582 frame = gaim_gtk_create_imhtml(FALSE, &imhtml, NULL, NULL); |
9005 | 583 gtk_widget_set_name(imhtml, "gaim_gtknotify_imhtml"); |
11723
9537977703bb
[gaim-migrate @ 14014]
Richard Laager <rlaager@wiktel.com>
parents:
11533
diff
changeset
|
584 gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), |
9537977703bb
[gaim-migrate @ 14014]
Richard Laager <rlaager@wiktel.com>
parents:
11533
diff
changeset
|
585 gtk_imhtml_get_format_functions(GTK_IMHTML(imhtml)) | GTK_IMHTML_IMAGE); |
10181 | 586 gtk_widget_set_size_request(imhtml, 300, 250); |
587 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | |
588 gtk_widget_show(frame); | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
589 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
590 /* Add the Close button. */ |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
591 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
592 gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
593 gtk_widget_show(button); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
594 |
6872 | 595 g_signal_connect_swapped(G_OBJECT(button), "clicked", |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
596 G_CALLBACK(formatted_close_cb), window); |
7455 | 597 g_signal_connect(G_OBJECT(window), "key_press_event", |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
598 G_CALLBACK(formatted_input_cb), NULL); |
7455 | 599 |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
600 /* Add the text to the gtkimhtml */ |
11293 | 601 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/show_incoming_formatting")) |
10497 | 602 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
|
603 |
10503 | 604 options |= GTK_IMHTML_NO_COMMENTS; |
605 options |= GTK_IMHTML_NO_TITLE; | |
606 options |= GTK_IMHTML_NO_NEWLINE; | |
607 options |= GTK_IMHTML_NO_SCROLL; | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
608 |
8882 | 609 /* Make sure URLs are clickable */ |
610 linked_text = gaim_markup_linkify(text); | |
10181 | 611 gtk_imhtml_append_text(GTK_IMHTML(imhtml), linked_text, options); |
8882 | 612 g_free(linked_text); |
7078 | 613 |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
614 /* Show the window */ |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
615 gtk_widget_show(window); |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
616 |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
617 return window; |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
618 } |
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
619 |
11359 | 620 static void |
621 gaim_gtk_notify_searchresults_new_rows(GaimConnection *gc, GaimNotifySearchResults *results, | |
13640 | 622 void *data_) |
11359 | 623 { |
624 GaimNotifySearchResultsData *data = data_; | |
625 GtkListStore *model = data->model; | |
626 GtkTreeIter iter; | |
13090 | 627 GdkPixbuf *pixbuf; |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
628 guint col_num; |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
629 guint i; |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
630 guint j; |
13090 | 631 |
11359 | 632 gtk_list_store_clear(data->model); |
633 | |
13090 | 634 pixbuf = gaim_gtk_create_prpl_icon(gaim_connection_get_account(gc), 0.5); |
11359 | 635 |
636 /* +1 is for the automagically created Status column. */ | |
637 col_num = gaim_notify_searchresults_get_columns_count(results) + 1; | |
638 | |
639 for (i = 0; i < gaim_notify_searchresults_get_rows_count(results); i++) { | |
640 GList *row = gaim_notify_searchresults_row_get(results, i); | |
641 | |
642 gtk_list_store_append(model, &iter); | |
13090 | 643 gtk_list_store_set(model, &iter, 0, pixbuf, -1); |
11359 | 644 |
645 for (j = 1; j < col_num; j++) { | |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12477
diff
changeset
|
646 GValue v; |
11359 | 647 char *escaped = g_markup_escape_text(g_list_nth_data(row, j - 1), -1); |
648 | |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12477
diff
changeset
|
649 v.g_type = 0; |
11359 | 650 g_value_init(&v, G_TYPE_STRING); |
651 g_value_set_string(&v, escaped); | |
652 gtk_list_store_set_value(model, &iter, j, &v); | |
653 g_free(escaped); | |
654 } | |
655 } | |
13090 | 656 |
657 if (pixbuf != NULL) | |
658 g_object_unref(pixbuf); | |
11359 | 659 } |
660 | |
9797 | 661 static void * |
10439 | 662 gaim_gtk_notify_searchresults(GaimConnection *gc, const char *title, |
663 const char *primary, const char *secondary, | |
13640 | 664 GaimNotifySearchResults *results, gpointer user_data) |
10439 | 665 { |
666 GtkWidget *window; | |
11359 | 667 GtkWidget *treeview; |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
668 GtkWidget *close_button; |
11359 | 669 GType *col_types; |
670 GtkListStore *model; | |
671 GtkCellRenderer *renderer; | |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
672 guint col_num; |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
673 guint i; |
11359 | 674 |
10439 | 675 GtkWidget *vbox; |
676 GtkWidget *button_area; | |
677 GtkWidget *label; | |
678 GtkWidget *sw; | |
679 GaimNotifySearchResultsData *data; | |
680 char *label_text; | |
10774 | 681 char *primary_esc, *secondary_esc; |
10439 | 682 |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
683 g_return_val_if_fail(gc != NULL, NULL); |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
684 g_return_val_if_fail(results != NULL, NULL); |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
685 |
10439 | 686 data = g_malloc(sizeof(GaimNotifySearchResultsData)); |
13640 | 687 data->user_data = user_data; |
13976
6a5aaf46bd52
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13975
diff
changeset
|
688 data->results = results; |
10439 | 689 |
690 /* Create the window */ | |
691 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
692 gtk_window_set_title(GTK_WINDOW(window), (title ? title :_("Search Results"))); | |
693 gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); | |
11243 | 694 gtk_container_set_border_width(GTK_CONTAINER(window), GAIM_HIG_BORDER); |
10439 | 695 |
696 g_signal_connect_swapped(G_OBJECT(window), "delete_event", | |
697 G_CALLBACK(searchresults_close_cb), data); | |
698 | |
699 /* Setup the main vbox */ | |
11243 | 700 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
10439 | 701 gtk_container_add(GTK_CONTAINER(window), vbox); |
702 gtk_widget_show(vbox); | |
703 | |
704 /* Setup the descriptive label */ | |
10774 | 705 primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
706 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
10439 | 707 label_text = g_strdup_printf( |
708 "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", | |
10774 | 709 (primary ? primary_esc : ""), |
10439 | 710 (primary && secondary ? "\n" : ""), |
10774 | 711 (secondary ? secondary_esc : "")); |
712 g_free(primary_esc); | |
713 g_free(secondary_esc); | |
10439 | 714 label = gtk_label_new(NULL); |
715 gtk_label_set_markup(GTK_LABEL(label), label_text); | |
716 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
717 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
718 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
719 gtk_widget_show(label); | |
720 g_free(label_text); | |
721 | |
11359 | 722 /* +1 is for the automagically created Status column. */ |
723 col_num = gaim_notify_searchresults_get_columns_count(results) + 1; | |
724 | |
10439 | 725 /* Setup the list model */ |
11359 | 726 col_types = g_new0(GType, col_num); |
727 | |
728 /* There always is this first column. */ | |
729 col_types[0] = GDK_TYPE_PIXBUF; | |
730 for (i = 1; i < col_num; i++) { | |
731 col_types[i] = G_TYPE_STRING; | |
732 } | |
733 model = gtk_list_store_newv(col_num, col_types); | |
10439 | 734 |
735 /* Setup the scrolled window containing the treeview */ | |
736 sw = gtk_scrolled_window_new(NULL, NULL); | |
737 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
738 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
739 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
740 GTK_SHADOW_IN); | |
741 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
742 gtk_widget_show(sw); | |
743 | |
744 /* Setup the treeview */ | |
745 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); | |
746 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | |
11359 | 747 gtk_widget_set_size_request(treeview, 500, 400); |
10439 | 748 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
749 GTK_SELECTION_SINGLE); | |
11359 | 750 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), TRUE); |
10439 | 751 gtk_container_add(GTK_CONTAINER(sw), treeview); |
752 gtk_widget_show(treeview); | |
753 | |
11359 | 754 renderer = gtk_cell_renderer_pixbuf_new(); |
10439 | 755 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
11359 | 756 -1, "", renderer, "pixbuf", 0, NULL); |
10439 | 757 |
11359 | 758 for (i = 1; i < col_num; i++) { |
759 renderer = gtk_cell_renderer_text_new(); | |
10439 | 760 |
11359 | 761 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, |
762 gaim_notify_searchresults_column_get_title(results, i-1), | |
763 renderer, "text", i, NULL); | |
764 } | |
765 | |
10439 | 766 /* Setup the button area */ |
767 button_area = gtk_hbutton_box_new(); | |
768 gtk_box_pack_start(GTK_BOX(vbox), button_area, FALSE, FALSE, 0); | |
769 gtk_button_box_set_layout(GTK_BUTTON_BOX(button_area), GTK_BUTTONBOX_END); | |
11243 | 770 gtk_box_set_spacing(GTK_BOX(button_area), GAIM_HIG_BORDER); |
10439 | 771 gtk_widget_show(button_area); |
772 | |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
773 for (i = 0; i < g_list_length(results->buttons); i++) { |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12242
diff
changeset
|
774 GaimNotifySearchButton *b = g_list_nth_data(results->buttons, i); |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
775 GtkWidget *button = NULL; |
11359 | 776 switch (b->type) { |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
777 case GAIM_NOTIFY_BUTTON_LABELED: |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
778 if(b->label) { |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
779 button = gtk_button_new_with_label(b->label); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
780 } else { |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
781 gaim_debug_warning("gtknotify", "Missing button label"); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
782 } |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
783 break; |
11359 | 784 case GAIM_NOTIFY_BUTTON_CONTINUE: |
785 button = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD); | |
786 break; | |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
787 case GAIM_NOTIFY_BUTTON_ADD: |
11359 | 788 button = gtk_button_new_from_stock(GTK_STOCK_ADD); |
789 break; | |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
790 case GAIM_NOTIFY_BUTTON_INFO: |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
791 button = gtk_button_new_from_stock(GAIM_STOCK_INFO); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
792 break; |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
793 case GAIM_NOTIFY_BUTTON_IM: |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
794 button = gtk_button_new_from_stock(GAIM_STOCK_IM); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
795 break; |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
796 case GAIM_NOTIFY_BUTTON_JOIN: |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
797 button = gtk_button_new_from_stock(GAIM_STOCK_CHAT); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
798 break; |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
799 case GAIM_NOTIFY_BUTTON_INVITE: |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
800 button = gtk_button_new_from_stock(GAIM_STOCK_INVITE); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
801 break; |
11359 | 802 default: |
803 gaim_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); | |
804 } | |
805 if (button != NULL) { | |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
806 GaimNotifySearchResultsButtonData *bd; |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
807 |
11359 | 808 gtk_box_pack_start(GTK_BOX(button_area), button, FALSE, FALSE, 0); |
809 gtk_widget_show(button); | |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
810 |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
811 bd = g_new0(GaimNotifySearchResultsButtonData, 1); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
812 bd->button = b; |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
813 bd->data = data; |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
814 |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
815 g_signal_connect(G_OBJECT(button), "clicked", |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
816 G_CALLBACK(searchresults_callback_wrapper_cb), bd); |
13976
6a5aaf46bd52
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13975
diff
changeset
|
817 g_signal_connect_swapped(G_OBJECT(button), "destroy", G_CALLBACK(g_free), bd); |
11359 | 818 } |
819 } | |
10439 | 820 |
821 /* Add the Close button */ | |
822 close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
823 gtk_box_pack_start(GTK_BOX(button_area), close_button, FALSE, FALSE, 0); | |
824 gtk_widget_show(close_button); | |
825 | |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
826 g_signal_connect_swapped(G_OBJECT(close_button), "clicked", |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
827 G_CALLBACK(searchresults_close_cb), data); |
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
828 |
10439 | 829 data->account = gc->account; |
830 data->model = model; | |
831 data->treeview = treeview; | |
832 data->window = window; | |
833 | |
11359 | 834 /* Insert rows. */ |
13640 | 835 gaim_gtk_notify_searchresults_new_rows(gc, results, data); |
11359 | 836 |
10439 | 837 /* Show the window */ |
838 gtk_widget_show(window); | |
839 return data; | |
840 } | |
841 | |
842 static void * | |
9797 | 843 gaim_gtk_notify_userinfo(GaimConnection *gc, const char *who, |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
844 const char *text) |
9797 | 845 { |
11533
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11359
diff
changeset
|
846 char *primary; |
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11359
diff
changeset
|
847 void *ui_handle; |
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11359
diff
changeset
|
848 |
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11359
diff
changeset
|
849 primary = g_strdup_printf(_("Info for %s"), who); |
12242
976677e67239
[gaim-migrate @ 14544]
Richard Laager <rlaager@wiktel.com>
parents:
12227
diff
changeset
|
850 ui_handle = gaim_gtk_notify_formatted(_("Buddy Information"), primary, NULL, text); |
11533
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11359
diff
changeset
|
851 g_free(primary); |
c9b815aeddc1
[gaim-migrate @ 13782]
Richard Laager <rlaager@wiktel.com>
parents:
11359
diff
changeset
|
852 return ui_handle; |
9797 | 853 } |
854 | |
5437 | 855 static void |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
856 gaim_gtk_close_notify(GaimNotifyType type, void *ui_handle) |
5437 | 857 { |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
858 if (type == GAIM_NOTIFY_EMAIL || type == GAIM_NOTIFY_EMAILS) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
859 { |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
860 GaimNotifyMailData *data = (GaimNotifyMailData *)ui_handle; |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
861 |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
862 g_free(data->url); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
863 g_free(data); |
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
864 } |
10439 | 865 else if (type == GAIM_NOTIFY_SEARCHRESULTS) |
866 { | |
867 GaimNotifySearchResultsData *data = (GaimNotifySearchResultsData *)ui_handle; | |
868 | |
869 gtk_widget_destroy(data->window); | |
13976
6a5aaf46bd52
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13975
diff
changeset
|
870 gaim_notify_searchresults_free(data->results); |
10439 | 871 |
872 g_free(data); | |
873 } | |
10750
d5a00882d118
[gaim-migrate @ 12353]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10732
diff
changeset
|
874 else if (ui_handle != NULL) |
5519
42a20beb80a7
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
875 gtk_widget_destroy(GTK_WIDGET(ui_handle)); |
5437 | 876 } |
877 | |
8272 | 878 #ifndef _WIN32 |
879 static gint | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
880 uri_command(const char *command, gboolean sync) |
8272 | 881 { |
13519 | 882 gchar *tmp; |
8272 | 883 GError *error = NULL; |
884 gint ret = 0; | |
885 | |
13519 | 886 gaim_debug_misc("gtknotify", "Executing %s\n", command); |
8278 | 887 |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
888 if (!gaim_program_is_valid(command)) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
889 { |
13539
c69a837e990c
[gaim-migrate @ 15916]
Richard Laager <rlaager@wiktel.com>
parents:
13519
diff
changeset
|
890 tmp = g_strdup_printf(_("The browser command \"%s\" is invalid."), |
13519 | 891 command ? command : "(none)"); |
8272 | 892 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
893 g_free(tmp); | |
894 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
895 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
896 else if (sync) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
897 { |
8272 | 898 gint status; |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
899 |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
900 if (!g_spawn_command_line_sync(command, NULL, NULL, &status, &error)) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
901 { |
13539
c69a837e990c
[gaim-migrate @ 15916]
Richard Laager <rlaager@wiktel.com>
parents:
13519
diff
changeset
|
902 tmp = g_strdup_printf(_("Error launching \"%s\": %s"), |
13519 | 903 command, error->message); |
8272 | 904 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
905 g_free(tmp); | |
906 g_error_free(error); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
907 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
908 else |
8272 | 909 ret = status; |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
910 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
911 else |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
912 { |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
913 if (!g_spawn_command_line_async(command, &error)) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
914 { |
13539
c69a837e990c
[gaim-migrate @ 15916]
Richard Laager <rlaager@wiktel.com>
parents:
13519
diff
changeset
|
915 tmp = g_strdup_printf(_("Error launching \"%s\": %s"), |
13519 | 916 command, error->message); |
8272 | 917 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
918 g_free(tmp); | |
919 g_error_free(error); | |
920 } | |
921 } | |
922 | |
923 return ret; | |
924 } | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
925 #endif /* _WIN32 */ |
8272 | 926 |
7136 | 927 static void * |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
928 gaim_gtk_notify_uri(const char *uri) |
7136 | 929 { |
930 #ifndef _WIN32 | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
931 char *escaped = g_shell_quote(uri); |
7136 | 932 char *command = NULL; |
8272 | 933 char *remote_command = NULL; |
7136 | 934 const char *web_browser; |
8272 | 935 int place; |
7136 | 936 |
937 web_browser = gaim_prefs_get_string("/gaim/gtk/browsers/browser"); | |
8272 | 938 place = gaim_prefs_get_int("/gaim/gtk/browsers/place"); |
7136 | 939 |
10060 | 940 /* if they are running gnome, use the gnome web browser */ |
10061 | 941 if (gaim_running_gnome() == TRUE) |
10060 | 942 { |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
943 command = g_strdup_printf("gnome-open %s", escaped); |
10061 | 944 } |
10060 | 945 else if (!strcmp(web_browser, "epiphany") || |
9405 | 946 !strcmp(web_browser, "galeon")) |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
947 { |
8272 | 948 if (place == GAIM_BROWSER_NEW_WINDOW) |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
949 command = g_strdup_printf("%s -w %s", web_browser, escaped); |
8272 | 950 else if (place == GAIM_BROWSER_NEW_TAB) |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
951 command = g_strdup_printf("%s -n %s", web_browser, escaped); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
952 else |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
953 command = g_strdup_printf("%s %s", web_browser, escaped); |
9405 | 954 } |
955 else if (!strcmp(web_browser, "gnome-open")) | |
956 { | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
957 command = g_strdup_printf("gnome-open %s", escaped); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
958 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
959 else if (!strcmp(web_browser, "kfmclient")) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
960 { |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
961 command = g_strdup_printf("kfmclient openURL %s", escaped); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
962 /* |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
963 * Does Konqueror have options to open in new tab |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
964 * and/or current window? |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
965 */ |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
966 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
967 else if (!strcmp(web_browser, "mozilla") || |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
968 !strcmp(web_browser, "mozilla-firebird") || |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
969 !strcmp(web_browser, "firefox")) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
970 { |
9399 | 971 char *args = ""; |
972 | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
973 command = g_strdup_printf("%s %s", web_browser, escaped); |
8272 | 974 |
9399 | 975 /* |
976 * Firefox 0.9 and higher require a "-a firefox" option when | |
977 * using -remote commands. This breaks older versions of | |
978 * mozilla. So we include this other handly little string | |
979 * when calling firefox. If the API for remote calls changes | |
980 * any more in firefox then firefox should probably be split | |
981 * apart from mozilla-firebird and mozilla... but this is good | |
982 * for now. | |
983 */ | |
984 if (!strcmp(web_browser, "firefox")) | |
985 args = "-a firefox"; | |
986 | |
8272 | 987 if (place == GAIM_BROWSER_NEW_WINDOW) |
9399 | 988 remote_command = g_strdup_printf("%s %s -remote " |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
989 "openURL(%s,new-window)", |
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
990 web_browser, args, escaped); |
8272 | 991 else if (place == GAIM_BROWSER_NEW_TAB) |
9399 | 992 remote_command = g_strdup_printf("%s %s -remote " |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
993 "openURL(%s,new-tab)", |
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
994 web_browser, args, escaped); |
8272 | 995 else if (place == GAIM_BROWSER_CURRENT) |
9399 | 996 remote_command = g_strdup_printf("%s %s -remote " |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
997 "openURL(%s)", |
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
998 web_browser, args, escaped); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
999 } |
9405 | 1000 else if (!strcmp(web_browser, "netscape")) |
1001 { | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1002 command = g_strdup_printf("netscape %s", escaped); |
9405 | 1003 |
1004 if (place == GAIM_BROWSER_NEW_WINDOW) | |
1005 { | |
1006 remote_command = g_strdup_printf("netscape -remote " | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1007 "openURL(%s,new-window)", |
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1008 escaped); |
9405 | 1009 } |
1010 else if (place == GAIM_BROWSER_CURRENT) | |
1011 { | |
1012 remote_command = g_strdup_printf("netscape -remote " | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1013 "openURL(%s)", escaped); |
9405 | 1014 } |
1015 } | |
1016 else if (!strcmp(web_browser, "opera")) | |
1017 { | |
1018 if (place == GAIM_BROWSER_NEW_WINDOW) | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1019 command = g_strdup_printf("opera -newwindow %s", escaped); |
9405 | 1020 else if (place == GAIM_BROWSER_NEW_TAB) |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1021 command = g_strdup_printf("opera -newpage %s", escaped); |
9405 | 1022 else if (place == GAIM_BROWSER_CURRENT) |
1023 { | |
1024 remote_command = g_strdup_printf("opera -remote " | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1025 "openURL(%s)", escaped); |
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1026 command = g_strdup_printf("opera %s", escaped); |
9405 | 1027 } |
1028 else | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1029 command = g_strdup_printf("opera %s", escaped); |
9405 | 1030 |
1031 } | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1032 else if (!strcmp(web_browser, "custom")) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1033 { |
7136 | 1034 const char *web_command; |
1035 | |
1036 web_command = gaim_prefs_get_string("/gaim/gtk/browsers/command"); | |
1037 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1038 if (web_command == NULL || *web_command == '\0') |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1039 { |
7136 | 1040 gaim_notify_error(NULL, NULL, _("Unable to open URL"), |
1041 _("The 'Manual' browser command has been " | |
1042 "chosen, but no command has been set.")); | |
1043 return NULL; | |
1044 } | |
1045 | |
1046 if (strstr(web_command, "%s")) | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1047 command = gaim_strreplace(web_command, "%s", escaped); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1048 else |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1049 { |
7136 | 1050 /* |
1051 * There is no "%s" in the browser command. Assume the user | |
1052 * wanted the URL tacked on to the end of the command. | |
1053 */ | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1054 command = g_strdup_printf("%s %s", web_command, escaped); |
7136 | 1055 } |
1056 } | |
1057 | |
12477
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1058 g_free(escaped); |
d90eae2387b5
[gaim-migrate @ 14788]
Richard Laager <rlaager@wiktel.com>
parents:
12257
diff
changeset
|
1059 |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1060 if (remote_command != NULL) |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1061 { |
8272 | 1062 /* try the remote command first */ |
1063 if (uri_command(remote_command, TRUE) != 0) | |
1064 uri_command(command, FALSE); | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1065 |
8272 | 1066 g_free(remote_command); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1067 |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1068 } |
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1069 else |
8272 | 1070 uri_command(command, FALSE); |
7136 | 1071 |
1072 g_free(command); | |
1073 | |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1074 #else /* !_WIN32 */ |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
1075 wgaim_notify_uri(uri); |
8338
354bba6ad254
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
1076 #endif /* !_WIN32 */ |
7136 | 1077 |
1078 return NULL; | |
1079 } | |
1080 | |
5437 | 1081 static GaimNotifyUiOps ops = |
1082 { | |
1083 gaim_gtk_notify_message, | |
1084 gaim_gtk_notify_email, | |
1085 gaim_gtk_notify_emails, | |
6381
e006685f75aa
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1086 gaim_gtk_notify_formatted, |
10439 | 1087 gaim_gtk_notify_searchresults, |
11359 | 1088 gaim_gtk_notify_searchresults_new_rows, |
9797 | 1089 gaim_gtk_notify_userinfo, |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
1090 gaim_gtk_notify_uri, |
5437 | 1091 gaim_gtk_close_notify |
1092 }; | |
1093 | |
1094 GaimNotifyUiOps * | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
7007
diff
changeset
|
1095 gaim_gtk_notify_get_ui_ops(void) |
5437 | 1096 { |
1097 return &ops; | |
1098 } |