From 2c8ba4aff89ae9cd5978ff65a59ae3dc5930098a Mon Sep 17 00:00:00 2001 From: Harald Judt Date: Mon, 21 May 2012 12:22:52 +0200 Subject: Center align labels instead of stretching them across the panel. Stretching the labels apart looks really ugly on bigger panels, so simply align them to the center. --- panel-plugin/datetime.c | 10 +++++++--- panel-plugin/datetime.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/panel-plugin/datetime.c b/panel-plugin/datetime.c index aac90b2..c29e8c8 100644 --- a/panel-plugin/datetime.c +++ b/panel-plugin/datetime.c @@ -608,6 +608,7 @@ static void datetime_set_orientation(XfcePanelPlugin *plugin, GtkOrientation ori #endif if (orientation == GTK_ORIENTATION_VERTICAL) { + xfce_hvbox_set_orientation(XFCE_HVBOX(datetime->alignbox), GTK_ORIENTATION_HORIZONTAL); xfce_hvbox_set_orientation(XFCE_HVBOX(datetime->box), GTK_ORIENTATION_HORIZONTAL); gtk_label_set_angle(GTK_LABEL(datetime->time_label), -90); gtk_label_set_angle(GTK_LABEL(datetime->date_label), -90); @@ -616,6 +617,7 @@ static void datetime_set_orientation(XfcePanelPlugin *plugin, GtkOrientation ori } else { + xfce_hvbox_set_orientation(XFCE_HVBOX(datetime->alignbox), GTK_ORIENTATION_VERTICAL); xfce_hvbox_set_orientation(XFCE_HVBOX(datetime->box), GTK_ORIENTATION_VERTICAL); gtk_label_set_angle(GTK_LABEL(datetime->time_label), 0); gtk_label_set_angle(GTK_LABEL(datetime->date_label), 0); @@ -636,11 +638,13 @@ static void datetime_create_widget(t_datetime * datetime) datetime->button = xfce_create_panel_toggle_button(); gtk_widget_show(datetime->button); - /* create a box which can be easily adapted to the panel orientation */ + /* create alignment and content box which can be easily adapted to the panel orientation */ + datetime->alignbox = xfce_hvbox_new(GTK_ORIENTATION_VERTICAL, TRUE, 0); + gtk_widget_show(datetime->alignbox); + gtk_container_add(GTK_CONTAINER(datetime->button), datetime->alignbox); datetime->box = xfce_hvbox_new(GTK_ORIENTATION_VERTICAL, TRUE, 0); - gtk_widget_show(datetime->box); - gtk_container_add(GTK_CONTAINER(datetime->button), datetime->box); + gtk_container_add(GTK_CONTAINER(datetime->alignbox), datetime->box); /* create time and date lines */ datetime->time_label = gtk_label_new(""); diff --git a/panel-plugin/datetime.h b/panel-plugin/datetime.h index 73aa4ed..c59ba62 100644 --- a/panel-plugin/datetime.h +++ b/panel-plugin/datetime.h @@ -43,6 +43,7 @@ typedef enum typedef struct { XfcePanelPlugin * plugin; GtkWidget *button; + GtkWidget *alignbox; GtkWidget *box; GtkWidget *date_label; GtkWidget *time_label; -- 1.7.8.6