annotate gtk/gtknotify.c @ 14739:63d5b71d0c68

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