[Xfce4-commits] <xfce4-panel:andrzejr/deskbar-github> panel-preferences-dialog: switched from controlling the total size of the panel to a size of a single "icon" (or row).

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


Updating branch refs/heads/andrzejr/deskbar-github
         to ef10316d2a840371f8a6dcf9494ca883a648b6da (commit)
       from b2ad54a697d57b0ea882abb4475d4c99ddd4bfc3 (commit)

commit ef10316d2a840371f8a6dcf9494ca883a648b6da
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Thu Dec 1 04:20:18 2011 +0900

    panel-preferences-dialog: switched from controlling the total size of the panel to a size of a single "icon" (or row).
    
    This configuration is easier to use, as before changing the number of rows affected icon sizes.

 libxfce4panel/xfce-panel-plugin.c    |    2 +-
 panel/panel-itembar.c                |    2 +-
 panel/panel-preferences-dialog.c     |   78 +++++++++++++++++++++++++++++++++-
 panel/panel-preferences-dialog.glade |    4 +-
 panel/panel-window.c                 |    2 +-
 plugins/tasklist/tasklist-widget.c   |    6 ++-
 6 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 7d100fb..97c5a01 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -576,7 +576,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
                                    g_param_spec_int ("size",
                                                      "Size",
                                                      "Size of the plugin's panel",
-                                                     0, 128, 0,
+                                                     0, 128*8, 0,
                                                      G_PARAM_READABLE
                                                      | G_PARAM_STATIC_STRINGS));
 
diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index 2bae60f..2ed0f8a 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -185,7 +185,7 @@ panel_itembar_class_init (PanelItembarClass *klass)
                                    PROP_SIZE,
                                    g_param_spec_uint ("size",
                                                       NULL, NULL,
-                                                      16, 128, 48,
+                                                      16, 128*8, 48,
                                                       EXO_PARAM_WRITABLE));
 
   g_object_class_install_property (gobject_class,
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 2aacd30..5653433 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -386,6 +386,65 @@ panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog,
 }
 
 
+static gboolean
+transform_icon_size_to_panel_size (const GValue *src_value,
+                                   GValue       *dst_value,
+                                   gpointer      user_data)
+{
+  guint icon_size, nrows;
+  GValue nrows_value;
+
+  if (!user_data)
+    return FALSE;
+  g_value_init (&nrows_value, G_TYPE_UINT);
+  g_object_get_property (G_OBJECT (user_data), "nrows", &nrows_value);
+
+  icon_size = g_value_get_double (src_value);
+  nrows = g_value_get_uint (&nrows_value);
+  g_value_set_uint (dst_value, icon_size * nrows);
+  return TRUE;
+}
+
+
+static gboolean
+transform_panel_size_to_icon_size (const GValue *src_value,
+                                   GValue       *dst_value,
+                                   gpointer      user_data)
+{
+  guint panel_size, nrows;
+  GValue nrows_value;
+
+  if (!user_data)
+    return FALSE;
+  g_value_init (&nrows_value, G_TYPE_UINT);
+  g_object_get_property (G_OBJECT (user_data), "nrows", &nrows_value);
+
+  panel_size = g_value_get_uint (src_value);
+  nrows = g_value_get_uint (&nrows_value);
+  g_value_set_double (dst_value, panel_size / nrows);
+  return TRUE;
+}
+
+
+static gboolean
+transform_nrows_to_panel_size (const GValue *src_value,
+                               GValue       *dst_value,
+                               gpointer      user_data)
+{
+  guint icon_size, nrows;
+  GValue icon_size_value;
+
+  if (!user_data)
+    return FALSE;
+  g_value_init (&icon_size_value, G_TYPE_DOUBLE);
+  g_object_get_property (G_OBJECT (user_data), "value", &icon_size_value);
+  icon_size = g_value_get_double (&icon_size_value);
+
+  nrows = g_value_get_uint (src_value);
+  g_value_set_uint (dst_value, icon_size * nrows);
+  return TRUE;
+}
+
 
 static void
 panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
