annotate pidgin/minidialog.c @ 31037:c4d512212ae2

Let's make Ivan a developer!
author Mark Doliner <mark@kingant.net>
date Wed, 13 Oct 2010 02:25:50 +0000
parents c62fac7ada0d
children cfcd275dd227
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,
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
79
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
80 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
81 } HazeConnectionProperties;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
82
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
83 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
84 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
85 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
86 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
87 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
88 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
89 GtkBox *buttons;
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
90
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
91 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
92 } PidginMiniDialogPrivate;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
93
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
94 #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
95 ((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
96
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
97 static PidginMiniDialog *
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
98 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
99 {
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
100 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
101 "title", title,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
102 "description", description,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
103 NULL);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
104 }
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
105
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
106 PidginMiniDialog *
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
107 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
108 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
109 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
110 {
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
111 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
112 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
113 return mini_dialog;
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
114 }
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
115
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
116 PidginMiniDialog *
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
117 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
118 const gchar *description,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
119 GdkPixbuf *custom_icon)
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
120 {
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
121 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
122 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
123 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
124 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
125
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
126 void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
127 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
128 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
129 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
130 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
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
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
133 void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
134 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
135 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
136 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
137 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
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
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
140 void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
141 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
142 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
143 {
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
144 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
145 }
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
146
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
147 void
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
148 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
149 {
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
150 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
151 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
152
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
153 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
154 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
155 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
156 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
157 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
158 };
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
159
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
160 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
161 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
162 {
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
163 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
164 }
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
165
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
166 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
167 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
168 {
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
169 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
170 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
171 }
7e07f5b271e5 Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21403
diff changeset
172
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
173 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
174 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
175 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
176 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
177 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
178 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
179 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
180
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
181 /* Set up the destruction callback before calling the clicked callback,
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
182 * so that if the mini-dialog gets destroyed during the clicked callback
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
183 * the idle_destroy_cb is correctly removed by _finalize.
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
184 */
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
185 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
186 g_idle_add((GSourceFunc) idle_destroy_cb, data->mini_dialog);
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
187
22316
4345e7aaa7d4 Don't call NULL callbacks. Fixes #4901
Stu Tomlinson <stu@nosnilmot.com>
parents: 21926
diff changeset
188 if (data->callback != NULL)
4345e7aaa7d4 Don't call NULL callbacks. Fixes #4901
Stu Tomlinson <stu@nosnilmot.com>
parents: 21926
diff changeset
189 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
190
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
191 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
192
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
193 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
194 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
195 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
196 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
197 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
198 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
199 }
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 void
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
202 pidgin_mini_dialog_add_button(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
203 const char *text,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
204 PidginMiniDialogCallback 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
205 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
206 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
207 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
208 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
209 = 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
210 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
211 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
212 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
213 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
214
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
215 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
216 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
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 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
219 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
220 callback_data->user_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
221 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
222 (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
223 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
224 (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
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 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
227 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
228
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
229 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
230 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
231 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
232 }
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 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
235 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
236 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
237 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
238 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
239 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
240 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
241 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
242
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
243 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
244 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
245 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
246 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
247 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
248 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
249 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
250 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
251 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
252 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
253 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
254 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
255 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
256 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
257 }
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
258 case PROP_CUSTOM_ICON:
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
259 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
260 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
261 default:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
262 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
263 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
264 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
265
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
266 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
267 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
268 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
269 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
270 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
271
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
272 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
273 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
274 "<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
275 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
276
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
277 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
278
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
279 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
280 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
281 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
282
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
283 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
284 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
285 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
286 {
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 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
289 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
290 char *desc_esc = g_markup_escape_text(description, -1);
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
291 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
292 "<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
293
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 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
295
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
296 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
297 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
298
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
299 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
300 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
301 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
302 else
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
303 {
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
304 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
305 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
306 /* 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
307 * 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
308 */
21415
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
309 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
310 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
311 }
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 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
314 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
315 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
316 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
317 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
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 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
320 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
321
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
322 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
323 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
324 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
325 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
326 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
327 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
328 break;
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
329 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
330 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
331 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
332 break;
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
333 case PROP_CUSTOM_ICON:
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
334 gtk_image_set_from_pixbuf(priv->icon, g_value_get_object(value));
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
335 default:
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
336 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
337 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
338 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
339
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
340 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
341 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
342 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
343 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
344 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
345
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
346 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
347 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
348
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
349 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
350 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
351
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
352 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
353
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
354 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
355 }
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
356
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
357 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
358 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
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 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
361 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
362
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
363 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
364 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
365 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
366
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
367 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
368 "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
369 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
370 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
371 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
372
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
373 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
374 "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
375 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
376 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
377 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
378
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
379 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
380 "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
381 NULL,
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
382 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
383 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
384 g_object_class_install_property (object_class, PROP_ICON_NAME, param_spec);
30791
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
385
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
386 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
387 "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
388 GDK_TYPE_PIXBUF,
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
389 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
390 G_PARAM_READWRITE);
c62fac7ada0d Display the protocol icon for the authorization request dialog
ivan.komarov@soc.pidgin.im
parents: 29481
diff changeset
391 g_object_class_install_property (object_class, PROP_CUSTOM_ICON, 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
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
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
394 /* 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
395 #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
396 ((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
397
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
398 #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
399 (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
400
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
401 static void
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
402 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
403 PurplePrefType type,
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
404 gconstpointer val,
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
405 gpointer data)
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
406 {
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
407 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
408 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
409 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
410 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
411
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
412 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
413 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
414 }
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
415
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
416 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
417 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
418 {
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
419 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
420 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
421 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
422
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
423 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
424 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
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 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
427
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
428 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
429
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
430 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
431 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
432
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
433 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
434 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
435 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
436 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
437 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
438
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
439 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
440 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
441
21412
2f818256ae62 Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21409
diff changeset
442 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
443 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
444 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
445 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
446 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
447 /* 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
448 * 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
449 */
5203f3836da5 Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents: 21414
diff changeset
450 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
451
21417
21bea7c72a80 Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents: 21415
diff changeset
452 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
453 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
454
21402
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
455 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
456
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
457 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
458
0f029f9a75e1 Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents: 21402
diff changeset
459 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
460 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
461 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
462 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
463
9fef5d307a27 Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff changeset
464 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
465 }