Merge lp:~ted/indicator-messages/avatar-spacing into lp:indicator-messages/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~ted/indicator-messages/avatar-spacing
Merge into: lp:indicator-messages/0.5
Diff against target: 56 lines (+13/-6)
1 file modified
src/indicator-messages.c (+13/-6)
To merge this branch: bzr merge lp:~ted/indicator-messages/avatar-spacing
Reviewer Review Type Date Requested Status
Cody Russell (community) Approve
Review via email: mp+21612@code.launchpad.net

Description of the change

Fixing the avatars to have the same spacing as the other items. And, in
the case of missing avatars, to align them as if there was an avatar
there.

To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator-messages.c'
2--- src/indicator-messages.c 2010-02-18 03:36:33 +0000
3+++ src/indicator-messages.c 2010-03-18 04:25:26 +0000
4@@ -278,17 +278,24 @@
5
6 GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new());
7
8- GtkWidget * hbox = gtk_hbox_new(FALSE, 4);
9+ gint padding = 4;
10+ gtk_widget_style_get(GTK_WIDGET(gmi), "horizontal-padding", &padding, NULL);
11+
12+ GtkWidget * hbox = gtk_hbox_new(FALSE, 0);
13
14 /* Icon, probably someone's face or avatar on an IM */
15 mi_data->icon = gtk_image_new();
16+
17+ /* Set the minimum size, we always want it to take space */
18+ gint width, height;
19+ gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
20+ gtk_widget_set_size_request(mi_data->icon, width, height);
21+
22 GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(newitem, INDICATOR_MENUITEM_PROP_ICON);
23 if (pixbuf != NULL) {
24 /* If we've got a pixbuf we need to make sure it's of a reasonable
25 size to fit in the menu. If not, rescale it. */
26 GdkPixbuf * resized_pixbuf;
27- gint width, height;
28- gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
29 if (gdk_pixbuf_get_width(pixbuf) > width ||
30 gdk_pixbuf_get_height(pixbuf) > height) {
31 g_debug("Resizing icon from %dx%d to %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), width, height);
32@@ -309,13 +316,13 @@
33 }
34 }
35 gtk_misc_set_alignment(GTK_MISC(mi_data->icon), 0.0, 0.5);
36- gtk_box_pack_start(GTK_BOX(hbox), mi_data->icon, FALSE, FALSE, 0);
37+ gtk_box_pack_start(GTK_BOX(hbox), mi_data->icon, FALSE, FALSE, padding);
38 gtk_widget_show(mi_data->icon);
39
40 /* Label, probably a username, chat room or mailbox name */
41 mi_data->label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, INDICATOR_MENUITEM_PROP_LABEL));
42 gtk_misc_set_alignment(GTK_MISC(mi_data->label), 0.0, 0.5);
43- gtk_box_pack_start(GTK_BOX(hbox), mi_data->label, TRUE, TRUE, 0);
44+ gtk_box_pack_start(GTK_BOX(hbox), mi_data->label, TRUE, TRUE, padding);
45 gtk_widget_show(mi_data->label);
46
47 /* Usually either the time or the count on the individual
48@@ -323,7 +330,7 @@
49 mi_data->right = gtk_label_new(dbusmenu_menuitem_property_get(newitem, INDICATOR_MENUITEM_PROP_RIGHT));
50 gtk_size_group_add_widget(indicator_right_group, mi_data->right);
51 gtk_misc_set_alignment(GTK_MISC(mi_data->right), 1.0, 0.5);
52- gtk_box_pack_start(GTK_BOX(hbox), mi_data->right, FALSE, FALSE, 0);
53+ gtk_box_pack_start(GTK_BOX(hbox), mi_data->right, FALSE, FALSE, padding);
54 gtk_widget_show(mi_data->right);
55
56 gtk_container_add(GTK_CONTAINER(gmi), hbox);

Subscribers

People subscribed via source and target branches

to all changes: