[Xfce4-commits] <xfce4-panel:andrzejr/deskbar-tasklist> tasklist: accumulated changes from andrzejr/deskbar-github branch.

Andrzej noreply at xfce.org
Mon Dec 12 16:00:14 CET 2011


Updating branch refs/heads/andrzejr/deskbar-tasklist
         to 51b17f08a93fd7aaaa88beb9324fbd6dfa18b7cd (commit)
       from f9af320ee3f50582039e8f596c87948a37029770 (commit)

commit 51b17f08a93fd7aaaa88beb9324fbd6dfa18b7cd
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Mon Dec 12 23:32:21 2011 +0900

    tasklist: accumulated changes from andrzejr/deskbar-github branch.

 plugins/tasklist/tasklist-dialog.glade |   15 +---
 plugins/tasklist/tasklist-widget.c     |  179 +++++++++++++++-----------------
 plugins/tasklist/tasklist-widget.h     |    7 +-
 plugins/tasklist/tasklist.c            |   46 ++++++---
 4 files changed, 122 insertions(+), 125 deletions(-)

diff --git a/plugins/tasklist/tasklist-dialog.glade b/plugins/tasklist/tasklist-dialog.glade
index 21e24cc..db6db74 100644
--- a/plugins/tasklist/tasklist-dialog.glade
+++ b/plugins/tasklist/tasklist-dialog.glade
@@ -73,19 +73,6 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="rotate-vertically">
-                            <property name="label" translatable="yes">Ro_tate buttons in vertical panel</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="position">3</property>
-                          </packing>
-                        </child>
-                        <child>
                           <object class="GtkHBox" id="hbox2">
                             <property name="visible">True</property>
                             <property name="spacing">12</property>
@@ -119,7 +106,7 @@
                             </child>
                           </object>
                           <packing>
-                            <property name="position">4</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                       </object>
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index d5ad920..5ee7cad 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -68,7 +68,9 @@
 #define xfce_taskbar_is_locked(tasklist) (XFCE_TASKLIST (tasklist)->locked > 0)
 
 #define xfce_tasklist_get_panel_plugin(tasklist) gtk_widget_get_ancestor (GTK_WIDGET (tasklist), XFCE_TYPE_PANEL_PLUGIN)
-#define xfce_tasklist_horizontal(tasklist) ((tasklist)->horizontal || (!(tasklist)->rotate_vertically && (tasklist)->show_labels))
+#define xfce_tasklist_horizontal(tasklist) ((tasklist)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
+#define xfce_tasklist_vertical(tasklist) ((tasklist)->mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
+#define xfce_tasklist_deskbar(tasklist) ((tasklist)->mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
 #define xfce_tasklist_filter_monitors(tasklist) (!(tasklist)->all_monitors && (tasklist)->monitor_geometry.width != -1)
 #define xfce_tasklist_geometry_set_invalid(tasklist) ((tasklist)->monitor_geometry.width = -1)
 #define xfce_tasklist_geometry_has_point(tasklist, x, y) ( \
@@ -92,7 +94,6 @@ enum
   PROP_SHOW_WIREFRAMES,
   PROP_SHOW_HANDLE,
   PROP_SORT_ORDER,
-  PROP_ROTATE_VERTICALLY,
   PROP_WINDOW_SCROLLING
 };
 
@@ -130,8 +131,8 @@ struct _XfceTasklist
   /* size of the panel pluin */
   gint                  size;
 
-  /* orientation of the tasklist */
-  guint                 horizontal : 1;
+  /* mode (orientation) of the tasklist */
+  XfcePanelPluginMode   mode;
 
   /* relief of the tasklist buttons */
   GtkReliefStyle        button_relief;
@@ -148,8 +149,8 @@ struct _XfceTasklist
    * tasklist */
   guint                 only_minimized : 1;
 
-  /* if we rotate buttons in a vertical panel */
-  guint                 rotate_vertically : 1;
+  /* number of rows of window buttons */
+  guint                 nrows;
 
   /* switch window with the mouse wheel */
   guint                 window_scrolling : 1;
@@ -342,9 +343,6 @@ static void               xfce_tasklist_set_show_wireframes              (XfceTa
                                                                           gboolean              show_wireframes);
 static void               xfce_tasklist_set_grouping                     (XfceTasklist         *tasklist,
                                                                           XfceTasklistGrouping  grouping);
