Mercurial > pidgin.yaz
annotate pidgin/minidialog.c @ 21715:dc3b920b27d0
NSS is in the pkg-config package 'microb-engine-nss' on maemo, not 'nss' or
'mozilla-nss'. (microb-engine-nss will only be tried if the other two names
are not found.)
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Mon, 03 Dec 2007 14:40:46 +0000 |
parents | 5123f25788f2 |
children | aa4810065b91 |
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 | 27 #include "internal.h" |
28 | |
21402
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
29 #include <gtk/gtkhbox.h> |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
30 #include <gtk/gtkbutton.h> |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
31 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
32 #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
|
33 |
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/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
|
35 #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
|
36 #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
|
37 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
38 G_DEFINE_TYPE (PidginMiniDialog, pidgin_mini_dialog, GTK_TYPE_VBOX) |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
39 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
40 enum |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
41 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
42 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
|
43 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
|
44 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
|
45 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
46 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
|
47 } HazeConnectionProperties; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
48 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
49 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
|
50 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 |
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
|
57 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
|
58 } PidginMiniDialogPrivate; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
59 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
60 #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
|
61 ((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
|
62 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
63 PidginMiniDialog * |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
64 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
|
65 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
|
66 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
|
67 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
68 PidginMiniDialog *mini_dialog = g_object_new(PIDGIN_TYPE_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
|
69 "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
|
70 "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
|
71 "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
|
72 NULL); |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
73 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
74 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
|
75 } |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
76 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
77 void |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
78 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
|
79 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
|
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 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
|
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 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
84 void |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
85 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
|
86 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
|
87 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
88 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
|
89 } |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
90 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
91 void |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
92 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
|
93 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
|
94 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
95 g_object_set(G_OBJECT(mini_dialog), "icon_name", 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
|
96 } |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
97 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
98 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
|
99 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
100 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
|
101 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
|
102 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
|
103 }; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
104 |
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
|
105 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
|
106 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
|
107 { |
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
|
108 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
|
109 } |
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
|
110 |
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
|
111 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
|
112 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
|
113 { |
7e07f5b271e5
Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21403
diff
changeset
|
114 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
|
115 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
|
116 } |
7e07f5b271e5
Use an idle callback to destroy PidginMiniDialogs when a button is pressed.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21403
diff
changeset
|
117 |
21402
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
118 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
|
119 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
|
120 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
|
121 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 |
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
|
126 /* 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
|
127 * 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
|
128 * 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
|
129 */ |
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
|
130 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
|
131 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
|
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 data->callback(data->mini_dialog, button, 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
|
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 } |
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 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
|
138 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
|
139 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
|
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 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
|
142 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
|
143 } |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
144 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
145 void |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
146 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
|
147 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
|
148 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
|
149 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
|
150 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
151 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
|
152 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
|
153 = 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
|
154 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
|
155 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
|
156 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
|
157 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
|
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 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
|
160 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
|
161 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
162 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
|
163 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
|
164 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
|
165 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
|
166 (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
|
167 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
|
168 (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
|
169 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
170 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
|
171 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
|
172 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
173 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
|
174 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
|
175 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
|
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 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
184 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
|
185 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
|
186 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
187 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
|
188 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
|
189 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
|
190 break; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
191 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
|
192 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
|
193 break; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
194 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
|
195 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
196 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
|
197 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
|
198 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
|
199 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
|
200 break; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
201 } |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
202 default: |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
203 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
|
204 } |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
205 } |
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 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
|
208 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
|
209 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
|
210 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
211 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
|
212 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
213 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
|
214 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
|
215 "<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
|
216 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
|
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 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
|
219 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
220 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
|
221 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
|
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 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
224 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
|
225 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
|
226 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
|
227 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
228 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
|
229 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
|
230 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
231 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
|
232 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
|
233 "<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
|
234 |
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
|
235 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
|
236 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
237 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
|
238 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
|
239 |
21412
2f818256ae62
Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21409
diff
changeset
|
240 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
|
241 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
|
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 else |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
244 { |
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
|
245 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
|
246 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
|
247 /* 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
|
248 * 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
|
249 */ |
21415
5203f3836da5
Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents:
21414
diff
changeset
|
250 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
|
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 } |
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 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
260 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
|
261 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
|
262 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
263 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
|
264 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
|
265 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
|
266 break; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
267 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
|
268 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
|
269 break; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
270 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
|
271 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
|
272 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
|
273 break; |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
274 default: |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
275 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
|
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 } |
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 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
|
280 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
|
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 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
|
283 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
|
284 |
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
|
285 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
|
286 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
|
287 |
21402
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
288 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
|
289 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
|
290 |
21417
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
291 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
|
292 |
21402
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
293 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
|
294 } |
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 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
|
297 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
|
298 { |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
299 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
|
300 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
|
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 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
|
303 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
|
304 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
|
305 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
306 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
|
307 "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
|
308 #if GTK_CHECK_VERSION(2,8,0) |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
309 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
|
310 #endif |
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_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
|
312 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
|
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 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
|
315 "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
|
316 #if GTK_CHECK_VERSION(2,8,0) |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
317 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
|
318 #endif |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
319 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
|
320 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
|
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 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
|
323 "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
|
324 NULL, |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
325 #if GTK_CHECK_VERSION(2,8,0) |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
326 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
|
327 #endif |
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_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
|
329 g_object_class_install_property (object_class, PROP_ICON_NAME, 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
|
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 |
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
|
332 /* 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
|
333 #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
|
334 ((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
|
335 |
21417
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
336 #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
|
337 (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
|
338 |
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
339 static void |
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
340 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
|
341 PurplePrefType type, |
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
342 gconstpointer val, |
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
343 gpointer data) |
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
344 { |
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
345 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
|
346 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
|
347 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
|
348 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
|
349 |
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
350 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
|
351 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
|
352 } |
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 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
|
355 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
|
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 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
|
358 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
|
359 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
|
360 |
21402
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
361 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
|
362 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
|
363 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
364 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
|
365 |
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
|
366 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
|
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 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
|
369 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
|
370 |
21412
2f818256ae62
Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21409
diff
changeset
|
371 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
|
372 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
|
373 gtk_label_set_line_wrap(priv->title, TRUE); |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
374 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
|
375 |
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
|
376 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
|
377 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
|
378 |
21412
2f818256ae62
Remove a redundant hbox around PidginMiniDialog's description label.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21409
diff
changeset
|
379 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
|
380 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
|
381 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
|
382 gtk_misc_set_alignment(GTK_MISC(priv->desc), 0, 0); |
21415
5203f3836da5
Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents:
21414
diff
changeset
|
383 /* 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
|
384 * 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
|
385 */ |
5203f3836da5
Really actually hide the description label inside a minidialog, even when
Will Thompson <will.thompson@collabora.co.uk>
parents:
21414
diff
changeset
|
386 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
|
387 |
21417
21bea7c72a80
Make mini-dialogs follow the blist's size changes.
Will Thompson <will.thompson@collabora.co.uk>
parents:
21415
diff
changeset
|
388 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
|
389 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
|
390 |
21402
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
391 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
|
392 |
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
|
393 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
|
394 |
0f029f9a75e1
Make PidginMiniDialog do more things right when used as a GtkContainer. _add,
Will Thompson <will.thompson@collabora.co.uk>
parents:
21402
diff
changeset
|
395 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
|
396 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
|
397 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
|
398 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
|
399 |
9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <will.thompson@collabora.co.uk>
parents:
diff
changeset
|
400 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
|
401 } |