[PATCH] respect layout when setting mode/orientation
Submitted by j.w..@..il.com
Assigned to Xfce-Goodies Maintainers
Description
Created attachment 5180 respect layout when setting orientation
datetime_set_mode / datetime_set_orientation (datetime.c:594) reorder the children of the GTK box, but in a fixed order. This makes it impossible to use the "Time, then date" layout.
The attached patch moves the orientation-setting out of datetime_create_widget (so that we have time to read the configuration settings) and respects the layout.
Patch 5180, "respect layout when setting orientation":
datetime-layout.patch
Designs
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Author
j.w..@..il.com commented on patch 5180: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);
'datetime->plugin' can be replaced by just 'plugin'.
+#else
- datetime_set_orientation(datetime->plugin, orientation, datetime);
'datetime->plugin' can be replaced by just 'plugin'.
+#endif + /* set date and time labels */ datetime_update(datetime);
- Author
j.w..@..il.com submitted a patch:Patch 5182, "respect layout when setting mode/orientation":
datetime-layout.patch - Author
Landry Breuil@landry
said:Mass-reassign all bugs from florian@ to goodies-dev@, thanks for the maintenance work! (and sorry for the bugmail spam..)
- Author
Steve Dodier-Lazaro said:This bug was fixed on Git using a subset of the proposed patch (the switch part)
j.witteveen: if you still experience an issue, please could you explain why the orientation should be created outside the widget?
Thanks,
- Author
j.w..@..il.com said:I don't see any changes in git[1] that incorporate any of my patch? My patch was against 0.6.2. On my vertical deskbar panel, I need my patch in order to use the "Time, then date" layout directly when the panel first loads.
[1] http://git.xfce.org/panel-plugins/xfce4-datetime-plugin/
- Author
Steve Dodier-Lazaro said:Hm, I actually expected the second part should be for first-time loading, but I couldn't trigger a bug when I reloaded my panel.
Looking at git head, I see that the switch part is applied, and the other part was added at the end of datetime_create_widget?
- Author
j.w..@..il.com said:I don't see anything applied in git and the bug is still present.
Even though I have opted for "Time, then date", when the panel first loads, it displays the date before the time. My panel is in vertical deskbar mode.
- Gaël Bonithon added Patch label
added Patch label
- Gaël Bonithon marked this issue as related to #52 (closed)
marked this issue as related to #52 (closed)
- Gaël Bonithon marked #52 (closed) as a duplicate of this issue
marked #52 (closed) as a duplicate of this issue
- Maintainer
Clock works fine in this respect, closing as this plugin will be archived.
- Gaël Bonithon closed
closed
- Gaël Bonithon marked #37 (closed) as a duplicate of this issue
marked #37 (closed) as a duplicate of this issue
- Gaël Bonithon marked this issue as related to #37 (closed)
marked this issue as related to #37 (closed)