[Xfce4-commits] <xfce4-panel:andrzejr/deskbar-github> tasklist: reordering handle and tasklist-widget in plain vertical mode.

Andrzej noreply at xfce.org
Mon Dec 12 11:40:31 CET 2011


Updating branch refs/heads/andrzejr/deskbar-github
         to 6a4d2c92dcacad7c53b21625319ff0e039298850 (commit)
       from 518d5b23e8afc0f94834e901598cc6fd6901bc62 (commit)

commit 6a4d2c92dcacad7c53b21625319ff0e039298850
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Tue Nov 22 12:47:03 2011 +0900

    tasklist: reordering handle and tasklist-widget in plain vertical mode.

 plugins/tasklist/tasklist.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index 6639761..7e3b53b 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -55,6 +55,7 @@ struct _TasklistPlugin
   /* the tasklist widget */
   GtkWidget     *tasklist;
   GtkWidget     *handle;
+  GtkWidget     *box;
 };
 
 
@@ -102,23 +103,23 @@ tasklist_plugin_class_init (TasklistPluginClass *klass)
 static void
 tasklist_plugin_init (TasklistPlugin *plugin)
 {
-  GtkWidget *box;
+  //GtkWidget *box = plugin->box;
 
   /* create widgets */
-  box = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
-  gtk_container_add (GTK_CONTAINER (plugin), box);
-  exo_binding_new (G_OBJECT (plugin), "orientation", G_OBJECT (box), "orientation");
-  gtk_widget_show (box);
+  plugin->box = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (plugin), plugin->box);
+  exo_binding_new (G_OBJECT (plugin), "orientation", G_OBJECT (plugin->box), "orientation");
+  gtk_widget_show (plugin->box);
 
   plugin->handle = gtk_alignment_new (0.00, 0.00, 0.00, 0.00);
-  gtk_box_pack_start (GTK_BOX (box), plugin->handle, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (plugin->box), plugin->handle, FALSE, FALSE, 0);
   g_signal_connect (G_OBJECT (plugin->handle), "expose-event",
       G_CALLBACK (tasklist_plugin_handle_expose_event), plugin);
   gtk_widget_set_size_request (plugin->handle, 8, 8);
   gtk_widget_show (plugin->handle);
 
   plugin->tasklist = g_object_new (XFCE_TYPE_TASKLIST, NULL);
-  gtk_box_pack_start (GTK_BOX (box), plugin->tasklist, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (plugin->box), plugin->tasklist, TRUE, TRUE, 0);
 
   exo_binding_new (G_OBJECT (plugin->tasklist), "show-handle",
                    G_OBJECT (plugin->handle), "visible");
@@ -169,8 +170,16 @@ static void
 tasklist_plugin_orientation_changed (XfcePanelPlugin *panel_plugin,
                                      GtkOrientation   orientation)
 {
+  gboolean        deskbar_mode;
   TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
 
+  deskbar_mode = xfce_panel_plugin_get_deskbar_mode (panel_plugin);
+
+  if ((orientation == GTK_ORIENTATION_HORIZONTAL) || deskbar_mode)
+    gtk_box_reorder_child (GTK_BOX (plugin->box), plugin->handle, 0);
+  else
+    gtk_box_reorder_child (GTK_BOX (plugin->box), plugin->handle, -1);
+
   /* set the new tasklist orientation */
   xfce_tasklist_set_orientation (XFCE_TASKLIST (plugin->tasklist), orientation);
 }
@@ -209,6 +218,9 @@ tasklist_plugin_deskbar_mode_changed (XfcePanelPlugin *panel_plugin,
 {
   TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
 
+  tasklist_plugin_orientation_changed (panel_plugin,
+                                       xfce_panel_plugin_get_orientation (panel_plugin));
+
   /* set the tasklist deskbar_mode */
   xfce_tasklist_set_deskbar_mode (XFCE_TASKLIST (plugin->tasklist), deskbar_mode);
 }


More information about the Xfce4-commits mailing list