-static void               xfce_tasklist_set_rotate_vertically            (XfceTasklist         *tasklist,
-                                                                          gboolean              rotate_vertically);
-
 
 
 G_DEFINE_TYPE (XfceTasklist, xfce_tasklist, GTK_TYPE_CONTAINER)
@@ -456,13 +454,6 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
                                                       EXO_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
-                                   PROP_ROTATE_VERTICALLY,
-                                   g_param_spec_boolean ("rotate-vertically",
-                                                         NULL, NULL,
-                                                         TRUE,
-                                                         EXO_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class,
                                    PROP_WINDOW_SCROLLING,
                                    g_param_spec_boolean ("window-scrolling",
                                                          NULL, NULL,
@@ -534,7 +525,8 @@ xfce_tasklist_init (XfceTasklist *tasklist)
   tasklist->screen = NULL;
   tasklist->windows = NULL;
   tasklist->skipped_windows = NULL;
-  tasklist->horizontal = TRUE;
+  tasklist->mode = XFCE_PANEL_PLUGIN_MODE_HORIZONTAL;
+  tasklist->nrows = 1;
   tasklist->all_workspaces = FALSE;
   tasklist->button_relief = GTK_RELIEF_NORMAL;
   tasklist->switch_workspace = TRUE;
@@ -542,7 +534,6 @@ xfce_tasklist_init (XfceTasklist *tasklist)
   tasklist->show_labels = TRUE;
   tasklist->show_wireframes = FALSE;
   tasklist->show_handle = TRUE;
-  tasklist->rotate_vertically = TRUE;
   tasklist->all_monitors = TRUE;
   tasklist->window_scrolling = TRUE;
   xfce_tasklist_geometry_set_invalid (tasklist);
@@ -627,10 +618,6 @@ xfce_tasklist_get_property (GObject    *object,
       g_value_set_uint (value, tasklist->sort_order);
       break;
 
-    case PROP_ROTATE_VERTICALLY:
-      g_value_set_boolean (value, tasklist->rotate_vertically);
-      break;
-
     case PROP_WINDOW_SCROLLING:
       g_value_set_boolean (value, tasklist->window_scrolling);
       break;
@@ -701,10 +688,6 @@ xfce_tasklist_set_property (GObject      *object,
         }
       break;
 
-    case PROP_ROTATE_VERTICALLY:
-      xfce_tasklist_set_rotate_vertically (tasklist, g_value_get_boolean (value));
-      break;
-
     case PROP_WINDOW_SCROLLING:
       tasklist->window_scrolling = g_value_get_boolean (value);
       break;
@@ -767,7 +750,8 @@ xfce_tasklist_size_request (GtkWidget      *widget,
         {
           gtk_widget_size_request (child->button, &child_req);
 
-          child_height = MAX (child_height, child_req.height);
+          /* child_height = MAX (child_height, child_req.height); */
+          child_height = MAX (child_height, tasklist->size / (gint) tasklist->nrows);
 
           if (child->type == CHILD_TYPE_GROUP_MENU)
             continue;
@@ -789,8 +773,7 @@ xfce_tasklist_size_request (GtkWidget      *widget,
     }
   else
     {
-      rows = tasklist->size / tasklist->max_button_size;
-      rows = CLAMP (rows, 1, n_windows);
+      rows = MAX (tasklist->nrows, 1);
 
       cols = n_windows / rows;
       if (cols * rows < n_windows)
@@ -805,18 +788,15 @@ xfce_tasklist_size_request (GtkWidget      *widget,
     }
 
   /* set the requested sizes */
-  if (xfce_tasklist_horizontal (tasklist))
+  if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)
     {
-      if (tasklist->horizontal != xfce_tasklist_horizontal (tasklist))
-        {
-          requisition->height = child_height * n_windows;
-          requisition->width = tasklist->size;
-        }
-      else
-        {
-          requisition->width = length;
-          requisition->height = tasklist->size;
-        }
+      requisition->height = child_height * n_windows;
+      requisition->width = tasklist->size;
+    }
+  else if (xfce_tasklist_horizontal (tasklist))
+    {
+      requisition->width = length;
+      requisition->height = tasklist->size;
     }
   else
     {
@@ -850,7 +830,7 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
                            GtkAllocation *alloc,
                            gint          *n_rows,
                            gint          *n_cols,
-                           gboolean      *arrow_visible)
+                           gint          *arrow_position)
 {
   gint               rows;
   gint               min_button_length;
@@ -862,11 +842,13 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
   gint               n_buttons;
   gint               n_buttons_target;
 
-  /* if we're in the opposite vertical mode, there are no columns */
-  if (tasklist->horizontal != xfce_tasklist_horizontal (tasklist))
-    rows = tasklist->n_windows;
+  /* if we're in deskbar mode, there are no columns */
+  if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)
+    //rows = tasklist->n_windows;
+    rows = 1;
   else
-    rows = alloc->height / tasklist->max_button_size;
+    /* rows = alloc->height / tasklist->max_button_size; */
+    rows = tasklist->nrows;
 
   if (rows < 1)
     rows = 1;
@@ -875,12 +857,12 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
   if (cols * rows < tasklist->n_windows)
     cols++;
 
-  if (tasklist->show_labels)
-    min_button_length = tasklist->min_button_length;
+  if (xfce_tasklist_deskbar (tasklist) || !tasklist->show_labels)
+    min_button_length = alloc->height / tasklist->nrows;
   else
-    min_button_length = alloc->height / rows;
+    min_button_length = tasklist->min_button_length;
 
-  *arrow_visible = FALSE;
+  *arrow_position = -1; /* not visible */
 
   if (min_button_length * cols <= alloc->width)
     {
@@ -901,7 +883,7 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
                                                     xfce_tasklist_size_sort_window);
         }
 
-      if (!tasklist->show_labels)
+      if (xfce_tasklist_deskbar (tasklist) || !tasklist->show_labels)
         max_button_length = min_button_length;
       else if (tasklist->max_button_length != -1)
         max_button_length = tasklist->max_button_length;
@@ -909,7 +891,13 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
         max_button_length = DEFAULT_MAX_BUTTON_LENGTH;
 
       n_buttons = tasklist->n_windows;
-      n_buttons_target = ((alloc->width / max_button_length) + 1) * rows;
+      /* Matches the existing behavior (with a bug fix) */
+      /* n_buttons_target = MIN ((alloc->width - ARROW_BUTTON_SIZE) / min_button_length * rows,          *
+       *                         (((alloc->width - ARROW_BUTTON_SIZE) / max_button_length) + 1) * rows); */
+
+      /* Perhaps a better behavior (tries to display more buttons on the panel, */
+      /* yet still within the specified limits) */
+      n_buttons_target = (alloc->width - ARROW_BUTTON_SIZE) / min_button_length * rows;
 
 #if 0
       if (tasklist->grouping == XFCE_TASKLIST_GROUPING_AUTO)
@@ -936,7 +924,11 @@ xfce_tasklist_size_layout (XfceTasklist  *tasklist,
                 child->type = CHILD_TYPE_OVERFLOW_MENU;
             }
 
-          *arrow_visible = TRUE;
+          /* Try to position the arrow widget at the end of the allocation area  *
+           * if that's impossible (because buttons cannot be expanded enough)    *
+           * position it just after the buttons.                                 */
+          *arrow_position = MIN (alloc->width - ARROW_BUTTON_SIZE,
+                                 n_buttons_target * max_button_length / rows);
         }
 
       g_slist_free (windows_scored);
@@ -967,7 +959,7 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
   gboolean           direction_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
   gint               w, x, y, h;
   gint               area_x, area_width;
-  gboolean           arrow_visible;
+  gint               arrow_position;
   GtkRequisition     child_req;
 
   panel_return_if_fail (GTK_WIDGET_VISIBLE (tasklist->arrow_button));
@@ -978,7 +970,7 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
   /* swap integers with vertical orientation */
   if (!xfce_tasklist_horizontal (tasklist))
     TRANSPOSE_AREA (area);
-  /*panel_return_if_fail (area.height == tasklist->size);*/
+  panel_return_if_fail (area.height == tasklist->size);
 
   /* TODO if we compare the allocation with the requisition we can
    * do a fast path to the child allocation, i think */
@@ -986,23 +978,23 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
   /* useless but hides compiler warning */
   w = h = x = y = rows = cols = 0;
 
-  xfce_tasklist_size_layout (tasklist, &area, &rows, &cols, &arrow_visible);
+  xfce_tasklist_size_layout (tasklist, &area, &rows, &cols, &arrow_position);
 
   /* allocate the arrow button for the overflow menu */
   child_alloc.width = ARROW_BUTTON_SIZE;
   child_alloc.height = area.height;
 
-  if (arrow_visible)
+  if (arrow_position != -1)
     {
       child_alloc.x = area.x;
       child_alloc.y = area.y;
 
       if (!direction_rtl)
-        child_alloc.x += area.width - ARROW_BUTTON_SIZE;
+        child_alloc.x += arrow_position;
       else
-        area.x += ARROW_BUTTON_SIZE;
+        child_alloc.x += (area.width - arrow_position);
 
-      area.width -= ARROW_BUTTON_SIZE;
+      area.width = arrow_position;
 
       /* position the arrow in the correct position */
       if (!xfce_tasklist_horizontal (tasklist))
@@ -1017,6 +1009,7 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
 
   area_x = area.x;
   area_width = area.width;
+  h = area.height / rows;
 
   /* allocate all the children */
   for (li = tasklist->windows, i = 0; li != NULL; li = li->next)
@@ -1031,14 +1024,17 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
           || child->type == CHILD_TYPE_GROUP))
         {
           row = (i % rows);
-
           if (row == 0)
             {
               x = area_x;
               y = area.y;
-              h = area.height;
 
-              if (tasklist->show_labels)
+              if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)
+                {
+                  /* fixed width is OK because area.width==w*cols */
+                  w = area.height / tasklist->nrows;
+                }
+              else if (tasklist->show_labels)
                 {
                   /* TODO, this is a work-around, something else goes wrong
                    * with counting the windows... */
@@ -1049,29 +1045,25 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
                       && w > tasklist->max_button_length)
                     w = tasklist->max_button_length;
                 }
-              else
+              else /* buttons without labels */
                 {
-                  w = h / (rows - row);
+                  w = h;
                 }
 
               area_width -= w;
               area_x += w;
             }
 
