[Xfce4-commits] <ristretto:stephan/icon-bar> Improve auto-center for vertical icon-bar

Stephan Arts noreply at xfce.org
Sat Feb 4 12:32:05 CET 2012


Updating branch refs/heads/stephan/icon-bar
         to 505ff1fbea968e33cb82d36e56a0a8898e01902d (commit)
       from 7d34953bea6e7f1ff500d26e5da8784b934672c5 (commit)

commit 505ff1fbea968e33cb82d36e56a0a8898e01902d
Author: Stephan Arts <stephan at xfce.org>
Date:   Sat Feb 4 11:49:13 2012 +0100

    Improve auto-center for vertical icon-bar

 src/icon_bar.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/icon_bar.c b/src/icon_bar.c
index 51273b5..0d8f5fa 100644
--- a/src/icon_bar.c
+++ b/src/icon_bar.c
@@ -828,14 +828,12 @@ rstto_icon_bar_size_allocate (
     icon_bar->priv->hadjustment->step_increment = allocation->width * 0.1;
     icon_bar->priv->hadjustment->lower = 0;
     icon_bar->priv->hadjustment->upper = MAX (allocation->width, icon_bar->priv->width);
-    gtk_adjustment_changed (icon_bar->priv->hadjustment);
 
     icon_bar->priv->vadjustment->page_size = allocation->height;
     icon_bar->priv->vadjustment->page_increment = allocation->height * 0.9;
     icon_bar->priv->vadjustment->step_increment = allocation->height * 0.1;
     icon_bar->priv->vadjustment->lower = 0;
     icon_bar->priv->vadjustment->upper = MAX (allocation->height, icon_bar->priv->height);
-    gtk_adjustment_changed (icon_bar->priv->vadjustment);
 
     if (icon_bar->priv->orientation == GTK_ORIENTATION_VERTICAL)
     {
@@ -847,14 +845,14 @@ rstto_icon_bar_size_allocate (
         if (icon_bar->priv->auto_center == TRUE)
         {
             page_size = gtk_adjustment_get_page_size (icon_bar->priv->vadjustment);
-            value = icon_bar->priv->active_item->index * icon_bar->priv->item_width - ((page_size-icon_bar->priv->item_width)/2);
+            value = icon_bar->priv->active_item->index * icon_bar->priv->item_height - ((page_size-icon_bar->priv->item_height)/2);
 
             if (value > (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size))
                 value = (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size);
 
             gtk_adjustment_set_value (icon_bar->priv->vadjustment, value);
-            gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
-            gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
+            gtk_adjustment_changed (icon_bar->priv->vadjustment);
+            gtk_adjustment_changed (icon_bar->priv->hadjustment);
             icon_bar->priv->auto_center = TRUE;
         }
         else
@@ -878,8 +876,8 @@ rstto_icon_bar_size_allocate (
                 value = (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size);
 
             gtk_adjustment_set_value (icon_bar->priv->hadjustment, value);
-            gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
-            gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
+            gtk_adjustment_changed (icon_bar->priv->hadjustment);
+            gtk_adjustment_changed (icon_bar->priv->vadjustment);
             icon_bar->priv->auto_center = TRUE;
         }
         else
@@ -1741,6 +1739,11 @@ rstto_icon_bar_rows_reordered (
 
     g_list_free (icon_bar->priv->items);
     icon_bar->priv->items = g_list_reverse (items);
+    if (icon_bar->priv->auto_center)
+    {
+        rstto_icon_bar_show_active (icon_bar);
+        icon_bar->priv->auto_center = TRUE;
+    }
 
     gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
 }
@@ -2258,7 +2261,7 @@ rstto_icon_bar_show_active (RsttoIconBar *icon_bar)
             value = (gtk_adjustment_get_upper (icon_bar->priv->vadjustment)-page_size);
 
         gtk_adjustment_set_value (icon_bar->priv->vadjustment, value);
-        gtk_adjustment_changed (icon_bar->priv->vadjustment);
+        gtk_adjustment_value_changed (icon_bar->priv->vadjustment);
         icon_bar->priv->auto_center = TRUE;
         return TRUE;
     }
@@ -2271,7 +2274,7 @@ rstto_icon_bar_show_active (RsttoIconBar *icon_bar)
             value = (gtk_adjustment_get_upper (icon_bar->priv->hadjustment)-page_size);
 
         gtk_adjustment_set_value (icon_bar->priv->hadjustment, value);
-        gtk_adjustment_changed (icon_bar->priv->hadjustment);
+        gtk_adjustment_value_changed (icon_bar->priv->hadjustment);
         icon_bar->priv->auto_center = TRUE;
         return TRUE;
     }


More information about the Xfce4-commits mailing list