[Xfce4-commits] [panel-plugins/xfce4-time-out-plugin] 02/02: React to panel "mode, " not "orientation" (Bug #15840)
noreply at xfce.org
noreply at xfce.org
Fri Oct 4 05:29:57 CEST 2019
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-time-out-plugin.
commit 06b07fb086d95f87a890e8cd7e507294c7d96c05
Author: Andre Miranda <andreldm at xfce.org>
Date: Fri Oct 4 00:27:59 2019 -0300
React to panel "mode," not "orientation" (Bug #15840)
Credits to Glen Whitney for the original patch
---
panel-plugin/time-out.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/panel-plugin/time-out.c b/panel-plugin/time-out.c
index c083b87..b6a2711 100644
--- a/panel-plugin/time-out.c
+++ b/panel-plugin/time-out.c
@@ -91,8 +91,8 @@ static void time_out_free (XfcePanelPlug
static gboolean time_out_size_changed (XfcePanelPlugin *plugin,
gint size,
TimeOutPlugin *time_out);
-static void time_out_orientation_changed (XfcePanelPlugin *plugin,
- GtkOrientation orientation,
+static void time_out_mode_changed (XfcePanelPlugin *plugin,
+ XfcePanelPluginMode mode,
TimeOutPlugin *time_out);
static void time_out_about (XfcePanelPlugin *plugin);
static void time_out_configure (XfcePanelPlugin *plugin,
@@ -189,7 +189,10 @@ time_out_new (XfcePanelPlugin *plugin)
g_signal_connect (G_OBJECT (time_out->lock_countdown), "finish", G_CALLBACK (time_out_lock_countdown_finish), time_out);
/* Get the current orientation */
- orientation = xfce_panel_plugin_get_orientation (plugin);
+ if (xfce_panel_plugin_get_mode (plugin) == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+ else
+ orientation = GTK_ORIENTATION_VERTICAL;
/* Create event box to catch user events */
time_out->ebox = gtk_event_box_new ();
@@ -296,7 +299,7 @@ time_out_construct (XfcePanelPlugin *plugin)
g_signal_connect (G_OBJECT (plugin), "free-data", G_CALLBACK (time_out_free), time_out);
g_signal_connect (G_OBJECT (plugin), "size-changed", G_CALLBACK (time_out_size_changed), time_out);
g_signal_connect (G_OBJECT (plugin), "configure-plugin", G_CALLBACK (time_out_configure), time_out);
- g_signal_connect (G_OBJECT (plugin), "orientation-changed", G_CALLBACK (time_out_orientation_changed), time_out);
+ g_signal_connect (G_OBJECT (plugin), "mode-changed", G_CALLBACK (time_out_mode_changed), time_out);
g_signal_connect (G_OBJECT (plugin), "about", G_CALLBACK (time_out_about), NULL);
/* Display the configure menu item */
@@ -378,14 +381,9 @@ time_out_size_changed (XfcePanelPlugin *plugin,
gint size,
TimeOutPlugin *time_out)
{
- GtkOrientation orientation;
-
g_return_val_if_fail (plugin != NULL, FALSE);
g_return_val_if_fail (time_out != NULL, FALSE);
- /* Get the orientation of the panel */
- orientation = xfce_panel_plugin_get_orientation (plugin);
-
/* Update icon size */
#if LIBXFCE4PANEL_CHECK_VERSION(4, 14, 0)
gtk_image_set_pixel_size (GTK_IMAGE (time_out->panel_icon),
@@ -395,7 +393,7 @@ time_out_size_changed (XfcePanelPlugin *plugin,
#endif
/* Update widget size */
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (xfce_panel_plugin_get_mode (plugin) == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, size);
else
gtk_widget_set_size_request (GTK_WIDGET (plugin), size, -1);
@@ -407,15 +405,18 @@ time_out_size_changed (XfcePanelPlugin *plugin,
static void
-time_out_orientation_changed (XfcePanelPlugin *plugin,
- GtkOrientation orientation,
- TimeOutPlugin *time_out)
+time_out_mode_changed (XfcePanelPlugin *plugin,
+ XfcePanelPluginMode mode,
+ TimeOutPlugin *time_out)
{
g_return_if_fail (plugin != NULL);
g_return_if_fail (time_out != NULL);
/* Apply orientation to hvbox */
- gtk_orientable_set_orientation(GTK_ORIENTABLE(time_out->hvbox), orientation);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE(time_out->hvbox),
+ mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL ?
+ GTK_ORIENTATION_HORIZONTAL :
+ GTK_ORIENTATION_VERTICAL);
}
static void
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list