diff --git a/panel-plugin/datetime.c b/panel-plugin/datetime.c index 181c273..c75ca64 100644 --- a/panel-plugin/datetime.c +++ b/panel-plugin/datetime.c @@ -605,16 +605,24 @@ static void datetime_set_orientation(XfcePanelPlugin *plugin, GtkOrientation ori 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); - gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->time_label, 0); - gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->date_label, 1); } else { 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); - gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->date_label, 0); - gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->time_label, 1); + } + /* set order based on layout-selection */ + switch(datetime->layout) + { + case LAYOUT_TIME_DATE: + gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->time_label, 0); + gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->date_label, 1); + break; + + default: + gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->time_label, 1); + gtk_box_reorder_child(GTK_BOX(datetime->box), datetime->date_label, 0); } } @@ -623,9 +631,6 @@ static void datetime_set_orientation(XfcePanelPlugin *plugin, GtkOrientation ori */ static void datetime_create_widget(t_datetime * datetime) { - GtkOrientation orientation; - orientation = xfce_panel_plugin_get_orientation(datetime->plugin); - /* create button */ datetime->button = xfce_create_panel_toggle_button(); gtk_widget_show(datetime->button); @@ -651,13 +656,6 @@ static void datetime_create_widget(t_datetime * datetime) /* connect widget signals to functions */ g_signal_connect(datetime->button, "button-press-event", G_CALLBACK(datetime_clicked), datetime); - - /* set orientation according to the panel orientation */ -#ifdef HAS_PANEL_49 - datetime_set_mode(datetime->plugin, orientation, datetime); -#else - datetime_set_orientation(datetime->plugin, orientation, datetime); -#endif } /* @@ -666,6 +664,7 @@ static void datetime_create_widget(t_datetime * datetime) static t_datetime * datetime_new(XfcePanelPlugin *plugin) { t_datetime * datetime; + GtkOrientation orientation; DBG("Starting datetime panel plugin"); @@ -681,6 +680,14 @@ static t_datetime * datetime_new(XfcePanelPlugin *plugin) /* load settings (default values if non-av) */ datetime_read_rc_file(plugin, datetime); + /* set orientation according to the panel orientation */ + orientation = xfce_panel_plugin_get_orientation(datetime->plugin); +#ifdef HAS_PANEL_49 + datetime_set_mode(datetime->plugin, orientation, datetime); +#else + datetime_set_orientation(datetime->plugin, orientation, datetime); +#endif + /* set date and time labels */ datetime_update(datetime);