-          child_alloc.y = y;
+          if (xfce_tasklist_vertical (tasklist))
+            /* lay out buttons right to left in the vertical mode */
+            child_alloc.y = area.height - y - h;
+          else
+            child_alloc.y = y;
           child_alloc.x = x;
           child_alloc.width = MAX (w, 1); /* TODO this is a workaround */
-          child_alloc.height = h / (rows - row);
+          child_alloc.height = h;
 
-          if (!tasklist->horizontal
-              && xfce_tasklist_horizontal (tasklist))
-            {
-              gtk_widget_get_child_requisition (child->button, &child_req);
-              child_alloc.height = child_req.height;
-            }
-
-          h -= child_alloc.height;
-          y += child_alloc.height;
+          y += h;
 
           if (direction_rtl)
             child_alloc.x = area.x + area.width - (child_alloc.x - area.x) - child_alloc.width;
@@ -2020,7 +2012,7 @@ xfce_tasklist_child_new (XfceTasklist *tasklist)
   gtk_button_set_relief (GTK_BUTTON (child->button),
                          tasklist->button_relief);
 
-  child->box = xfce_hvbox_new (xfce_tasklist_horizontal (tasklist) ?
+  child->box = xfce_hvbox_new (!xfce_tasklist_vertical (tasklist) ?
       GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, FALSE, 6);
   gtk_container_add (GTK_CONTAINER (child->button), child->box);
   gtk_widget_show (child->box);
@@ -2035,13 +2027,15 @@ xfce_tasklist_child_new (XfceTasklist *tasklist)
 
   child->label = gtk_label_new (NULL);
   gtk_box_pack_start (GTK_BOX (child->box), child->label, TRUE, TRUE, 0);
-  if (xfce_tasklist_horizontal (tasklist))
+  if (!xfce_tasklist_vertical (tasklist))
     {
+      /* gtk_box_reorder_child (GTK_BOX (child->box), child->icon, 0); */
       gtk_misc_set_alignment (GTK_MISC (child->label), 0.0, 0.5);
       gtk_label_set_ellipsize (GTK_LABEL (child->label), tasklist->ellipsize_mode);
     }
   else
     {
+      /* gtk_box_reorder_child (GTK_BOX (child->box), child->icon, -1); */
       gtk_label_set_angle (GTK_LABEL (child->label), 270);
       gtk_misc_set_alignment (GTK_MISC (child->label), 0.50, 0.00);
       /* TODO can we already ellipsize here yet? */
@@ -2946,8 +2940,8 @@ xfce_tasklist_button_drag_data_received (GtkWidget         *button,
   sibling = g_list_find (tasklist->windows, child2);
   panel_return_if_fail (sibling != NULL);
 
-  if ((tasklist->horizontal && x >= button->allocation.width / 2)
-      || (!tasklist->horizontal && y >= button->allocation.height / 2))
+  if ((!xfce_tasklist_vertical (tasklist) && x >= button->allocation.width / 2)
+      || (xfce_tasklist_vertical (tasklist) && y >= button->allocation.height / 2))
     sibling = g_list_next (sibling);
 
   xid = *((gulong *) gtk_selection_data_get_data (selection_data));
@@ -3784,7 +3778,7 @@ xfce_tasklist_update_orientation (XfceTasklist *tasklist)
   GList             *li;
   XfceTasklistChild *child;
 
-  horizontal = xfce_tasklist_horizontal (tasklist);
+  horizontal = !xfce_tasklist_vertical (tasklist);
 
   /* update the tasklist */
   for (li = tasklist->windows; li != NULL; li = li->next)
@@ -3798,6 +3792,7 @@ xfce_tasklist_update_orientation (XfceTasklist *tasklist)
       /* update the label */
       if (horizontal)
         {
+          /* gtk_box_reorder_child (GTK_BOX (child->box), child->icon, 0); */
           gtk_misc_set_alignment (GTK_MISC (child->label), 0.0, 0.5);
           gtk_label_set_angle (GTK_LABEL (child->label), 0);
           gtk_label_set_ellipsize (GTK_LABEL (child->label),
@@ -3805,6 +3800,7 @@ xfce_tasklist_update_orientation (XfceTasklist *tasklist)
         }
       else
         {
+          /* gtk_box_reorder_child (GTK_BOX (child->box), child->icon, -1); */
           gtk_misc_set_alignment (GTK_MISC (child->label), 0.50, 0.00);
           gtk_label_set_angle (GTK_LABEL (child->label), 270);
           gtk_label_set_ellipsize (GTK_LABEL (child->label), PANGO_ELLIPSIZE_NONE);
@@ -3816,33 +3812,30 @@ xfce_tasklist_update_orientation (XfceTasklist *tasklist)
 
 
 
-static void
-xfce_tasklist_set_rotate_vertically (XfceTasklist *tasklist,
-                                     gboolean      rotate_vertically)
+void
+xfce_tasklist_set_nrows (XfceTasklist *tasklist,
+                         guint         nrows)
 {
   panel_return_if_fail (XFCE_IS_TASKLIST (tasklist));
 
-  if (tasklist->rotate_vertically != rotate_vertically)
+  if (tasklist->nrows != nrows)
     {
-      tasklist->rotate_vertically = rotate_vertically;
-      xfce_tasklist_update_orientation (tasklist);
+      tasklist->nrows = nrows;
+      gtk_widget_queue_resize (GTK_WIDGET (tasklist));
     }
 }
 
 
 
 void
-xfce_tasklist_set_orientation (XfceTasklist   *tasklist,
-                               GtkOrientation  orientation)
+xfce_tasklist_set_mode (XfceTasklist        *tasklist,
+                        XfcePanelPluginMode  mode)
 {
-  gboolean horizontal;
-
   panel_return_if_fail (XFCE_IS_TASKLIST (tasklist));
 
-  horizontal = !!(orientation == GTK_ORIENTATION_HORIZONTAL);
-  if (tasklist->horizontal != horizontal)
+  if (tasklist->mode != mode)
     {
-      tasklist->horizontal = horizontal;
+      tasklist->mode = mode;
       xfce_tasklist_update_orientation (tasklist);
     }
 }
diff --git a/plugins/tasklist/tasklist-widget.h b/plugins/tasklist/tasklist-widget.h
index 3a0eaf4..f7fbdd8 100644
--- a/plugins/tasklist/tasklist-widget.h
+++ b/plugins/tasklist/tasklist-widget.h
@@ -65,12 +65,15 @@ enum _XfceTasklistSortOrder
 
 GType xfce_tasklist_get_type                (void) G_GNUC_CONST;
 
-void  xfce_tasklist_set_orientation         (XfceTasklist   *tasklist,
-                                             GtkOrientation  orientation);
+void  xfce_tasklist_set_mode                (XfceTasklist        *tasklist,
+                                             XfcePanelPluginMode  mode);
 
 void  xfce_tasklist_set_size                (XfceTasklist   *tasklist,
                                              gint            size);
 
+void  xfce_tasklist_set_nrows               (XfceTasklist   *tasklist,
+                                             guint           nrows);
+
 void  xfce_tasklist_update_monitor_geometry (XfceTasklist   *tasklist);
 
 G_END_DECLS
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index 1c1a332..4ee9289 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -55,15 +55,18 @@ struct _TasklistPlugin
   /* the tasklist widget */
   GtkWidget     *tasklist;
   GtkWidget     *handle;
+  GtkWidget     *box;
 };
 
 
 
 static void     tasklist_plugin_construct               (XfcePanelPlugin    *panel_plugin);
-static void     tasklist_plugin_orientation_changed     (XfcePanelPlugin    *panel_plugin,
-                                                         GtkOrientation      orientation);
+static void     tasklist_plugin_mode_changed            (XfcePanelPlugin    *panel_plugin,
+                                                         XfcePanelPluginMode mode);
 static gboolean tasklist_plugin_size_changed            (XfcePanelPlugin    *panel_plugin,
                                                          gint                size);
+static void     tasklist_plugin_nrows_changed           (XfcePanelPlugin    *panel_plugin,
+                                                         guint               nrows);
 static void     tasklist_plugin_screen_position_changed (XfcePanelPlugin    *panel_plugin,
                                                          XfceScreenPosition  position);
 static void     tasklist_plugin_configure_plugin        (XfcePanelPlugin    *panel_plugin);
@@ -85,8 +88,9 @@ tasklist_plugin_class_init (TasklistPluginClass *klass)
 
   plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
   plugin_class->construct = tasklist_plugin_construct;
-  plugin_class->orientation_changed = tasklist_plugin_orientation_changed;
+  plugin_class->mode_changed = tasklist_plugin_mode_changed;
   plugin_class->size_changed = tasklist_plugin_size_changed;
+  plugin_class->nrows_changed = tasklist_plugin_nrows_changed;
   plugin_class->screen_position_changed = tasklist_plugin_screen_position_changed;
   plugin_class->configure_plugin = tasklist_plugin_configure_plugin;
 }
@@ -96,23 +100,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");
@@ -136,7 +140,6 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
     { "show-wireframes", G_TYPE_BOOLEAN },
     { "show-handle", G_TYPE_BOOLEAN },
     { "sort-order", G_TYPE_UINT },
-    { "rotate-vertically", G_TYPE_BOOLEAN },
     { "window-scrolling", G_TYPE_BOOLEAN },
     { NULL }
   };
@@ -160,13 +163,13 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
 
 
 static void
-tasklist_plugin_orientation_changed (XfcePanelPlugin *panel_plugin,
-                                     GtkOrientation   orientation)
+tasklist_plugin_mode_changed (XfcePanelPlugin     *panel_plugin,
+                              XfcePanelPluginMode  mode)
 {
   TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
 
-  /* set the new tasklist orientation */
-  xfce_tasklist_set_orientation (XFCE_TASKLIST (plugin->tasklist), orientation);
+  /* set the new tasklist mode */
+  xfce_tasklist_set_mode (XFCE_TASKLIST (plugin->tasklist), mode);
 }
 
 
@@ -186,6 +189,18 @@ tasklist_plugin_size_changed (XfcePanelPlugin *panel_plugin,
 
 
 static void
+tasklist_plugin_nrows_changed (XfcePanelPlugin *panel_plugin,
+                               guint            nrows)
+{
+  TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
+
+  /* set the tasklist nrows */
+  xfce_tasklist_set_nrows (XFCE_TASKLIST (plugin->tasklist), nrows);
+}
+
+
+
+static void
 tasklist_plugin_screen_position_changed (XfcePanelPlugin    *panel_plugin,
                                          XfceScreenPosition  position)
 {
@@ -232,7 +247,6 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
   TASKLIST_DIALOG_BIND ("include-all-workspaces", "active")
   TASKLIST_DIALOG_BIND ("include-all-monitors", "active")
   TASKLIST_DIALOG_BIND ("flat-buttons", "active")
-  TASKLIST_DIALOG_BIND ("rotate-vertically", "active")
   TASKLIST_DIALOG_BIND_INV ("switch-workspace-on-unminimize", "active")
   TASKLIST_DIALOG_BIND ("show-only-minimized", "active")
   TASKLIST_DIALOG_BIND ("show-wireframes", "active")


More information about the Xfce4-commits mailing list