Mercurial > pidgin.yaz
comparison pidgin/minidialog.c @ 30909:25e200cb3532
propagate from branch 'im.pidgin.pidgin' (head dca20e09164518b0f7a773edd7e9649f41d8873d)
to branch 'im.pidgin.cpw.malu.xmpp.google_refactor' (head 7823c556f2d1bbca43f5ef9f0fea30cabc5d313f)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Tue, 31 Aug 2010 18:28:10 +0000 |
parents | c62fac7ada0d |
children | cfcd275dd227 |
comparison
equal
deleted
inserted
replaced
30908:c44ec533a48c | 30909:25e200cb3532 |
---|---|
73 enum | 73 enum |
74 { | 74 { |
75 PROP_TITLE = 1, | 75 PROP_TITLE = 1, |
76 PROP_DESCRIPTION, | 76 PROP_DESCRIPTION, |
77 PROP_ICON_NAME, | 77 PROP_ICON_NAME, |
78 PROP_CUSTOM_ICON, | |
78 | 79 |
79 LAST_PROPERTY | 80 LAST_PROPERTY |
80 } HazeConnectionProperties; | 81 } HazeConnectionProperties; |
81 | 82 |
82 typedef struct _PidginMiniDialogPrivate | 83 typedef struct _PidginMiniDialogPrivate |
91 } PidginMiniDialogPrivate; | 92 } PidginMiniDialogPrivate; |
92 | 93 |
93 #define PIDGIN_MINI_DIALOG_GET_PRIVATE(dialog) \ | 94 #define PIDGIN_MINI_DIALOG_GET_PRIVATE(dialog) \ |
94 ((PidginMiniDialogPrivate *) ((dialog)->priv)) | 95 ((PidginMiniDialogPrivate *) ((dialog)->priv)) |
95 | 96 |
97 static PidginMiniDialog * | |
98 mini_dialog_new(const gchar *title, const gchar *description) | |
99 { | |
100 return g_object_new(PIDGIN_TYPE_MINI_DIALOG, | |
101 "title", title, | |
102 "description", description, | |
103 NULL); | |
104 } | |
105 | |
96 PidginMiniDialog * | 106 PidginMiniDialog * |
97 pidgin_mini_dialog_new(const gchar *title, | 107 pidgin_mini_dialog_new(const gchar *title, |
98 const gchar *description, | 108 const gchar *description, |
99 const gchar *icon_name) | 109 const gchar *icon_name) |
100 { | 110 { |
101 PidginMiniDialog *mini_dialog = g_object_new(PIDGIN_TYPE_MINI_DIALOG, | 111 PidginMiniDialog *mini_dialog = mini_dialog_new(title, description); |
102 "title", title, | 112 pidgin_mini_dialog_set_icon_name(mini_dialog, icon_name); |
103 "description", description, | 113 return mini_dialog; |
104 "icon-name", icon_name, | 114 } |
105 NULL); | 115 |
106 | 116 PidginMiniDialog * |
117 pidgin_mini_dialog_new_with_custom_icon(const gchar *title, | |
118 const gchar *description, | |
119 GdkPixbuf *custom_icon) | |
120 { | |
121 PidginMiniDialog *mini_dialog = mini_dialog_new(title, description); | |
122 pidgin_mini_dialog_set_custom_icon(mini_dialog, custom_icon); | |
107 return mini_dialog; | 123 return mini_dialog; |
108 } | 124 } |
109 | 125 |
110 void | 126 void |
111 pidgin_mini_dialog_set_title(PidginMiniDialog *mini_dialog, | 127 pidgin_mini_dialog_set_title(PidginMiniDialog *mini_dialog, |
123 | 139 |
124 void | 140 void |
125 pidgin_mini_dialog_set_icon_name(PidginMiniDialog *mini_dialog, | 141 pidgin_mini_dialog_set_icon_name(PidginMiniDialog *mini_dialog, |
126 const char *icon_name) | 142 const char *icon_name) |
127 { | 143 { |
128 g_object_set(G_OBJECT(mini_dialog), "icon_name", icon_name, NULL); | 144 g_object_set(G_OBJECT(mini_dialog), "icon-name", icon_name, NULL); |
145 } | |
146 | |
147 void | |
148 pidgin_mini_dialog_set_custom_icon(PidginMiniDialog *mini_dialog, GdkPixbuf *custom_icon) | |
149 { | |
150 g_object_set(G_OBJECT(mini_dialog), "custom-icon", custom_icon, NULL); | |
129 } | 151 } |
130 | 152 |
131 struct _mini_dialog_button_clicked_cb_data | 153 struct _mini_dialog_button_clicked_cb_data |
132 { | 154 { |
133 PidginMiniDialog *mini_dialog; | 155 PidginMiniDialog *mini_dialog; |
231 GtkIconSize size; | 253 GtkIconSize size; |
232 gtk_image_get_stock(priv->icon, &icon_name, &size); | 254 gtk_image_get_stock(priv->icon, &icon_name, &size); |
233 g_value_set_string(value, icon_name); | 255 g_value_set_string(value, icon_name); |
234 break; | 256 break; |
235 } | 257 } |
258 case PROP_CUSTOM_ICON: | |
259 g_value_set_object(value, gtk_image_get_pixbuf(priv->icon)); | |
260 break; | |
236 default: | 261 default: |
237 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | 262 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); |
238 } | 263 } |
239 } | 264 } |
240 | 265 |
303 break; | 328 break; |
304 case PROP_ICON_NAME: | 329 case PROP_ICON_NAME: |
305 gtk_image_set_from_stock(priv->icon, g_value_get_string(value), | 330 gtk_image_set_from_stock(priv->icon, g_value_get_string(value), |
306 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); | 331 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
307 break; | 332 break; |
333 case PROP_CUSTOM_ICON: | |
334 gtk_image_set_from_pixbuf(priv->icon, g_value_get_object(value)); | |
308 default: | 335 default: |
309 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | 336 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); |
310 } | 337 } |
311 } | 338 } |
312 | 339 |
353 "String specifying the Gtk stock name of the dialog's icon", | 380 "String specifying the Gtk stock name of the dialog's icon", |
354 NULL, | 381 NULL, |
355 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | | 382 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | |
356 G_PARAM_READWRITE); | 383 G_PARAM_READWRITE); |
357 g_object_class_install_property (object_class, PROP_ICON_NAME, param_spec); | 384 g_object_class_install_property (object_class, PROP_ICON_NAME, param_spec); |
385 | |
386 param_spec = g_param_spec_object("custom-icon", "custom-icon", | |
387 "Pixbuf to use as the dialog's icon", | |
388 GDK_TYPE_PIXBUF, | |
389 G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | | |
390 G_PARAM_READWRITE); | |
391 g_object_class_install_property (object_class, PROP_CUSTOM_ICON, param_spec); | |
358 } | 392 } |
359 | 393 |
360 /* 16 is the width of the icon, due to PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL */ | 394 /* 16 is the width of the icon, due to PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL */ |
361 #define BLIST_WIDTH_OTHER_THAN_LABEL \ | 395 #define BLIST_WIDTH_OTHER_THAN_LABEL \ |
362 ((PIDGIN_HIG_BOX_SPACE * 3) + 16) | 396 ((PIDGIN_HIG_BOX_SPACE * 3) + 16) |