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