aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-04-18 09:09:39 -0500
committerTed Gould <ted@gould.cx>2011-04-18 09:09:39 -0500
commit7b878caf9f39ee8d8a799f6454e079e35fe2a962 (patch)
treedcb87a9b273c29da0600e05ba2f7f3eab5fb5ed4
parent9f48d2fd048cdac443fb6f9db5153f375ffc1bd9 (diff)
parent969771d64ab89a61a821420cb15f1bd04243c940 (diff)
downloadayatana-indicator-datetime-7b878caf9f39ee8d8a799f6454e079e35fe2a962.tar.gz
ayatana-indicator-datetime-7b878caf9f39ee8d8a799f6454e079e35fe2a962.tar.bz2
ayatana-indicator-datetime-7b878caf9f39ee8d8a799f6454e079e35fe2a962.zip
Ensuring the minimum width if there is no calendar.
-rw-r--r--src/indicator-datetime.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index a992507..eb4b695 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -1285,6 +1285,12 @@ new_appointment_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu
/* Label, probably a username, chat room or mailbox name */
mi_data->label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, APPOINTMENT_MENUITEM_PROP_LABEL));
gtk_misc_set_alignment(GTK_MISC(mi_data->label), 0.0, 0.5);
+
+ GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(mi_data->label));
+ PangoContext * context = gtk_widget_get_pango_context(GTK_WIDGET(mi_data->label));
+ gint length = measure_string(style, context, "MMMMMMMMMMMMMMM"); // 15 char wide string max
+ gtk_widget_set_size_request(GTK_WIDGET(mi_data->label), length, -1); // Set the min size in pixels
+
gtk_label_set_ellipsize(GTK_LABEL(mi_data->label), PANGO_ELLIPSIZE_END);
gtk_box_pack_start(GTK_BOX(hbox), mi_data->label, TRUE, TRUE, 0);
gtk_widget_show(mi_data->label);