[Xfce4-commits] <xfce4-panel:master> Add option to fix the length of the panel.

Nick Schermer noreply at xfce.org
Sun Mar 28 17:38:01 CEST 2010


Updating branch refs/heads/master
         to 85613f8e5d531a241abba05fe2df9d72bc1e14a8 (commit)
       from 2e9c4c4edf1fd2967288a451bfc95bb8b99fd877 (commit)

commit 85613f8e5d531a241abba05fe2df9d72bc1e14a8
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Mar 28 17:33:36 2010 +0200

    Add option to fix the length of the panel.
    
    The allows a fixed length of the panel, which if the new
    alternative of the fixed size in the tasklist plugin.
    It can be misused if you set the length of the panel to something
    smaller then the size the plugins minimally need.

 panel/panel-application.c            |    1 +
 panel/panel-preferences-dialog.c     |    1 +
 panel/panel-preferences-dialog.glade |   23 +++++++++++++++++++----
 panel/panel-window.c                 |   28 ++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/panel/panel-application.c b/panel/panel-application.c
index 498bfd8..f1a32a0 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -264,6 +264,7 @@ panel_application_xfconf_window_bindings (PanelApplication *application,
     { "horizontal", G_TYPE_BOOLEAN },
     { "size", G_TYPE_UINT },
     { "length", G_TYPE_UINT },
+    { "length-adjust", G_TYPE_BOOLEAN },
     { "enter-opacity", G_TYPE_UINT },
     { "leave-opacity", G_TYPE_UINT },
     { "background-alpha", G_TYPE_UINT },
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index fa29415..aca1304 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -341,6 +341,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
   panel_preferences_dialog_bindings_add (dialog, "autohide", "active");
   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");
   panel_preferences_dialog_bindings_add (dialog, "enter-opacity", "value");
   panel_preferences_dialog_bindings_add (dialog, "leave-opacity", "value");
diff --git a/panel/panel-preferences-dialog.glade b/panel/panel-preferences-dialog.glade
index 65caa61..eafa71a 100644
--- a/panel/panel-preferences-dialog.glade
+++ b/panel/panel-preferences-dialog.glade
@@ -287,7 +287,7 @@
                               <object class="GtkTable" id="table1">
                                 <property name="visible">True</property>
                                 <property name="border_width">6</property>
-                                <property name="n_rows">2</property>
+                                <property name="n_rows">3</property>
                                 <property name="n_columns">2</property>
                                 <property name="column_spacing">12</property>
                                 <property name="row_spacing">6</property>
@@ -347,6 +347,21 @@
                                     <property name="right_attach">2</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="length-adjust">
+                                    <property name="label" translatable="yes">Automatically increase the length</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="tooltip_text" translatable="yes">Select this option to automatically increase the length of the panel if the plugins request more space.</property>
+                                    <property name="draw_indicator">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                  </packing>
+                                </child>
                               </object>
                             </child>
                           </object>
@@ -809,15 +824,15 @@
   </object>
   <object class="GtkSizeGroup" id="composing-sizegroup">
     <widgets>
-      <widget name="label10"/>
-      <widget name="label9"/>
       <widget name="label7"/>
+      <widget name="label9"/>
+      <widget name="label10"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="display-sizegroup">
     <widgets>
-      <widget name="label13"/>
       <widget name="label1"/>
+      <widget name="label13"/>
     </widgets>
   </object>
 </interface>
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 0c34094..3d3dcb8 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -139,6 +139,7 @@ enum
   PROP_HORIZONTAL,
   PROP_SIZE,
   PROP_LENGTH,
+  PROP_LENGTH_ADJUST,
   PROP_POSITION_LOCKED,
   PROP_AUTOHIDE,
   PROP_SPAN_MONITORS,
@@ -248,6 +249,7 @@ struct _PanelWindow
   /* window positioning */
   guint                size;
   gdouble              length;
+  guint                length_adjust : 1;
   guint                horizontal : 1;
   SnapPosition         snap_position;
   guint                span_monitors : 1;
@@ -342,6 +344,12 @@ panel_window_class_init (PanelWindowClass *klass)
                                                       EXO_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
+                                   PROP_LENGTH_ADJUST,
+                                   g_param_spec_boolean ("length-adjust", NULL, NULL,
+                                                         TRUE,
+                                                         EXO_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
                                    PROP_POSITION_LOCKED,
                                    g_param_spec_boolean ("position-locked", NULL, NULL,
                                                          FALSE,
@@ -413,6 +421,7 @@ panel_window_init (PanelWindow *window)
   window->horizontal = TRUE;
   window->size = 30;
   window->length = 0.10;
+  window->length_adjust = TRUE;
   window->snap_position = SNAP_POSITION_NONE;
   window->span_monitors = FALSE;
   window->position_locked = FALSE;
@@ -469,6 +478,10 @@ panel_window_get_property (GObject    *object,
       g_value_set_uint (value,  rint (window->length * 100.00));
       break;
 
+    case PROP_LENGTH_ADJUST:
+      g_value_set_boolean (value, window->length_adjust);
+      break;
+
     case PROP_POSITION_LOCKED:
       g_value_set_boolean (value, window->position_locked);
       break;
@@ -562,6 +575,15 @@ panel_window_set_property (GObject      *object,
         }
       break;
 
+    case PROP_LENGTH_ADJUST:
+      val_bool = g_value_get_boolean (value);
+      if (window->length_adjust != val_bool)
+        {
+          window->length_adjust = !!val_bool;
+          gtk_widget_queue_resize (GTK_WIDGET (window));
+        }
+      break;
+
     case PROP_POSITION_LOCKED:
       val_bool = g_value_get_boolean (value);
       if (window->position_locked != val_bool)
@@ -1033,11 +1055,17 @@ panel_window_size_request (GtkWidget      *widget,
   /* respect the length and monitor/screen size */
   if (window->horizontal)
     {
+      if (!window->length_adjust)
+        requisition->width = extra_width;
+
       length = window->area.width * window->length;
       requisition->width = CLAMP (requisition->width, length, window->area.width);
     }
   else
     {
+      if (!window->length_adjust)
+        requisition->height = extra_height;
+
       length = window->area.height * window->length;
       requisition->height = CLAMP (requisition->height, length, window->area.height);
     }



More information about the Xfce4-commits mailing list