Mercurial > pidgin.yaz
comparison pidgin/minidialog.c @ 21414:c972c9311221
De-magic-number (and correct) the width request of PidginMiniDialog's labels.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Mon, 05 Nov 2007 01:39:39 +0000 |
parents | 2f818256ae62 |
children | 5203f3836da5 |
comparison
equal
deleted
inserted
replaced
21413:ccceac5e1976 | 21414:c972c9311221 |
---|---|
305 #endif | 305 #endif |
306 G_PARAM_READWRITE); | 306 G_PARAM_READWRITE); |
307 g_object_class_install_property (object_class, PROP_ICON_NAME, param_spec); | 307 g_object_class_install_property (object_class, PROP_ICON_NAME, param_spec); |
308 } | 308 } |
309 | 309 |
310 /* 16 is the width of the icon, due to PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL */ | |
311 #define BLIST_WIDTH_OTHER_THAN_LABEL \ | |
312 ((PIDGIN_HIG_BOX_SPACE * 3) + 16) | |
313 | |
310 static void | 314 static void |
311 pidgin_mini_dialog_init(PidginMiniDialog *self) | 315 pidgin_mini_dialog_init(PidginMiniDialog *self) |
312 { | 316 { |
313 GtkBox *self_box = GTK_BOX(self); | 317 GtkBox *self_box = GTK_BOX(self); |
318 guint blist_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width"); | |
319 guint label_width = blist_width - BLIST_WIDTH_OTHER_THAN_LABEL; | |
314 | 320 |
315 PidginMiniDialogPrivate *priv = g_new0(PidginMiniDialogPrivate, 1); | 321 PidginMiniDialogPrivate *priv = g_new0(PidginMiniDialogPrivate, 1); |
316 self->priv = priv; | 322 self->priv = priv; |
317 | 323 |
318 gtk_container_set_border_width(GTK_CONTAINER(self), PIDGIN_HIG_BOX_SPACE); | 324 gtk_container_set_border_width(GTK_CONTAINER(self), PIDGIN_HIG_BOX_SPACE); |
321 | 327 |
322 priv->icon = GTK_IMAGE(gtk_image_new()); | 328 priv->icon = GTK_IMAGE(gtk_image_new()); |
323 gtk_misc_set_alignment(GTK_MISC(priv->icon), 0, 0); | 329 gtk_misc_set_alignment(GTK_MISC(priv->icon), 0, 0); |
324 | 330 |
325 priv->title = GTK_LABEL(gtk_label_new(NULL)); | 331 priv->title = GTK_LABEL(gtk_label_new(NULL)); |
326 /* TODO: update this request when /blist/width updates. Also, 25 is | 332 /* TODO: update this request when /blist/width updates. */ |
327 * magic. | 333 gtk_widget_set_size_request(GTK_WIDGET(priv->title), label_width, -1); |
328 */ | |
329 gtk_widget_set_size_request(GTK_WIDGET(priv->title), | |
330 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25, -1); | |
331 gtk_label_set_line_wrap(priv->title, TRUE); | 334 gtk_label_set_line_wrap(priv->title, TRUE); |
332 gtk_misc_set_alignment(GTK_MISC(priv->title), 0, 0); | 335 gtk_misc_set_alignment(GTK_MISC(priv->title), 0, 0); |
333 | 336 |
334 gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->icon), FALSE, FALSE, 0); | 337 gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->icon), FALSE, FALSE, 0); |
335 gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->title), TRUE, TRUE, 0); | 338 gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->title), TRUE, TRUE, 0); |
336 | 339 |
337 priv->desc = GTK_LABEL(gtk_label_new(NULL)); | 340 priv->desc = GTK_LABEL(gtk_label_new(NULL)); |
338 /* TODO: update this request when /blist/width updates. Also, 25 is | 341 /* TODO: update this request when /blist/width updates. */ |
339 * magic. | 342 gtk_widget_set_size_request(GTK_WIDGET(priv->desc), label_width, -1); |
340 */ | |
341 gtk_widget_set_size_request(GTK_WIDGET(priv->desc), | |
342 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25, -1); | |
343 gtk_label_set_line_wrap(priv->desc, TRUE); | 343 gtk_label_set_line_wrap(priv->desc, TRUE); |
344 gtk_misc_set_alignment(GTK_MISC(priv->desc), 0, 0); | 344 gtk_misc_set_alignment(GTK_MISC(priv->desc), 0, 0); |
345 | 345 |
346 self->contents = GTK_BOX(gtk_vbox_new(FALSE, 0)); | 346 self->contents = GTK_BOX(gtk_vbox_new(FALSE, 0)); |
347 | 347 |