annotate pidgin/minidialog.c @ 32027:182d7b49236c

Oops, forgot to checkin the header changes that go along with the previous two changes.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 09 May 2011 07:02:44 +0000
parents 1551c9a140fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
1 /**
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
2 * @file minidialog.c Implementation of the #PidginMiniDialog Gtk widget.
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
3 * @ingroup pidgin
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
4 */
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
5
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
6 /* pidgin
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
7 *
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
10 * source distribution.
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
11 *
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
15 * (at your option) any later version.
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
16 *
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
20 * GNU General Public License for more details.
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
21 *
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
25 */
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
26
21432
4acd6a71b0ef Fix build.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21417
diff changeset
27 #include "internal.h"
4acd6a71b0ef Fix build.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21417
diff changeset
28
26588
1a94a964bddf More updates for GTK+ 3.0. This only fixes the single-includes. Fixing all
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 22699
diff changeset
29 #include <gtk/gtk.h>
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
30
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
31 #include "libpurple/prefs.h"
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
32
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
33 #include "pidgin/minidialog.h"
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
34 #include "pidgin/pidgin.h"
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
35 #include "pidgin/pidginstock.h"
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
36
21849
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
37 static void pidgin_mini_dialog_init (PidginMiniDialog *self);
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
38 static void pidgin_mini_dialog_class_init (PidginMiniDialogClass *klass);
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
39
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
40 static gpointer pidgin_mini_dialog_parent_class = NULL;
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
41
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
42 static void
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
43 pidgin_mini_dialog_class_intern_init (gpointer klass)
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
44 {
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
45 pidgin_mini_dialog_parent_class = g_type_class_peek_parent (klass);
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
46 pidgin_mini_dialog_class_init ((PidginMiniDialogClass*) klass);
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
47 }
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
48
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
49 GType
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
50 pidgin_mini_dialog_get_type (void)
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
51 {
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
52 static GType g_define_type_id = 0;
22491
566a805a5bd4 G_UNLIKELY is new in Glib 2.2 and resiak said this wasn't important here
Stu Tomlinson <stu@nosnilmot.com>
parents: 22316
diff changeset
53 if (g_define_type_id == 0)
21849
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
54 {
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
55 static const GTypeInfo g_define_type_info = {
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
56 sizeof (PidginMiniDialogClass),
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
57 (GBaseInitFunc) NULL,
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
58 (GBaseFinalizeFunc) NULL,
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
59 (GClassInitFunc) pidgin_mini_dialog_class_intern_init,
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
60 (GClassFinalizeFunc) NULL,
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
61 NULL, /* class_data */
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
62 sizeof (PidginMiniDialog),
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
63 0, /* n_preallocs */
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
64 (GInstanceInitFunc) pidgin_mini_dialog_init,
21926
9d45eb679bdd Compile warning fix
Stu Tomlinson <stu@nosnilmot.com>
parents: 21849
diff changeset
65 NULL,
21849
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
66 };
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
67 g_define_type_id = g_type_register_static (GTK_TYPE_VBOX,
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
68 "PidginMiniDialog", &g_define_type_info, 0);
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
69 }
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
70 return g_define_type_id;
aa4810065b91 Manually expand G_DEFINE_TYPE for PidginMiniDialog, since it was added in glib 2.4.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21519
diff changeset
71 }
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
72
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
73 enum
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
74 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
75 PROP_TITLE = 1,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
76 PROP_DESCRIPTION,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
77 PROP_ICON_NAME,
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
78 PROP_CUSTOM_ICON,
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
79 PROP_ENABLE_DESCRIPTION_MARKUP,
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
80
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
81 LAST_PROPERTY
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
82 } HazeConnectionProperties;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
83
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
84 typedef struct _PidginMiniDialogPrivate
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
85 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
86 GtkImage *icon;
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
87 GtkBox *title_box;
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
88 GtkLabel *title;
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
89 GtkLabel *desc;
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
90 GtkBox *buttons;
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
91 gboolean enable_description_markup;
21519
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
92
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
93 guint idle_destroy_cb_id;
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
94 } PidginMiniDialogPrivate;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
95
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
96 #define PIDGIN_MINI_DIALOG_GET_PRIVATE(dialog) \
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
97 ((PidginMiniDialogPrivate *) ((dialog)->priv))
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
98
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
99 static PidginMiniDialog *
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
100 mini_dialog_new(const gchar *title, const gchar *description)
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
101 {
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
102 return g_object_new(PIDGIN_TYPE_MINI_DIALOG,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
103 "title", title,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
104 "description", description,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
105 NULL);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
106 }
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
107
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
108 PidginMiniDialog *
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
109 pidgin_mini_dialog_new(const gchar *title,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
110 const gchar *description,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
111 const gchar *icon_name)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
112 {
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
113 PidginMiniDialog *mini_dialog = mini_dialog_new(title, description);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
114 pidgin_mini_dialog_set_icon_name(mini_dialog, icon_name);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
115 return mini_dialog;
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
116 }
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
117
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
118 PidginMiniDialog *
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
119 pidgin_mini_dialog_new_with_custom_icon(const gchar *title,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
120 const gchar *description,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
121 GdkPixbuf *custom_icon)
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
122 {
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
123 PidginMiniDialog *mini_dialog = mini_dialog_new(title, description);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
124 pidgin_mini_dialog_set_custom_icon(mini_dialog, custom_icon);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
125 return mini_dialog;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
126 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
127
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
128 void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
129 pidgin_mini_dialog_set_title(PidginMiniDialog *mini_dialog,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
130 const char *title)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
131 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
132 g_object_set(G_OBJECT(mini_dialog), "title", title, NULL);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
133 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
134
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
135 void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
136 pidgin_mini_dialog_set_description(PidginMiniDialog *mini_dialog,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
137 const char *description)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
138 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
139 g_object_set(G_OBJECT(mini_dialog), "description", description, NULL);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
140 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
141
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
142 void
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
143 pidgin_mini_dialog_enable_description_markup(PidginMiniDialog *mini_dialog)
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
144 {
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
145 g_object_set(G_OBJECT(mini_dialog), "enable-description-markup", TRUE, NULL);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
146 }
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
147
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
148 gboolean
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
149 pidgin_mini_dialog_links_supported()
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
150 {
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
151 #if GTK_CHECK_VERSION(2,18,0)
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
152 return TRUE;
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
153 #else
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
154 return FALSE;
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
155 #endif
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
156 }
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
157
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
158 void pidgin_mini_dialog_set_link_callback(PidginMiniDialog *mini_dialog, GCallback cb, gpointer user_data)
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
159 {
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
160 g_signal_connect(PIDGIN_MINI_DIALOG_GET_PRIVATE(mini_dialog)->desc, "activate-link", cb, user_data);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
161 }
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
162
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
163 void
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
164 pidgin_mini_dialog_set_icon_name(PidginMiniDialog *mini_dialog,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
165 const char *icon_name)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
166 {
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
167 g_object_set(G_OBJECT(mini_dialog), "icon-name", icon_name, NULL);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
168 }
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
169
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
170 void
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
171 pidgin_mini_dialog_set_custom_icon(PidginMiniDialog *mini_dialog, GdkPixbuf *custom_icon)
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
172 {
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
173 g_object_set(G_OBJECT(mini_dialog), "custom-icon", custom_icon, NULL);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
174 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
175
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
176 struct _mini_dialog_button_clicked_cb_data
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
177 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
178 PidginMiniDialog *mini_dialog;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
179 PidginMiniDialogCallback callback;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
180 gpointer user_data;
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
181 gboolean close_dialog_after_click;
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
182 };
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
183
21407
dc5012153bfa Add pidgin_mini_dialog_get_num_children(), a convenient way to check how many
Will Thompson <will.thompson@collabora.co.uk>
parents: 21406
diff changeset
184 guint
dc5012153bfa Add pidgin_mini_dialog_get_num_children(), a convenient way to check how many
Will Thompson <will.thompson@collabora.co.uk>
parents: 21406
diff changeset
185 pidgin_mini_dialog_get_num_children(PidginMiniDialog *mini_dialog)
dc5012153bfa Add pidgin_mini_dialog_get_num_children(), a convenient way to check how many
Will Thompson <will.thompson@collabora.co.uk>
parents: 21406
diff changeset
186 {
dc5012153bfa Add pidgin_mini_dialog_get_num_children(), a convenient way to check how many
Will Thompson <will.thompson@collabora.co.uk>
parents: 21406
diff changeset
187 return g_list_length(mini_dialog->contents->children);
dc5012153bfa Add pidgin_mini_dialog_get_num_children(), a convenient way to check how many
Will Thompson <will.thompson@collabora.co.uk>
parents: 21406
diff changeset
188 }
dc5012153bfa Add pidgin_mini_dialog_get_num_children(), a convenient way to check how many
Will Thompson <will.thompson@collabora.co.uk>
parents: 21406
diff changeset
189
21406
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
190 static gboolean
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
191 idle_destroy_cb(GtkWidget *mini_dialog)
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
192 {
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
193 gtk_widget_destroy(mini_dialog);
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
194 return FALSE;
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
195 }
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
196
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
197 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
198 mini_dialog_button_clicked_cb(GtkButton *button,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
199 gpointer user_data)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
200 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
201 struct _mini_dialog_button_clicked_cb_data *data = user_data;
21519
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
202 PidginMiniDialogPrivate *priv =
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
203 PIDGIN_MINI_DIALOG_GET_PRIVATE(data->mini_dialog);
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
204
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
205 if (data->close_dialog_after_click) {
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
206 /* Set up the destruction callback before calling the clicked callback,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
207 * so that if the mini-dialog gets destroyed during the clicked callback
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
208 * the idle_destroy_cb is correctly removed by _finalize.
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
209 */
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
210 priv->idle_destroy_cb_id =
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
211 g_idle_add((GSourceFunc) idle_destroy_cb, data->mini_dialog);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
212 }
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
213
22316
4345e7aaa7d4 Don't call NULL callbacks. Fixes #4901
Stu Tomlinson <stu@nosnilmot.com>
parents: 21926
diff changeset
214 if (data->callback != NULL)
4345e7aaa7d4 Don't call NULL callbacks. Fixes #4901
Stu Tomlinson <stu@nosnilmot.com>
parents: 21926
diff changeset
215 data->callback(data->mini_dialog, button, data->user_data);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
216
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
217 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
218
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
219 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
220 mini_dialog_button_destroy_cb(GtkButton *button,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
221 gpointer user_data)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
222 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
223 struct _mini_dialog_button_clicked_cb_data *data = user_data;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
224 g_free(data);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
225 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
226
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
227 static void
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
228 mini_dialog_add_button(PidginMiniDialog *self,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
229 const char *text,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
230 PidginMiniDialogCallback clicked_cb,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
231 gpointer user_data,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
232 gboolean close_dialog_after_click)
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
233 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
234 PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
235 struct _mini_dialog_button_clicked_cb_data *callback_data
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
236 = g_new0(struct _mini_dialog_button_clicked_cb_data, 1);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
237 GtkWidget *button = gtk_button_new();
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
238 GtkWidget *label = gtk_label_new(NULL);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
239 char *button_text =
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
240 g_strdup_printf("<span size=\"smaller\">%s</span>", text);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
241
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
242 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), button_text);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
243 g_free(button_text);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
244
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
245 callback_data->mini_dialog = self;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
246 callback_data->callback = clicked_cb;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
247 callback_data->user_data = user_data;
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
248 callback_data->close_dialog_after_click = close_dialog_after_click;
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
249 g_signal_connect(G_OBJECT(button), "clicked",
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
250 (GCallback) mini_dialog_button_clicked_cb, callback_data);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
251 g_signal_connect(G_OBJECT(button), "destroy",
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
252 (GCallback) mini_dialog_button_destroy_cb, callback_data);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
253
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
254 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
255 gtk_container_add(GTK_CONTAINER(button), label);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
256
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
257 gtk_box_pack_end(GTK_BOX(priv->buttons), button, FALSE, FALSE,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
258 0);
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
259 gtk_widget_show_all(GTK_WIDGET(button));
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
260 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
261
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
262 void
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
263 pidgin_mini_dialog_add_button(PidginMiniDialog *self,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
264 const char *text,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
265 PidginMiniDialogCallback clicked_cb,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
266 gpointer user_data)
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
267 {
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
268 mini_dialog_add_button(self, text, clicked_cb, user_data, TRUE);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
269 }
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
270
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
271 void
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
272 pidgin_mini_dialog_add_non_closing_button(PidginMiniDialog *self,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
273 const char *text,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
274 PidginMiniDialogCallback clicked_cb,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
275 gpointer user_data)
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
276 {
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
277 mini_dialog_add_button(self, text, clicked_cb, user_data, FALSE);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
278 }
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
279
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
280 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
281 pidgin_mini_dialog_get_property(GObject *object,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
282 guint property_id,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
283 GValue *value,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
284 GParamSpec *pspec)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
285 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
286 PidginMiniDialog *self = PIDGIN_MINI_DIALOG(object);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
287 PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
288
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
289 switch (property_id) {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
290 case PROP_TITLE:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
291 g_value_set_string(value, gtk_label_get_text(priv->title));
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
292 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
293 case PROP_DESCRIPTION:
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
294 g_value_set_string(value, gtk_label_get_text(priv->desc));
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
295 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
296 case PROP_ICON_NAME:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
297 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
298 gchar *icon_name = NULL;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
299 GtkIconSize size;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
300 gtk_image_get_stock(priv->icon, &icon_name, &size);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
301 g_value_set_string(value, icon_name);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
302 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
303 }
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
304 case PROP_CUSTOM_ICON:
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
305 g_value_set_object(value, gtk_image_get_pixbuf(priv->icon));
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
306 break;
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
307 case PROP_ENABLE_DESCRIPTION_MARKUP:
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
308 g_value_set_boolean(value, priv->enable_description_markup);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
309 break;
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
310 default:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
311 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
312 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
313 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
314
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
315 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
316 mini_dialog_set_title(PidginMiniDialog *self,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
317 const char *title)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
318 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
319 PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
320
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
321 char *title_esc = g_markup_escape_text(title, -1);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
322 char *title_markup = g_strdup_printf(
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
323 "<span weight=\"bold\" size=\"smaller\">%s</span>",
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
324 title_esc ? title_esc : "");
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
325
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
326 gtk_label_set_markup(priv->title, title_markup);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
327
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
328 g_free(title_esc);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
329 g_free(title_markup);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
330 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
331
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
332 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
333 mini_dialog_set_description(PidginMiniDialog *self,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
334 const char *description)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
335 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
336 PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
337 if(description)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
338 {
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
339 char *desc_esc = priv->enable_description_markup ? g_strdup(description) : g_markup_escape_text(description, -1);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
340 char *desc_markup = g_strdup_printf(
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
341 "<span size=\"smaller\">%s</span>", desc_esc);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
342
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
343 gtk_label_set_markup(priv->desc, desc_markup);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
344
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
345 g_free(desc_esc);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
346 g_free(desc_markup);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
347
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
348 gtk_widget_show(GTK_WIDGET(priv->desc));
21415
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
349 g_object_set(G_OBJECT(priv->desc), "no-show-all", FALSE, NULL);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
350 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
351 else
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
352 {
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
353 gtk_label_set_text(priv->desc, NULL);
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
354 gtk_widget_hide(GTK_WIDGET(priv->desc));
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
355 /* make calling show_all() on the minidialog not affect desc
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
356 * even though it's packed inside it.
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
357 */
21415
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
358 g_object_set(G_OBJECT(priv->desc), "no-show-all", TRUE, NULL);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
359 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
360 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
361
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
362 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
363 pidgin_mini_dialog_set_property(GObject *object,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
364 guint property_id,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
365 const GValue *value,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
366 GParamSpec *pspec)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
367 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
368 PidginMiniDialog *self = PIDGIN_MINI_DIALOG(object);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
369 PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
370
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
371 switch (property_id) {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
372 case PROP_TITLE:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
373 mini_dialog_set_title(self, g_value_get_string(value));
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
374 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
375 case PROP_DESCRIPTION:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
376 mini_dialog_set_description(self, g_value_get_string(value));
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
377 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
378 case PROP_ICON_NAME:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
379 gtk_image_set_from_stock(priv->icon, g_value_get_string(value),
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
380 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
381 break;
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
382 case PROP_CUSTOM_ICON:
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
383 gtk_image_set_from_pixbuf(priv->icon, g_value_get_object(value));
31073
cfcd275dd227 There seems to be a missing break here. I noticed it in the log, but
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30791
diff changeset
384 break;
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
385 case PROP_ENABLE_DESCRIPTION_MARKUP:
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
386 priv->enable_description_markup = g_value_get_boolean(value);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
387 break;
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
388 default:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
389 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
390 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
391 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
392
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
393 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
394 pidgin_mini_dialog_finalize(GObject *object)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
395 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
396 PidginMiniDialog *self = PIDGIN_MINI_DIALOG(object);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
397 PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
398
21519
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
399 if (priv->idle_destroy_cb_id)
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
400 g_source_remove(priv->idle_destroy_cb_id);
5123f25788f2 Don't crash when someone ignores an error. The mini-dialog was being
Will Thompson <will.thompson@collabora.co.uk>
parents: 21432
diff changeset
401
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
402 g_free(priv);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
403 self->priv = NULL;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
404
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
405 purple_prefs_disconnect_by_handle(self);
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
406
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
407 G_OBJECT_CLASS (pidgin_mini_dialog_parent_class)->finalize (object);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
408 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
409
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
410 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
411 pidgin_mini_dialog_class_init(PidginMiniDialogClass *klass)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
412 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
413 GObjectClass *object_class = G_OBJECT_CLASS(klass);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
414 GParamSpec *param_spec;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
415
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
416 object_class->get_property = pidgin_mini_dialog_get_property;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
417 object_class->set_property = pidgin_mini_dialog_set_property;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
418 object_class->finalize = pidgin_mini_dialog_finalize;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
419
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
420 param_spec = g_param_spec_string("title", "title",
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
421 "String specifying the mini-dialog's title", NULL,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
422 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
423 G_PARAM_READWRITE);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
424 g_object_class_install_property (object_class, PROP_TITLE, param_spec);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
425
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
426 param_spec = g_param_spec_string("description", "description",
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
427 "Description text for the mini-dialog, if desired", NULL,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
428 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
429 G_PARAM_READWRITE);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
430 g_object_class_install_property (object_class, PROP_DESCRIPTION, param_spec);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
431
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
432 param_spec = g_param_spec_string("icon-name", "icon-name",
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
433 "String specifying the Gtk stock name of the dialog's icon",
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
434 NULL,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
435 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
436 G_PARAM_READWRITE);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
437 g_object_class_install_property (object_class, PROP_ICON_NAME, param_spec);
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 31073
diff changeset
438
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
439 param_spec = g_param_spec_object("custom-icon", "custom-icon",
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
440 "Pixbuf to use as the dialog's icon",
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
441 GDK_TYPE_PIXBUF,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
442 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
443 G_PARAM_READWRITE);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
444 g_object_class_install_property (object_class, PROP_CUSTOM_ICON, param_spec);
31893
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
445
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
446 param_spec = g_param_spec_boolean("enable-description-markup", "enable-description-markup",
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
447 "Use GMarkup in the description text", FALSE,
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
448 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
449 G_PARAM_READWRITE);
1551c9a140fd Finally merged the code that fixes #5038 to i.p.p.
ivan.komarov@pidgin.im
parents: 31534
diff changeset
450 g_object_class_install_property (object_class, PROP_ENABLE_DESCRIPTION_MARKUP, param_spec);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
451 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
452
21414
c972c9311221 De-magic-number (and correct) the width request of PidginMiniDialog's labels.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21412
diff changeset
453 /* 16 is the width of the icon, due to PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL */
c972c9311221 De-magic-number (and correct) the width request of PidginMiniDialog's labels.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21412
diff changeset
454 #define BLIST_WIDTH_OTHER_THAN_LABEL \
c972c9311221 De-magic-number (and correct) the width request of PidginMiniDialog's labels.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21412
diff changeset
455 ((PIDGIN_HIG_BOX_SPACE * 3) + 16)
c972c9311221 De-magic-number (and correct) the width request of PidginMiniDialog's labels.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21412
diff changeset
456
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
457 #define BLIST_WIDTH_PREF \
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
458 (PIDGIN_PREFS_ROOT "/blist/width")
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
459
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
460 static void
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
461 blist_width_changed_cb(const char *name,
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
462 PurplePrefType type,
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
463 gconstpointer val,
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
464 gpointer data)
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
465 {
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
466 PidginMiniDialog *self = PIDGIN_MINI_DIALOG(data);
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
467 PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self);
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
468 guint blist_width = GPOINTER_TO_INT(val);
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
469 guint label_width = blist_width - BLIST_WIDTH_OTHER_THAN_LABEL;
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
470
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
471 gtk_widget_set_size_request(GTK_WIDGET(priv->title), label_width, -1);
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
472 gtk_widget_set_size_request(GTK_WIDGET(priv->desc), label_width, -1);
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
473 }
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
474
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
475 static void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
476 pidgin_mini_dialog_init(PidginMiniDialog *self)
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
477 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
478 GtkBox *self_box = GTK_BOX(self);
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
479 guint blist_width = purple_prefs_get_int(BLIST_WIDTH_PREF);
21414
c972c9311221 De-magic-number (and correct) the width request of PidginMiniDialog's labels.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21412
diff changeset
480 guint label_width = blist_width - BLIST_WIDTH_OTHER_THAN_LABEL;
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
481
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
482 PidginMiniDialogPrivate *priv = g_new0(PidginMiniDialogPrivate, 1);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
483 self->priv = priv;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
484
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
485 gtk_container_set_border_width(GTK_CONTAINER(self), PIDGIN_HIG_BOX_SPACE);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
486
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
487 priv->title_box = GTK_BOX(gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE));
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
488
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
489 priv->icon = GTK_IMAGE(gtk_image_new());
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
490 gtk_misc_set_alignment(GTK_MISC(priv->icon), 0, 0);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
491
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
492 priv->title = GTK_LABEL(gtk_label_new(NULL));
21414
c972c9311221 De-magic-number (and correct) the width request of PidginMiniDialog's labels.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21412
diff changeset
493 gtk_widget_set_size_request(GTK_WIDGET(priv->title), label_width, -1);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
494 gtk_label_set_line_wrap(priv->title, TRUE);
22699
7e5d7ebcd24e Make the labels in the minidialogs selectable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22491
diff changeset
495 gtk_label_set_selectable(priv->title, TRUE);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
496 gtk_misc_set_alignment(GTK_MISC(priv->title), 0, 0);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
497
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
498 gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->icon), FALSE, FALSE, 0);
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
499 gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->title), TRUE, TRUE, 0);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
500
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
501 priv->desc = GTK_LABEL(gtk_label_new(NULL));
21414
c972c9311221 De-magic-number (and correct) the width request of PidginMiniDialog's labels.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21412
diff changeset
502 gtk_widget_set_size_request(GTK_WIDGET(priv->desc), label_width, -1);
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
503 gtk_label_set_line_wrap(priv->desc, TRUE);
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
504 gtk_misc_set_alignment(GTK_MISC(priv->desc), 0, 0);
22699
7e5d7ebcd24e Make the labels in the minidialogs selectable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22491
diff changeset
505 gtk_label_set_selectable(priv->desc, TRUE);
21415
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
506 /* make calling show_all() on the minidialog not affect desc even though
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
507 * it's packed inside it.
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
508 */
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
509 g_object_set(G_OBJECT(priv->desc), "no-show-all", TRUE, NULL);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
510
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
511 purple_prefs_connect_callback(self, BLIST_WIDTH_PREF,
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
512 blist_width_changed_cb, self);
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
513
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
514 self->contents = GTK_BOX(gtk_vbox_new(FALSE, 0));
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
515
21403
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
516 priv->buttons = GTK_BOX(gtk_hbox_new(FALSE, 0));
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
517
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
518 gtk_box_pack_start(self_box, GTK_WIDGET(priv->title_box), FALSE, FALSE, 0);
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
519 gtk_box_pack_start(self_box, GTK_WIDGET(priv->desc), FALSE, FALSE, 0);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
520 gtk_box_pack_start(self_box, GTK_WIDGET(self->contents), TRUE, TRUE, 0);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
521 gtk_box_pack_start(self_box, GTK_WIDGET(priv->buttons), FALSE, FALSE, 0);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
522
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
523 gtk_widget_show_all(GTK_WIDGET(self));
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
524 }