annotate pidgin/gtkrequest.c @ 32598:1798b24a4fd5

Fix history plugin compile.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 08 Sep 2011 23:28:40 +0000
parents 91e431815449
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gtkrequest.c GTK+ Request API
16193
247e421c4fa6 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents: 16062
diff changeset
3 * @ingroup pidgin
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 20073
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 20073
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 20073
diff changeset
6 /* pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19626
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15509
diff changeset
27 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
29 #include "debug.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "gtkimhtml.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "gtkimhtmltoolbar.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "gtkrequest.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "gtkutils.h"
15822
84b0f9b23ede According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
37 #include "pidginstock.h"
19870
df070477394e Forgot to refer to gtkblist.h
Gabriel Schulhof <nix@go-nix.ca>
parents: 19869
diff changeset
38 #include "gtkblist.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include <gdk/gdkkeysyms.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
42 static GtkWidget * create_account_field(PurpleRequestField *field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 typedef struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
46 PurpleRequestType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 void *user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 GtkWidget *dialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 GtkWidget *ok_button;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 size_t cb_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 GCallback *cbs;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 union
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 gboolean multiline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 gchar *hint;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 } input;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
69 PurpleRequestFields *fields;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 } multifield;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 struct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 gboolean savedialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 gchar *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 } file;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 } u;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
82 } PidginRequestData;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 static void
28852
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
85 pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account)
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
86 {
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
87 GtkWidget *image;
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
88 GdkPixbuf *pixbuf;
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
89 GtkTooltips *tips;
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
90
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
91 if (!account)
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
92 return;
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
93
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
94 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
95 image = gtk_image_new_from_pixbuf(pixbuf);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
96 g_object_unref(G_OBJECT(pixbuf));
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
97
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
98 tips = gtk_tooltips_new();
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
99 gtk_tooltips_set_tip(tips, image, purple_account_get_username(account), NULL);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
100
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
101 if (GTK_IS_DIALOG(cont)) {
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
102 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(cont)->action_area), image, FALSE, TRUE, 0);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
103 gtk_box_reorder_child(GTK_BOX(GTK_DIALOG(cont)->action_area), image, 0);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
104 } else if (GTK_IS_HBOX(cont)) {
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
105 gtk_misc_set_alignment(GTK_MISC(image), 0, 0);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
106 gtk_box_pack_end(GTK_BOX(cont), image, FALSE, TRUE, 0);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
107 }
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
108 gtk_widget_show(image);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
109 }
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
110
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
111 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
112 generic_response_start(PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 g_return_if_fail(data != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 /* Tell the user we're doing something. */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
117 pidgin_set_cursor(GTK_WIDGET(data->dialog), GDK_WATCH);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
121 input_response_cb(GtkDialog *dialog, gint id, PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 const char *value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 char *multiline_value = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 generic_response_start(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 if (data->u.input.multiline) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 GtkTextIter start_iter, end_iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 GtkTextBuffer *buffer =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->u.input.entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 gtk_text_buffer_get_start_iter(buffer, &start_iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 gtk_text_buffer_get_end_iter(buffer, &end_iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 multiline_value = gtk_imhtml_get_markup(GTK_IMHTML(data->u.input.entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 multiline_value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 value = multiline_value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 if (id < data->cb_count && data->cbs[id] != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
148 ((PurpleRequestInputCb)data->cbs[id])(data->user_data, value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 else if (data->cbs[1] != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
150 ((PurpleRequestInputCb)data->cbs[1])(data->user_data, value);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 if (data->u.input.multiline)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 g_free(multiline_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
155 purple_request_close(PURPLE_REQUEST_INPUT, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
159 action_response_cb(GtkDialog *dialog, gint id, PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 generic_response_start(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 if (id < data->cb_count && data->cbs[id] != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
164 ((PurpleRequestActionCb)data->cbs[id])(data->user_data, id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
166 purple_request_close(PURPLE_REQUEST_INPUT, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
171 choice_response_cb(GtkDialog *dialog, gint id, PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 GtkWidget *radio = g_object_get_data(G_OBJECT(dialog), "radio");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 GSList *group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 generic_response_start(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 if (id < data->cb_count && data->cbs[id] != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 while (group) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(group->data))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
181 ((PurpleRequestChoiceCb)data->cbs[id])(data->user_data, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(group->data), "choice_id")));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 group = group->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
186 purple_request_close(PURPLE_REQUEST_INPUT, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 field_string_focus_out_cb(GtkWidget *entry, GdkEventFocus *event,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
191 PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 const char *value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
195 if (purple_request_field_string_is_multiline(field))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 GtkTextBuffer *buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 GtkTextIter start_iter, end_iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 gtk_text_buffer_get_start_iter(buffer, &start_iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 gtk_text_buffer_get_end_iter(buffer, &end_iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 value = gtk_entry_get_text(GTK_ENTRY(entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
210 purple_request_field_string_set_value(field,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 (*value == '\0' ? NULL : value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 field_int_focus_out_cb(GtkEntry *entry, GdkEventFocus *event,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
218 PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
220 purple_request_field_int_set_value(field,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 atoi(gtk_entry_get_text(entry)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
227 field_bool_cb(GtkToggleButton *button, PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
229 purple_request_field_bool_set_value(field,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 gtk_toggle_button_get_active(button));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232
29804
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
233 static void
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
234 field_choice_menu_cb(GtkComboBox *menu, PurpleRequestField *field)
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
235 {
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
236 purple_request_field_choice_set_value(field,
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
237 gtk_combo_box_get_active(menu));
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
238 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
241 field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
244 purple_request_field_choice_set_value(field,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 (g_slist_length(gtk_radio_button_get_group(button)) -
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 g_slist_index(gtk_radio_button_get_group(button), button)) - 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
250 field_account_cb(GObject *w, PurpleAccount *account, PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
252 purple_request_field_account_set_value(field, account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
256 multifield_ok_cb(GtkWidget *button, PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 generic_response_start(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 if (!GTK_WIDGET_HAS_FOCUS(button))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 gtk_widget_grab_focus(button);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 if (data->cbs[0] != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
264 ((PurpleRequestFieldsCb)data->cbs[0])(data->user_data,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 data->u.multifield.fields);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
267 purple_request_close(PURPLE_REQUEST_FIELDS, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
271 multifield_cancel_cb(GtkWidget *button, PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 generic_response_start(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 if (data->cbs[1] != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
276 ((PurpleRequestFieldsCb)data->cbs[1])(data->user_data,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 data->u.multifield.fields);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
279 purple_request_close(PURPLE_REQUEST_FIELDS, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
282 static gboolean
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 destroy_multifield_cb(GtkWidget *dialog, GdkEvent *event,
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
284 PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 multifield_cancel_cb(NULL, data);
21913
2a591a5b3322 Make some more event handlers return appropriate gboolean values. This turns
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21894
diff changeset
287 return FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 #define STOCK_ITEMIZE(r, l) \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 if (!strcmp((r), text)) \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 return (l);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 static const char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 text_to_stock(const char *text)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 STOCK_ITEMIZE(_("Yes"), GTK_STOCK_YES);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 STOCK_ITEMIZE(_("No"), GTK_STOCK_NO);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 STOCK_ITEMIZE(_("OK"), GTK_STOCK_OK);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 STOCK_ITEMIZE(_("Cancel"), GTK_STOCK_CANCEL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 STOCK_ITEMIZE(_("Apply"), GTK_STOCK_APPLY);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 STOCK_ITEMIZE(_("Close"), GTK_STOCK_CLOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 STOCK_ITEMIZE(_("Delete"), GTK_STOCK_DELETE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 STOCK_ITEMIZE(_("Add"), GTK_STOCK_ADD);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 STOCK_ITEMIZE(_("Remove"), GTK_STOCK_REMOVE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 STOCK_ITEMIZE(_("Save"), GTK_STOCK_SAVE);
15509
23ca11f8a8c4 stock to pidgin
Sean Egan <seanegan@gmail.com>
parents: 15507
diff changeset
308 STOCK_ITEMIZE(_("Alias"), PIDGIN_STOCK_ALIAS);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 return text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 static void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
314 pidgin_request_input(const char *title, const char *primary,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 const char *secondary, const char *default_value,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 gboolean multiline, gboolean masked, gchar *hint,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 const char *ok_text, GCallback ok_cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 const char *cancel_text, GCallback cancel_cb,
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16198
diff changeset
319 PurpleAccount *account, const char *who, PurpleConversation *conv,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
320 void *user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
322 PidginRequestData *data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 GtkWidget *dialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 GtkWidget *vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 GtkWidget *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 GtkWidget *entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 GtkWidget *toolbar;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 char *label_text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 char *primary_esc, *secondary_esc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
333 data = g_new0(PidginRequestData, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
334 data->type = PURPLE_REQUEST_INPUT;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 data->user_data = user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 data->cb_count = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 data->cbs = g_new0(GCallback, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 data->cbs[0] = ok_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 data->cbs[1] = cancel_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 /* Create the dialog. */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
344 dialog = gtk_dialog_new_with_buttons(title ? title : PIDGIN_ALERT_TITLE,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
345 NULL, 0,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 text_to_stock(cancel_text), 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 text_to_stock(ok_text), 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 data->dialog = dialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 g_signal_connect(G_OBJECT(dialog), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 G_CALLBACK(input_response_cb), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 /* Setup the dialog */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
355 gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
356 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2);
17773
7a96dcb82ff7 Make multiline pidgin_request_input() windows resizable, and make
Mark Doliner <mark@kingant.net>
parents: 16831
diff changeset
357 if (!multiline)
7a96dcb82ff7 Make multiline pidgin_request_input() windows resizable, and make
Mark Doliner <mark@kingant.net>
parents: 16831
diff changeset
358 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
361 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 /* Setup the main horizontal box */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
364 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 /* Dialog icon. */
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
368 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
369 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 /* Vertical box */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
374 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
17773
7a96dcb82ff7 Make multiline pidgin_request_input() windows resizable, and make
Mark Doliner <mark@kingant.net>
parents: 16831
diff changeset
376 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
28852
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
378 pidgin_widget_decorate_account(hbox, account);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
379
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 /* Descriptive label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 "%s</span>%s%s" : "%s%s%s"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 (primary ? primary_esc : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 ((primary && secondary) ? "\n\n" : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 (secondary ? secondary_esc : ""));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 g_free(primary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 g_free(secondary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 gtk_label_set_markup(GTK_LABEL(label), label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
17773
7a96dcb82ff7 Make multiline pidgin_request_input() windows resizable, and make
Mark Doliner <mark@kingant.net>
parents: 16831
diff changeset
396 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 g_free(label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 /* Entry field. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 data->u.input.multiline = multiline;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 data->u.input.hint = g_strdup(hint);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403
19626
1a0fabe867be And don't show everything here either.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19408
diff changeset
404 gtk_widget_show_all(hbox);
1a0fabe867be And don't show everything here either.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19408
diff changeset
405
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 GtkWidget *frame;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 /* imhtml */
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
410 frame = pidgin_create_imhtml(TRUE, &entry, &toolbar, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 gtk_widget_set_size_request(entry, 320, 130);
16198
88a93f78b489 I don't like the pidginfoo_bar widget names that resulted from the sed.
Richard Laager <rlaager@wiktel.com>
parents: 16193
diff changeset
412 gtk_widget_set_name(entry, "pidgin_request_imhtml");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 if (default_value != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 gtk_imhtml_append_text(GTK_IMHTML(entry), default_value, GTK_IMHTML_NO_SCROLL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 gtk_widget_show(frame);
25427
2cf7d6a20e68 Add a GtkIMHtml function that causes the widget to actually insert a
Mark Doliner <mark@kingant.net>
parents: 25401
diff changeset
417
2cf7d6a20e68 Add a GtkIMHtml function that causes the widget to actually insert a
Mark Doliner <mark@kingant.net>
parents: 25401
diff changeset
418 gtk_imhtml_set_return_inserts_newline(GTK_IMHTML(entry));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 if (multiline) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 /* GtkTextView */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 entry = gtk_text_view_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 gtk_text_view_set_editable(GTK_TEXT_VIEW(entry), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 if (default_value != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 GtkTextBuffer *buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 gtk_text_buffer_set_text(buffer, default_value, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(entry), GTK_WRAP_WORD_CHAR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
435 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck"))
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
436 pidgin_setup_gtkspell(GTK_TEXT_VIEW(entry));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437
31816
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
438 gtk_box_pack_start(GTK_BOX(vbox),
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
439 pidgin_make_scrollable(entry, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, 320, 130),
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
440 TRUE, TRUE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 entry = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 if (default_value != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 gtk_entry_set_text(GTK_ENTRY(entry), default_value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 if (masked)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
24987
17b840986607 GTK+ 2.16.0 will set the invisible character to a nice bullet instead of
Mark Doliner <mark@kingant.net>
parents: 24497
diff changeset
455 #if !GTK_CHECK_VERSION(2,16,0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 if (gtk_entry_get_invisible_char(GTK_ENTRY(entry)) == '*')
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
457 gtk_entry_set_invisible_char(GTK_ENTRY(entry), PIDGIN_INVISIBLE_CHAR);
24987
17b840986607 GTK+ 2.16.0 will set the invisible character to a nice bullet instead of
Mark Doliner <mark@kingant.net>
parents: 24497
diff changeset
458 #endif /* Less than GTK+ 2.16 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 }
19626
1a0fabe867be And don't show everything here either.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19408
diff changeset
461 gtk_widget_show_all(vbox);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463
15507
311315e979f7 gtkutils changes
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
464 pidgin_set_accessible_label (entry, label);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 data->u.input.entry = entry;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466
21888
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
467 pidgin_auto_parent_window(dialog);
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
468
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 /* Show everything. */
19626
1a0fabe867be And don't show everything here either.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19408
diff changeset
470 gtk_widget_show(dialog);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 return data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 static void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
476 pidgin_request_choice(const char *title, const char *primary,
19408
cc36a5aac908 Fix some conversion warnings about using negative values with unsigned types. There are more, but these were easy fixes. You may think that I'm changing the API, but I'm really not - it was just wrong.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19228
diff changeset
477 const char *secondary, int default_value,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 const char *ok_text, GCallback ok_cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 const char *cancel_text, GCallback cancel_cb,
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16198
diff changeset
480 PurpleAccount *account, const char *who, PurpleConversation *conv,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
481 void *user_data, va_list args)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
483 PidginRequestData *data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 GtkWidget *dialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 GtkWidget *vbox, *vbox2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 GtkWidget *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 GtkWidget *radio = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 char *label_text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 char *radio_text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 char *primary_esc, *secondary_esc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
494 data = g_new0(PidginRequestData, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
495 data->type = PURPLE_REQUEST_ACTION;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 data->user_data = user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 data->cb_count = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 data->cbs = g_new0(GCallback, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 data->cbs[0] = cancel_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 data->cbs[1] = ok_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 /* Create the dialog. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 data->dialog = dialog = gtk_dialog_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 if (title != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 gtk_window_set_title(GTK_WINDOW(dialog), title);
16624
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
508 #ifdef _WIN32
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
509 gtk_window_set_title(GTK_WINDOW(dialog), PIDGIN_ALERT_TITLE);
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
510 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 gtk_dialog_add_button(GTK_DIALOG(dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 text_to_stock(cancel_text), 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 gtk_dialog_add_button(GTK_DIALOG(dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 text_to_stock(ok_text), 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 g_signal_connect(G_OBJECT(dialog), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 G_CALLBACK(choice_response_cb), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 /* Setup the dialog */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
522 gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
523 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
526 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 /* Setup the main horizontal box */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
529 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 /* Dialog icon. */
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
533 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
534 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537
28852
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
538 pidgin_widget_decorate_account(hbox, account);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
539
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 /* Vertical box */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
541 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 /* Descriptive label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 "%s</span>%s%s" : "%s%s%s"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 (primary ? primary_esc : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 ((primary && secondary) ? "\n\n" : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 (secondary ? secondary_esc : ""));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 g_free(primary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 g_free(secondary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 gtk_label_set_markup(GTK_LABEL(label), label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 g_free(label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
564 vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 while ((radio_text = va_arg(args, char*))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 int resp = va_arg(args, int);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 radio = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio), radio_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 g_object_set_data(G_OBJECT(radio), "choice_id", GINT_TO_POINTER(resp));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 if (resp == default_value)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 g_object_set_data(G_OBJECT(dialog), "radio", radio);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 /* Show everything. */
21888
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
578 pidgin_auto_parent_window(dialog);
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
579
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 gtk_widget_show_all(dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 return data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 static void *
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
586 pidgin_request_action_with_icon(const char *title, const char *primary,
19408
cc36a5aac908 Fix some conversion warnings about using negative values with unsigned types. There are more, but these were easy fixes. You may think that I'm changing the API, but I'm really not - it was just wrong.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19228
diff changeset
587 const char *secondary, int default_action,
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30286
diff changeset
588 PurpleAccount *account, const char *who,
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
589 PurpleConversation *conv, gconstpointer icon_data,
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
590 gsize icon_size,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
591 void *user_data, size_t action_count, va_list actions)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
593 PidginRequestData *data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 GtkWidget *dialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 GtkWidget *vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 GtkWidget *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 GtkWidget *label;
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
598 GtkWidget *img = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 void **buttons;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 char *label_text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 char *primary_esc, *secondary_esc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 int i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
604 data = g_new0(PidginRequestData, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
605 data->type = PURPLE_REQUEST_ACTION;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 data->user_data = user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 data->cb_count = action_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 data->cbs = g_new0(GCallback, action_count);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 /* Reverse the buttons */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 buttons = g_new0(void *, action_count * 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 for (i = 0; i < action_count * 2; i += 2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 buttons[(action_count * 2) - i - 2] = va_arg(actions, char *);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 buttons[(action_count * 2) - i - 1] = va_arg(actions, GCallback);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 /* Create the dialog. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 data->dialog = dialog = gtk_dialog_new();
18620
cec3ced34a7d gtk_window_set_deletable() is GTK+ >= 2.10.0. References #1947. Also fix a bug where on Windows, the default title is always applied.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18618
diff changeset
621
18618
2f0bda21712f purple_request_action doesn't call any callbacks if the user closes the
Ka-Hing Cheung <khc@hxbc.us>
parents: 18118
diff changeset
622 gtk_window_set_deletable(GTK_WINDOW(data->dialog), FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 if (title != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 gtk_window_set_title(GTK_WINDOW(dialog), title);
16624
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
626 #ifdef _WIN32
18620
cec3ced34a7d gtk_window_set_deletable() is GTK+ >= 2.10.0. References #1947. Also fix a bug where on Windows, the default title is always applied.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18618
diff changeset
627 else
16624
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
628 gtk_window_set_title(GTK_WINDOW(dialog), PIDGIN_ALERT_TITLE);
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
629 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 for (i = 0; i < action_count; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 gtk_dialog_add_button(GTK_DIALOG(dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 text_to_stock(buttons[2 * i]), i);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 data->cbs[i] = buttons[2 * i + 1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 g_free(buttons);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 g_signal_connect(G_OBJECT(dialog), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 G_CALLBACK(action_response_cb), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 /* Setup the dialog */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
644 gtk_container_set_border_width(GTK_CONTAINER(dialog), PIDGIN_HIG_BORDER/2);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
645 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER/2);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
648 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 /* Setup the main horizontal box */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
651 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 /* Dialog icon. */
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
655 if (icon_data) {
32138
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
656 GdkPixbuf *pixbuf = pidgin_pixbuf_from_data(icon_data, icon_size);
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
657 if (pixbuf) {
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
658 /* scale the image if it is too large */
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
659 int width = gdk_pixbuf_get_width(pixbuf);
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
660 int height = gdk_pixbuf_get_height(pixbuf);
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
661 if (width > 128 || height > 128) {
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
662 int scaled_width = width > height ? 128 : (128 * width) / height;
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
663 int scaled_height = height > width ? 128 : (128 * height) / width;
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
664 GdkPixbuf *scaled =
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
665 gdk_pixbuf_scale_simple(pixbuf, scaled_width, scaled_height,
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
666 GDK_INTERP_BILINEAR);
30286
ce52e101844a Scale incoming thumbnails in the request dialog if they are overly large
Marcus Lundblad <ml@update.uu.se>
parents: 30261
diff changeset
667
32138
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
668 purple_debug_info("pidgin",
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
669 "dialog icon was too large, scaled it down\n");
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
670 if (scaled) {
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
671 g_object_unref(pixbuf);
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
672 pixbuf = scaled;
30286
ce52e101844a Scale incoming thumbnails in the request dialog if they are overly large
Marcus Lundblad <ml@update.uu.se>
parents: 30261
diff changeset
673 }
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
674 }
32138
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
675 img = gtk_image_new_from_pixbuf(pixbuf);
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
676 g_object_unref(pixbuf);
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
677 } else {
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
678 purple_debug_info("pidgin", "failed to parse dialog icon\n");
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
679 }
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
680 }
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30286
diff changeset
681
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
682 if (!img) {
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
683 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
684 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
685 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 /* Vertical box */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
690 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692
28852
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
693 pidgin_widget_decorate_account(hbox, account);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
694
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 /* Descriptive label */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 "%s</span>%s%s" : "%s%s%s"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 (primary ? primary_esc : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 ((primary && secondary) ? "\n\n" : ""),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 (secondary ? secondary_esc : ""));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 g_free(primary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 g_free(secondary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 gtk_label_set_markup(GTK_LABEL(label), label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 gtk_label_set_selectable(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 g_free(label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
717 if (default_action == PURPLE_DEFAULT_ACTION_NONE) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 GTK_WIDGET_SET_FLAGS(img, GTK_CAN_DEFAULT);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 GTK_WIDGET_SET_FLAGS(img, GTK_CAN_FOCUS);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 gtk_widget_grab_focus(img);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 gtk_widget_grab_default(img);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 } else
22136
9df0a8c7c9b7 * Clarify the documentation for purple_request_action's 'default_ation'
Mark Doliner <mark@kingant.net>
parents: 22087
diff changeset
723 /*
9df0a8c7c9b7 * Clarify the documentation for purple_request_action's 'default_ation'
Mark Doliner <mark@kingant.net>
parents: 22087
diff changeset
724 * Need to invert the default_action number because the
9df0a8c7c9b7 * Clarify the documentation for purple_request_action's 'default_ation'
Mark Doliner <mark@kingant.net>
parents: 22087
diff changeset
725 * buttons are added to the dialog in reverse order.
9df0a8c7c9b7 * Clarify the documentation for purple_request_action's 'default_ation'
Mark Doliner <mark@kingant.net>
parents: 22087
diff changeset
726 */
9df0a8c7c9b7 * Clarify the documentation for purple_request_action's 'default_ation'
Mark Doliner <mark@kingant.net>
parents: 22087
diff changeset
727 gtk_dialog_set_default_response(GTK_DIALOG(dialog), action_count - 1 - default_action);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 /* Show everything. */
21888
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
730 pidgin_auto_parent_window(dialog);
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
731
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 gtk_widget_show_all(dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 return data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
737 static void *
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
738 pidgin_request_action(const char *title, const char *primary,
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
739 const char *secondary, int default_action,
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
740 PurpleAccount *account, const char *who, PurpleConversation *conv,
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
741 void *user_data, size_t action_count, va_list actions)
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
742 {
30261
75ea2a624b10 gtkrequest: Fix pidgin_request_action
Paul Aurich <paul@darkrain42.org>
parents: 30229
diff changeset
743 return pidgin_request_action_with_icon(title, primary, secondary,
75ea2a624b10 gtkrequest: Fix pidgin_request_action
Paul Aurich <paul@darkrain42.org>
parents: 30229
diff changeset
744 default_action, account, who, conv, NULL, 0, user_data, action_count,
75ea2a624b10 gtkrequest: Fix pidgin_request_action
Paul Aurich <paul@darkrain42.org>
parents: 30229
diff changeset
745 actions);
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
746 }
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
747
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
749 req_entry_field_changed_cb(GtkWidget *entry, PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 {
25328
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
751 PurpleRequestFieldGroup *group;
32453
91e431815449 Fix build breakage introduced by 756598e4c0c17510d74152d8f495204deb003620.
andrew.victor@mxit.com
parents: 32310
diff changeset
752 PurpleRequestFields *fields;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
753 PidginRequestData *req_data;
29290
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
754
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
755 if (purple_request_field_string_is_multiline(field))
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
756 {
29291
a25090259b4c Free allocated string from text-buffer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29290
diff changeset
757 char *text;
29290
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
758 GtkTextIter start_iter, end_iter;
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
759
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
760 gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(entry), &start_iter);
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
761 gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(entry), &end_iter);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762
29290
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
763 text = gtk_text_buffer_get_text(GTK_TEXT_BUFFER(entry), &start_iter, &end_iter, FALSE);
29291
a25090259b4c Free allocated string from text-buffer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29290
diff changeset
764 purple_request_field_string_set_value(field, (!text || !*text) ? NULL : text);
a25090259b4c Free allocated string from text-buffer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29290
diff changeset
765 g_free(text);
29290
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
766 }
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
767 else
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
768 {
29291
a25090259b4c Free allocated string from text-buffer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29290
diff changeset
769 const char *text = NULL;
29290
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
770 text = gtk_entry_get_text(GTK_ENTRY(entry));
29291
a25090259b4c Free allocated string from text-buffer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 29290
diff changeset
771 purple_request_field_string_set_value(field, (*text == '\0') ? NULL : text);
29290
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
772 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773
25328
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
774 group = purple_request_field_get_group(field);
32453
91e431815449 Fix build breakage introduced by 756598e4c0c17510d74152d8f495204deb003620.
andrew.victor@mxit.com
parents: 32310
diff changeset
775 fields = purple_request_field_group_get_fields_list(group);
91e431815449 Fix build breakage introduced by 756598e4c0c17510d74152d8f495204deb003620.
andrew.victor@mxit.com
parents: 32310
diff changeset
776 req_data = purple_request_fields_get_ui_data(fields);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 gtk_widget_set_sensitive(req_data->ok_button,
32453
91e431815449 Fix build breakage introduced by 756598e4c0c17510d74152d8f495204deb003620.
andrew.victor@mxit.com
parents: 32310
diff changeset
779 purple_request_fields_all_required_filled(fields));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
783 setup_entry_field(GtkWidget *entry, PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 const char *type_hint;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
789 if (purple_request_field_is_required(field))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 g_signal_connect(G_OBJECT(entry), "changed",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 G_CALLBACK(req_entry_field_changed_cb), field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
795 if ((type_hint = purple_request_field_get_type_hint(field)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
797 if (purple_str_has_prefix(type_hint, "screenname"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 GtkWidget *optmenu = NULL;
25328
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
800 PurpleRequestFieldGroup *group = purple_request_field_get_group(field);
32453
91e431815449 Fix build breakage introduced by 756598e4c0c17510d74152d8f495204deb003620.
andrew.victor@mxit.com
parents: 32310
diff changeset
801 GList *fields = purple_request_field_group_get_fields(group);
27483
8a46d5528c3c Plug a leak of an account dropdown selection dialog or two.
Paul Aurich <paul@darkrain42.org>
parents: 25427
diff changeset
802
8a46d5528c3c Plug a leak of an account dropdown selection dialog or two.
Paul Aurich <paul@darkrain42.org>
parents: 25427
diff changeset
803 /* Ensure the account option menu is created (if the widget hasn't
8a46d5528c3c Plug a leak of an account dropdown selection dialog or two.
Paul Aurich <paul@darkrain42.org>
parents: 25427
diff changeset
804 * been initialized already) for username auto-completion. */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 while (fields)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
807 PurpleRequestField *fld = fields->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 fields = fields->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809
27483
8a46d5528c3c Plug a leak of an account dropdown selection dialog or two.
Paul Aurich <paul@darkrain42.org>
parents: 25427
diff changeset
810 if (purple_request_field_get_type(fld) == PURPLE_REQUEST_FIELD_ACCOUNT &&
8a46d5528c3c Plug a leak of an account dropdown selection dialog or two.
Paul Aurich <paul@darkrain42.org>
parents: 25427
diff changeset
811 purple_request_field_is_visible(fld))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
813 const char *type_hint = purple_request_field_get_type_hint(fld);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 if (type_hint != NULL && strcmp(type_hint, "account") == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 {
25328
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
816 optmenu = GTK_WIDGET(purple_request_field_get_ui_data(fld));
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
817 if (optmenu == NULL) {
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
818 optmenu = GTK_WIDGET(create_account_field(fld));
27483
8a46d5528c3c Plug a leak of an account dropdown selection dialog or two.
Paul Aurich <paul@darkrain42.org>
parents: 25427
diff changeset
819 purple_request_field_set_ui_data(fld, optmenu);
25328
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
820 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 }
18667
b256b4808a6b Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@gmail.com>
parents: 18620
diff changeset
825 pidgin_setup_screenname_autocomplete_with_filter(entry, optmenu, pidgin_screenname_autocomplete_default_filter, GINT_TO_POINTER(!strcmp(type_hint, "screenname-all")));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
831 create_string_field(PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 const char *value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834 GtkWidget *widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
836 value = purple_request_field_string_get_default_value(field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
838 if (purple_request_field_string_is_multiline(field))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840 GtkWidget *textview;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842 textview = gtk_text_view_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844 TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846 GTK_WRAP_WORD_CHAR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
847
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
848 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck"))
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
849 pidgin_setup_gtkspell(GTK_TEXT_VIEW(textview));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851 gtk_widget_show(textview);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 if (value != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855 GtkTextBuffer *buffer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 gtk_text_buffer_set_text(buffer, value, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
861
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
862 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
863 gtk_widget_set_tooltip_text(textview, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
864 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
865
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
867 purple_request_field_string_is_editable(field));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
868
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869 g_signal_connect(G_OBJECT(textview), "focus-out-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
870 G_CALLBACK(field_string_focus_out_cb), field);
29290
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
871
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
872 if (purple_request_field_is_required(field))
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
873 {
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
874 GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
875 g_signal_connect(G_OBJECT(buffer), "changed",
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
876 G_CALLBACK(req_entry_field_changed_cb), field);
03705a4f3dc0 gtkrequest: Handle a multiline text field being set as required properly.
Paul Aurich <paul@darkrain42.org>
parents: 28852
diff changeset
877 }
31816
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
878
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
879 widget = pidgin_make_scrollable(textview, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, 75);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883 widget = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 setup_entry_field(widget, field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 if (value != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 gtk_entry_set_text(GTK_ENTRY(widget), value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
890 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
891 gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
892 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
893
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
894 if (purple_request_field_string_is_masked(field))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 gtk_entry_set_visibility(GTK_ENTRY(widget), FALSE);
24987
17b840986607 GTK+ 2.16.0 will set the invisible character to a nice bullet instead of
Mark Doliner <mark@kingant.net>
parents: 24497
diff changeset
897 #if !GTK_CHECK_VERSION(2,16,0)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 if (gtk_entry_get_invisible_char(GTK_ENTRY(widget)) == '*')
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
899 gtk_entry_set_invisible_char(GTK_ENTRY(widget), PIDGIN_INVISIBLE_CHAR);
24987
17b840986607 GTK+ 2.16.0 will set the invisible character to a nice bullet instead of
Mark Doliner <mark@kingant.net>
parents: 24497
diff changeset
900 #endif /* Less than GTK+ 2.16 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 gtk_editable_set_editable(GTK_EDITABLE(widget),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
904 purple_request_field_string_is_editable(field));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 g_signal_connect(G_OBJECT(widget), "focus-out-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 G_CALLBACK(field_string_focus_out_cb), field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 return widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
914 create_int_field(PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 int value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 GtkWidget *widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 widget = gtk_entry_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 setup_entry_field(widget, field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
923 value = purple_request_field_int_get_default_value(field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 if (value != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 char buf[32];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 g_snprintf(buf, sizeof(buf), "%d", value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 gtk_entry_set_text(GTK_ENTRY(widget), buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
934 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
935 gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
936 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
937
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 g_signal_connect(G_OBJECT(widget), "focus-out-event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 G_CALLBACK(field_int_focus_out_cb), field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 return widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
945 create_bool_field(PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 GtkWidget *widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 widget = gtk_check_button_new_with_label(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
950 purple_request_field_get_label(field));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
952 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
953 gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
954 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
955
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
957 purple_request_field_bool_get_default_value(field));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 g_signal_connect(G_OBJECT(widget), "toggled",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 G_CALLBACK(field_bool_cb), field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
961
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962 return widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
966 create_choice_field(PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 GtkWidget *widget;
24497
f10aba5592c6 The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
969 GList *labels = purple_request_field_choice_get_labels(field);
f10aba5592c6 The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
970 int num_labels = g_list_length(labels);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972
24497
f10aba5592c6 The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
973 if (num_labels > 5)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 {
29804
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
975 widget = gtk_combo_box_new_text();
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
976
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
977 for (l = labels; l != NULL; l = l->next)
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
978 {
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
979 const char *text = l->data;
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
980 gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text);
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
981 }
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
982
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
983 gtk_combo_box_set_active(GTK_COMBO_BOX(widget),
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
984 purple_request_field_choice_get_default_value(field));
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
985
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
986 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
987 gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
988 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
989
29804
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
990 g_signal_connect(G_OBJECT(widget), "changed",
93876452633b Pull in GtkComboBox changes from GTK+3 branch.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29742
diff changeset
991 G_CALLBACK(field_choice_menu_cb), field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 GtkWidget *box;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 GtkWidget *first_radio = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 GtkWidget *radio;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 gint i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999
24497
f10aba5592c6 The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1000 if (num_labels == 2)
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
1001 box = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 box = gtk_vbox_new(FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 widget = box;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1007 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1008 gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1009 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1010
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 for (l = labels, i = 0; l != NULL; l = l->next, i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 const char *text = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 radio = gtk_radio_button_new_with_label_from_widget(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 GTK_RADIO_BUTTON(first_radio), text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 if (first_radio == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019 first_radio = radio;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1021 if (i == purple_request_field_choice_get_default_value(field))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1024 gtk_box_pack_start(GTK_BOX(box), radio, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025 gtk_widget_show(radio);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 g_signal_connect(G_OBJECT(radio), "toggled",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1028 G_CALLBACK(field_choice_option_cb), field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1032 return widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1036 create_image_field(PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1037 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 GtkWidget *widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039 GdkPixbuf *buf, *scale;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1040
32138
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
1041 buf = pidgin_pixbuf_from_data(
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
1042 (const guchar *)purple_request_field_image_get_buffer(field),
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
1043 purple_request_field_image_get_size(field));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045 scale = gdk_pixbuf_scale_simple(buf,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1046 purple_request_field_image_get_scale_x(field) * gdk_pixbuf_get_width(buf),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1047 purple_request_field_image_get_scale_y(field) * gdk_pixbuf_get_height(buf),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 GDK_INTERP_BILINEAR);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 widget = gtk_image_new_from_pixbuf(scale);
32138
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
1050 g_object_unref(G_OBJECT(buf));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 g_object_unref(G_OBJECT(scale));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1053 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1054 gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1055 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1056
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 return widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1061 create_account_field(PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 GtkWidget *widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1065 widget = pidgin_account_option_menu_new(
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1066 purple_request_field_account_get_default_value(field),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1067 purple_request_field_account_get_show_all(field),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 G_CALLBACK(field_account_cb),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1069 purple_request_field_account_get_filter(field),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071
32304
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1072 #if GTK_CHECK_VERSION(2,12,0)
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1073 gtk_widget_set_tooltip_text(widget, purple_request_field_get_tooltip(field));
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1074 #endif
a88631af0f5e Add API: purple_request_field_set_tooltip & purple_request_field_get_tooltip
andrew.victor@mxit.com
parents: 31817
diff changeset
1075
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 return widget;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080 select_field_list_item(GtkTreeModel *model, GtkTreePath *path,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 GtkTreeIter *iter, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1083 PurpleRequestField *field = (PurpleRequestField *)data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084 char *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 gtk_tree_model_get(model, iter, 1, &text, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1088 purple_request_field_list_add_selected(field, text);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1093 list_field_select_changed_cb(GtkTreeSelection *sel, PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1095 purple_request_field_list_clear_selected(field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097 gtk_tree_selection_selected_foreach(sel, select_field_list_item, field);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 static GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1101 create_list_field(PurpleRequestField *field)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 GtkWidget *treeview;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104 GtkListStore *store;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 GtkCellRenderer *renderer;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 GtkTreeViewColumn *column;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1108 GtkTreeIter iter;
18118
ab6d2763b8d8 Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents: 18068
diff changeset
1109 GList *l;
29814
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1110 GList *icons = NULL;
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1111
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1112 icons = purple_request_field_list_get_icons(field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115 /* Create the list store */
29814
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1116 if (icons)
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1117 store = gtk_list_store_new(3, G_TYPE_POINTER, G_TYPE_STRING, GDK_TYPE_PIXBUF);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1118 else
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1119 store = gtk_list_store_new(2, G_TYPE_POINTER, G_TYPE_STRING);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121 /* Create the tree view */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
22087
d943df776c09 It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21913
diff changeset
1123 g_object_unref(G_OBJECT(store));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1128 if (purple_request_field_list_get_multi_select(field))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 column = gtk_tree_view_column_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134 renderer = gtk_cell_renderer_text_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135 gtk_tree_view_column_pack_start(column, renderer, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136 gtk_tree_view_column_add_attribute(column, renderer, "text", 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137
29814
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1138 if (icons)
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1139 {
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1140 renderer = gtk_cell_renderer_pixbuf_new();
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1141 gtk_tree_view_column_pack_start(column, renderer, TRUE);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1142 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", 2);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1143
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1144 gtk_widget_set_size_request(treeview, 200, 400);
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1145 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1146
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1147 for (l = purple_request_field_list_get_items(field); l != NULL; l = l->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 const char *text = (const char *)l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 gtk_list_store_append(store, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152
29814
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1153 if (icons)
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1154 {
29814
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1155 const char *icon_path = (const char *)icons->data;
29820
245f3432a5ab Avoid trying to build a filename and pixbuf if there's no image filename.
Richard Laager <rlaager@wiktel.com>
parents: 29814
diff changeset
1156 GdkPixbuf* pixbuf = NULL;
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1157
29820
245f3432a5ab Avoid trying to build a filename and pixbuf if there's no image filename.
Richard Laager <rlaager@wiktel.com>
parents: 29814
diff changeset
1158 if (icon_path)
32138
e2c6e4fc3c84 Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents: 31817
diff changeset
1159 pixbuf = pidgin_pixbuf_new_from_file(icon_path);
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1160
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1161 gtk_list_store_set(store, &iter,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1162 0, purple_request_field_list_get_data(field, text),
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1163 1, text,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1164 2, pixbuf,
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1165 -1);
29814
2d04fb25c6db Revert the unnecessary addition of the pixbuf boolean to PurpleRequestField.list
Richard Laager <rlaager@wiktel.com>
parents: 29812
diff changeset
1166 icons = icons->next;
29812
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1167 }
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1168 else
365b90fa23cf This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22790
diff changeset
1169 gtk_list_store_set(store, &iter,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1170 0, purple_request_field_list_get_data(field, text),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1171 1, text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1174 if (purple_request_field_list_is_selected(field, text))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 gtk_tree_selection_select_iter(sel, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177
18757
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1178 /*
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1179 * We only want to catch changes made by the user, so it's important
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1180 * that we wait until after the list is created to connect this
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1181 * handler. If we connect the handler before the loop above and
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1182 * there are multiple items selected, then selecting the first iter
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1183 * in the tree causes list_field_select_changed_cb to be triggered
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1184 * which clears out the rest of the list of selected items.
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1185 */
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1186 g_signal_connect(G_OBJECT(sel), "changed",
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1187 G_CALLBACK(list_field_select_changed_cb), field);
d54fecfe6bf7 Fix a bug with multi-field selections in Pidgin's implementation of
Mark Doliner <mark@kingant.net>
parents: 18667
diff changeset
1188
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189 gtk_widget_show(treeview);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190
31816
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
1191 return pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1194 static void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1195 pidgin_request_fields(const char *title, const char *primary,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1196 const char *secondary, PurpleRequestFields *fields,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 const char *ok_text, GCallback ok_cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 const char *cancel_text, GCallback cancel_cb,
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16198
diff changeset
1199 PurpleAccount *account, const char *who, PurpleConversation *conv,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1200 void *user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1201 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1202 PidginRequestData *data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1203 GtkWidget *win;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1204 GtkWidget *vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1205 GtkWidget *vbox2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206 GtkWidget *hbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1207 GtkWidget *frame;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1208 GtkWidget *label;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209 GtkWidget *table;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210 GtkWidget *button;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211 GtkWidget *img;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212 GtkSizeGroup *sg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 GList *gl, *fl;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1214 PurpleRequestFieldGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1215 PurpleRequestField *field;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 char *label_text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217 char *primary_esc, *secondary_esc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218 int total_fields = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1220 data = g_new0(PidginRequestData, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1221 data->type = PURPLE_REQUEST_FIELDS;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1222 data->user_data = user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223 data->u.multifield.fields = fields;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224
32453
91e431815449 Fix build breakage introduced by 756598e4c0c17510d74152d8f495204deb003620.
andrew.victor@mxit.com
parents: 32310
diff changeset
1225 purple_request_fields_set_ui_data(fields, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1227 data->cb_count = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228 data->cbs = g_new0(GCallback, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230 data->cbs[0] = ok_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231 data->cbs[1] = cancel_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232
19408
cc36a5aac908 Fix some conversion warnings about using negative values with unsigned types. There are more, but these were easy fixes. You may think that I'm changing the API, but I'm really not - it was just wrong.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19228
diff changeset
1233
16624
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
1234 #ifdef _WIN32
21646
2a2496044eef Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21563
diff changeset
1235 data->dialog = win = pidgin_create_dialog(PIDGIN_ALERT_TITLE, PIDGIN_HIG_BORDER, "multifield", TRUE) ;
17166
92c3c2eeba87 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 16831
diff changeset
1236 #else /* !_WIN32 */
21646
2a2496044eef Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21563
diff changeset
1237 data->dialog = win = pidgin_create_dialog(title, PIDGIN_HIG_BORDER, "multifield", TRUE) ;
17166
92c3c2eeba87 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 16831
diff changeset
1238 #endif /* _WIN32 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1240 g_signal_connect(G_OBJECT(win), "delete_event",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241 G_CALLBACK(destroy_multifield_cb), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243 /* Setup the main horizontal box */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
1244 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
21646
2a2496044eef Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21563
diff changeset
1245 gtk_container_add(GTK_CONTAINER(pidgin_dialog_get_vbox(GTK_DIALOG(win))), hbox);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 gtk_widget_show(hbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 /* Dialog icon. */
15436
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1249 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
9c0cf4db1f4d Dialog icon changes
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1250 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253 gtk_widget_show(img);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254
22761
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1255 /* Cancel button */
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1256 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data);
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1257 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1258
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1259 /* OK button */
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1260 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data);
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1261 data->ok_button = button;
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1262 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1263 gtk_window_set_default(GTK_WINDOW(win), button);
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1264
28852
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
1265 pidgin_widget_decorate_account(hbox, account);
a09c91dd7659 Show a little prpl icon in request dialogs, when possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 27483
diff changeset
1266
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 /* Setup the vbox */
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
1268 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
19228
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1269 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 gtk_widget_show(vbox);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274 if(primary) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1275 primary_esc = g_markup_escape_text(primary, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1276 label_text = g_strdup_printf(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1277 "<span weight=\"bold\" size=\"larger\">%s</span>", primary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1278 g_free(primary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1281 gtk_label_set_markup(GTK_LABEL(label), label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1284 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1285 gtk_widget_show(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1286 g_free(label_text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1287 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1288
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1289 for (gl = purple_request_fields_get_groups(fields); gl != NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 gl = gl->next)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1291 total_fields += g_list_length(purple_request_field_group_get_fields(gl->data));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 if(total_fields > 9) {
19228
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1294 GtkWidget *hbox_for_spacing, *vbox_for_spacing;
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1295
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1296 hbox_for_spacing = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
31816
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
1297 gtk_box_pack_start(GTK_BOX(vbox),
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
1298 pidgin_make_scrollable(hbox_for_spacing, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, 200),
917c597beb97 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31534
diff changeset
1299 TRUE, TRUE, 0);
19228
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1300 gtk_widget_show(hbox_for_spacing);
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1301
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1302 vbox_for_spacing = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1303 gtk_box_pack_start(GTK_BOX(hbox_for_spacing),
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1304 vbox_for_spacing, TRUE, TRUE, PIDGIN_HIG_BOX_SPACE);
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1305 gtk_widget_show(vbox_for_spacing);
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1306
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
1307 vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
19228
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1308 gtk_box_pack_start(GTK_BOX(vbox_for_spacing),
7131e5699991 Two changes here
Mark Doliner <mark@kingant.net>
parents: 18757
diff changeset
1309 vbox2, TRUE, TRUE, PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1310 gtk_widget_show(vbox2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1312 vbox2 = vbox;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1314
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1315 if (secondary) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1316 secondary_esc = g_markup_escape_text(secondary, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317 label = gtk_label_new(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1319 gtk_label_set_markup(GTK_LABEL(label), secondary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1320 g_free(secondary_esc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1321 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1322 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1323 gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1324 gtk_widget_show(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1325 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1326
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1327 for (gl = purple_request_fields_get_groups(fields);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328 gl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1329 gl = gl->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1330 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1331 GList *field_list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1332 size_t field_count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333 size_t cols = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1334 size_t rows;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335 size_t col_num;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336 size_t row_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1338 group = gl->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1339 field_list = purple_request_field_group_get_fields(group);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1340
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1341 if (purple_request_field_group_get_title(group) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1343 frame = pidgin_make_frame(vbox2,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1344 purple_request_field_group_get_title(group));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1345 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 frame = vbox2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 field_count = g_list_length(field_list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1350 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1351 if (field_count > 9)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1352 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353 rows = field_count / 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1354 cols++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358 rows = field_count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1360 col_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1361
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1362 for (fl = field_list; fl != NULL; fl = fl->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1363 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1364 PurpleRequestFieldType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1365
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1366 field = (PurpleRequestField *)fl->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1367
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1368 type = purple_request_field_get_type(field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1369
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1370 if (type == PURPLE_REQUEST_FIELD_LABEL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1372 if (col_num > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373 rows++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375 rows++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1376 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1377 else if ((type == PURPLE_REQUEST_FIELD_LIST) ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1378 (type == PURPLE_REQUEST_FIELD_STRING &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1379 purple_request_field_string_is_multiline(field)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1380 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1381 if (col_num > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1382 rows++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384 rows += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387 col_num++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 if (col_num >= cols)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1390 col_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1391 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 table = gtk_table_new(rows, 2 * cols, FALSE);
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
1394 gtk_table_set_row_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE);
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15514
diff changeset
1395 gtk_table_set_col_spacings(GTK_TABLE(table), PIDGIN_HIG_BOX_SPACE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1396
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1397 gtk_container_add(GTK_CONTAINER(frame), table);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1398 gtk_widget_show(table);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1399
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1400 for (row_num = 0, fl = field_list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1401 row_num < rows && fl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 row_num++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1404 for (col_num = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1405 col_num < cols && fl != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 col_num++, fl = fl->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 size_t col_offset = col_num * 2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1409 PurpleRequestFieldType type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 GtkWidget *widget = NULL;
22790
862382aa6086 Do not add a ':' if there's already one at the end. Thanks to wjt for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22761
diff changeset
1411 const char *field_label;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413 label = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414 field = fl->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1415
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1416 if (!purple_request_field_is_visible(field)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417 col_num--;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1421 type = purple_request_field_get_type(field);
22790
862382aa6086 Do not add a ':' if there's already one at the end. Thanks to wjt for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22761
diff changeset
1422 field_label = purple_request_field_get_label(field);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423
22790
862382aa6086 Do not add a ':' if there's already one at the end. Thanks to wjt for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22761
diff changeset
1424 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && field_label)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1425 {
22790
862382aa6086 Do not add a ':' if there's already one at the end. Thanks to wjt for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22761
diff changeset
1426 char *text = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427
22790
862382aa6086 Do not add a ':' if there's already one at the end. Thanks to wjt for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22761
diff changeset
1428 if (field_label[strlen(field_label) - 1] != ':')
862382aa6086 Do not add a ':' if there's already one at the end. Thanks to wjt for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22761
diff changeset
1429 text = g_strdup_printf("%s:", field_label);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 label = gtk_label_new(NULL);
22790
862382aa6086 Do not add a ':' if there's already one at the end. Thanks to wjt for
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22761
diff changeset
1432 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text ? text : field_label);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1434
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437 gtk_size_group_add_widget(sg, label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1439 if (type == PURPLE_REQUEST_FIELD_LABEL ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1440 type == PURPLE_REQUEST_FIELD_LIST ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1441 (type == PURPLE_REQUEST_FIELD_STRING &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1442 purple_request_field_string_is_multiline(field)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1443 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1444 if(col_num > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 row_num++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 gtk_table_attach_defaults(GTK_TABLE(table), label,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 0, 2 * cols,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 row_num, row_num + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 row_num++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 col_num=cols;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1453 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1455 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1456 gtk_table_attach_defaults(GTK_TABLE(table), label,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 col_offset, col_offset + 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 row_num, row_num + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1461 gtk_widget_show(label);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463
25328
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1464 widget = GTK_WIDGET(purple_request_field_get_ui_data(field));
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1465 if (widget == NULL)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1466 {
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1467 if (type == PURPLE_REQUEST_FIELD_STRING)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1468 widget = create_string_field(field);
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1469 else if (type == PURPLE_REQUEST_FIELD_INTEGER)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1470 widget = create_int_field(field);
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1471 else if (type == PURPLE_REQUEST_FIELD_BOOLEAN)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1472 widget = create_bool_field(field);
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1473 else if (type == PURPLE_REQUEST_FIELD_CHOICE)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1474 widget = create_choice_field(field);
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1475 else if (type == PURPLE_REQUEST_FIELD_LIST)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1476 widget = create_list_field(field);
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1477 else if (type == PURPLE_REQUEST_FIELD_IMAGE)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1478 widget = create_image_field(field);
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1479 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT)
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1480 widget = create_account_field(field);
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1481 else
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1482 continue;
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1483 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 if (label)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486 gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1488 if (type == PURPLE_REQUEST_FIELD_STRING &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1489 purple_request_field_string_is_multiline(field))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491 gtk_table_attach(GTK_TABLE(table), widget,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492 0, 2 * cols,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 row_num, row_num + 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 5, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1498 else if (type == PURPLE_REQUEST_FIELD_LIST)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500 gtk_table_attach(GTK_TABLE(table), widget,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 0, 2 * cols,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 row_num, row_num + 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505 5, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1507 else if (type == PURPLE_REQUEST_FIELD_BOOLEAN)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 gtk_table_attach(GTK_TABLE(table), widget,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510 col_offset, col_offset + 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 row_num, row_num + 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 5, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518 gtk_table_attach(GTK_TABLE(table), widget,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 1, 2 * cols,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 row_num, row_num + 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1522 GTK_FILL | GTK_EXPAND,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1523 5, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1524 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526 gtk_widget_show(widget);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527
25328
5d681e194fb3 Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents: 22790
diff changeset
1528 purple_request_field_set_ui_data(field, widget);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1529 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1531 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1532
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1533 g_object_unref(sg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1535 if (!purple_request_fields_all_required_filled(fields))
22761
d6220093543b A newly created widget for a request field may want to enable/disable the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22136
diff changeset
1536 gtk_widget_set_sensitive(data->ok_button, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1537
21888
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
1538 pidgin_auto_parent_window(win);
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
1539
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1540 gtk_widget_show(win);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 return data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1545 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1546 file_yes_no_cb(PidginRequestData *data, gint id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 /* Only call the callback if yes was selected, otherwise the request
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549 * (eg. file transfer) will be cancelled, then when a new filename is chosen
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 * things go BOOM */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 if (id == 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 if (data->cbs[1] != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1553 ((PurpleRequestFileCb)data->cbs[1])(data->user_data, data->u.file.name);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1554 purple_request_close(data->type, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 } else {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1556 pidgin_clear_cursor(GTK_WIDGET(data->dialog));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560 static void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1561 file_ok_check_if_exists_cb(GtkWidget *widget, gint response, PidginRequestData *data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 gchar *current_folder;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1565 generic_response_start(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1567 if (response != GTK_RESPONSE_ACCEPT) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568 if (data->cbs[0] != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1569 ((PurpleRequestFileCb)data->cbs[0])(data->user_data, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1570 purple_request_close(data->type, data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 data->u.file.name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(data->dialog));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 current_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(data->dialog));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576 if (current_folder != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577 if (data->u.file.savedialog) {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
1578 purple_prefs_set_path(PIDGIN_PREFS_ROOT "/filelocations/last_save_folder", current_folder);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579 } else {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
1580 purple_prefs_set_path(PIDGIN_PREFS_ROOT "/filelocations/last_open_folder", current_folder);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1581 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 g_free(current_folder);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584 if ((data->u.file.savedialog == TRUE) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585 (g_file_test(data->u.file.name, G_FILE_TEST_EXISTS))) {
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1586 purple_request_action(data, NULL, _("That file already exists"),
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16198
diff changeset
1587 _("Would you like to overwrite it?"), 0,
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16198
diff changeset
1588 NULL, NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1589 data, 2,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590 _("Overwrite"), G_CALLBACK(file_yes_no_cb),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591 _("Choose New Name"), G_CALLBACK(file_yes_no_cb));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593 file_yes_no_cb(data, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596 static void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1597 pidgin_request_file(const char *title, const char *filename,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598 gboolean savedialog,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599 GCallback ok_cb, GCallback cancel_cb,
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16198
diff changeset
1600 PurpleAccount *account, const char *who, PurpleConversation *conv,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1601 void *user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1602 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1603 PidginRequestData *data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1604 GtkWidget *filesel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1605 const gchar *current_folder;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606 gboolean folder_set = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1608 data = g_new0(PidginRequestData, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1609 data->type = PURPLE_REQUEST_FILE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1610 data->user_data = user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1611 data->cb_count = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1612 data->cbs = g_new0(GCallback, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1613 data->cbs[0] = cancel_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614 data->cbs[1] = ok_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615 data->u.file.savedialog = savedialog;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 filesel = gtk_file_chooser_dialog_new(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618 title ? title : (savedialog ? _("Save File...")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 : _("Open File...")),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 savedialog ? GTK_FILE_CHOOSER_ACTION_SAVE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 : GTK_FILE_CHOOSER_ACTION_OPEN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624 savedialog ? GTK_STOCK_SAVE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 : GTK_STOCK_OPEN,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 GTK_RESPONSE_ACCEPT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 gtk_dialog_set_default_response(GTK_DIALOG(filesel), GTK_RESPONSE_ACCEPT);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630 if (savedialog) {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
1631 current_folder = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/filelocations/last_save_folder");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 } else {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
1633 current_folder = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/filelocations/last_open_folder");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1636 if ((filename != NULL) && (*filename != '\0')) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637 if (savedialog)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(filesel), filename);
16799
35b35ea1dce6 This fixes #412. Apparently gtk_file_chooser_set_filename() doesn't like it when the filename specified doesn't actually exist. This is a GTK+ bug, which I will report.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16681
diff changeset
1639 else if (g_file_test(filename, G_FILE_TEST_EXISTS))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(filesel), filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641 }
16609
0bad106a6c24 disapproval of revision '46c593524f745e1ed42ad75ba71d614c660ef52f'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16608
diff changeset
1642 if ((filename == NULL || *filename == '\0' || !g_file_test(filename, G_FILE_TEST_EXISTS)) &&
0bad106a6c24 disapproval of revision '46c593524f745e1ed42ad75ba71d614c660ef52f'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16608
diff changeset
1643 (current_folder != NULL) && (*current_folder != '\0')) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644 folder_set = gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filesel), current_folder);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 #ifdef _WIN32
16831
fd620cbc5149 Additional fix for another crash similar to #412.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16799
diff changeset
1648 if (!folder_set && (filename == NULL || *filename == '\0' || !g_file_test(filename, G_FILE_TEST_EXISTS))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1649 char *my_documents = wpurple_get_special_folder(CSIDL_PERSONAL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651 if (my_documents != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 gtk_file_chooser_set_current_folder(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 GTK_FILE_CHOOSER(filesel), my_documents);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655 g_free(my_documents);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1656 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1657 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1658
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1659 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660 g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(filesel)), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1661 G_CALLBACK(file_ok_check_if_exists_cb), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1662
21888
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
1663 pidgin_auto_parent_window(filesel);
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
1664
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665 data->dialog = filesel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666 gtk_widget_show(filesel);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1668 return (void *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1669 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1670
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1671 static void *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1672 pidgin_request_folder(const char *title, const char *dirname,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1673 GCallback ok_cb, GCallback cancel_cb,
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16198
diff changeset
1674 PurpleAccount *account, const char *who, PurpleConversation *conv,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1675 void *user_data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1676 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1677 PidginRequestData *data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1678 GtkWidget *dirsel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1679
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1680 data = g_new0(PidginRequestData, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1681 data->type = PURPLE_REQUEST_FOLDER;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682 data->user_data = user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683 data->cb_count = 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1684 data->cbs = g_new0(GCallback, 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1685 data->cbs[0] = cancel_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1686 data->cbs[1] = ok_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1687 data->u.file.savedialog = FALSE;
16624
bb039b61f16e Prevent request dialog titles being "pidgin.exe".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 16442
diff changeset
1688
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689 dirsel = gtk_file_chooser_dialog_new(
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690 title ? title : _("Select Folder..."),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1694 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1695 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696 gtk_dialog_set_default_response(GTK_DIALOG(dirsel), GTK_RESPONSE_ACCEPT);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1698 if ((dirname != NULL) && (*dirname != '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1699 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dirsel), dirname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1700
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1701 g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(dirsel)), "response",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 G_CALLBACK(file_ok_check_if_exists_cb), data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1704 data->dialog = dirsel;
21888
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
1705 pidgin_auto_parent_window(dirsel);
c88a3f2dbb52 Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21652
diff changeset
1706
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1707 gtk_widget_show(dirsel);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1709 return (void *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1710 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1713 pidgin_close_request(PurpleRequestType type, void *ui_handle)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1714 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1715 PidginRequestData *data = (PidginRequestData *)ui_handle;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717 g_free(data->cbs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719 gtk_widget_destroy(data->dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1720
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1721 if (type == PURPLE_REQUEST_FIELDS)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1722 purple_request_fields_destroy(data->u.multifield.fields);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1723 else if (type == PURPLE_REQUEST_FILE)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1724 g_free(data->u.file.name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1727 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1729 static PurpleRequestUiOps ops =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1730 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1731 pidgin_request_input,
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1732 pidgin_request_choice,
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1733 pidgin_request_action,
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1734 pidgin_request_fields,
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1735 pidgin_request_file,
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1736 pidgin_close_request,
16681
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16656
diff changeset
1737 pidgin_request_folder,
30205
d0588e403877 Show thumbnail in ft request dialog
Marcus Lundblad <ml@update.uu.se>
parents: 25427
diff changeset
1738 pidgin_request_action_with_icon,
16681
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16656
diff changeset
1739 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16656
diff changeset
1740 NULL,
fbf111436896 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16656
diff changeset
1741 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15822
diff changeset
1744 PurpleRequestUiOps *
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15436
diff changeset
1745 pidgin_request_get_ui_ops(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1747 return &ops;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 }