@@ -402,6 +461,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
   gint         n = 0, i;
   gchar       *name, *title;
   gboolean     span_monitors_sensitive = FALSE;
+  GObject     *size_object, *nrows_object;
 
   /* leave when there is no active panel */
   panel_return_if_fail (G_IS_OBJECT (dialog->active));
@@ -414,7 +474,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
   panel_preferences_dialog_bindings_add (dialog, "position-locked", "active");
   panel_preferences_dialog_bindings_add (dialog, "autohide", "active");
   panel_preferences_dialog_bindings_add (dialog, "disable-struts", "active");
-  panel_preferences_dialog_bindings_add (dialog, "size", "value");
+  /* panel_preferences_dialog_bindings_add (dialog, "size", "value"); */
   panel_preferences_dialog_bindings_add (dialog, "length", "value");
   panel_preferences_dialog_bindings_add (dialog, "length-adjust", "active");
   panel_preferences_dialog_bindings_add (dialog, "background-alpha", "value");
@@ -426,6 +486,22 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
   panel_preferences_dialog_bindings_add (dialog, "nrows", "value");
   panel_preferences_dialog_bindings_add (dialog, "deskbar-mode", "active");
 
+  size_object = gtk_builder_get_object (GTK_BUILDER (dialog), "size");
+  dialog->bindings =
+    g_slist_prepend (dialog->bindings,
+                     exo_mutual_binding_new_full (G_OBJECT (dialog->active), "size", size_object, "value",
+                                                  transform_panel_size_to_icon_size,
+                                                  transform_icon_size_to_panel_size,
+                                                  NULL, dialog->active));
+  dialog->bindings =
+    g_slist_prepend (dialog->bindings,
+                     exo_binding_new_full (G_OBJECT (dialog->active), "nrows", G_OBJECT (dialog->active), "size",
+                                           transform_nrows_to_panel_size,
+                                           NULL, size_object));
+
+
+
+
   /* watch image changes from the panel */
   dialog->bg_image_notify_handler_id = g_signal_connect_swapped (G_OBJECT (dialog->active),
       "notify::background-image", G_CALLBACK (panel_preferences_dialog_bg_image_notified), dialog);
diff --git a/panel/panel-preferences-dialog.glade b/panel/panel-preferences-dialog.glade
index 8eeaf22..ec9e6bd 100644
--- a/panel/panel-preferences-dialog.glade
+++ b/panel/panel-preferences-dialog.glade
@@ -393,7 +393,7 @@
                                   <object class="GtkLabel" id="label3">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">_Size (pixels):</property>
+                                    <property name="label" translatable="yes">Icon _Size (pixels):</property>
                                     <property name="use_underline">True</property>
                                     <property name="mnemonic_widget">size-scale</property>
                                   </object>
@@ -419,7 +419,7 @@
                                   <object class="GtkLabel" id="label18">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Ro_ws:</property>
+                                    <property name="label" translatable="yes">Number of Ro_ws:</property>
                                     <property name="use_underline">True</property>
                                     <property name="mnemonic_widget">nrows-scale</property>
                                   </object>
diff --git a/panel/panel-window.c b/panel/panel-window.c
index dd9aea1..9f684cb 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -353,7 +353,7 @@ panel_window_class_init (PanelWindowClass *klass)
   g_object_class_install_property (gobject_class,
                                    PROP_SIZE,
                                    g_param_spec_uint ("size", NULL, NULL,
-                                                      16, 128, 48,
+                                                      16, 128*8, 48,
                                                       EXO_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 2852227..e1df261 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -1045,7 +1045,11 @@ xfce_tasklist_size_allocate (GtkWidget     *widget,
               y = area.y;
               h = area.height;
 
-              if (tasklist->show_labels)
+              if (!tasklist->horizontal && tasklist->deskbar_mode && tasklist->show_labels)
+                {
+                  w = area_width;
+                }
+              else if (tasklist->show_labels)
                 {
                   /* TODO, this is a work-around, something else goes wrong
                    * with counting the windows... */


More information about the Xfce4-commits mailing list