[gdl] Fix bgo#515755 - Manually show and hide grip



commit ff578fc876c8a848f85a9c8b89ca94f3466f7628
Author: Dominique Lasserre <lasserre d gmail com>
Date:   Fri Apr 12 19:11:45 2013 +0200

    Fix bgo#515755 - Manually show and hide grip
    
     * Also update example.

 gdl/gdl-dock-item-grip.c | 15 +++------------
 gdl/gdl-dock-item.c      | 13 ++++++-------
 gdl/test-dock.c          | 10 ++++++++++
 3 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/gdl/gdl-dock-item-grip.c b/gdl/gdl-dock-item-grip.c
index f533eb9..1ce5f49 100644
--- a/gdl/gdl-dock-item-grip.c
+++ b/gdl/gdl-dock-item-grip.c
@@ -794,12 +794,8 @@ void
 gdl_dock_item_grip_hide_handle (GdlDockItemGrip *grip)
 {
     g_return_if_fail (grip != NULL);
-    if (grip->priv->handle_shown) {
-        grip->priv->handle_shown = FALSE;
-        gdl_dock_item_grip_showhide_handle (grip);
-        if (grip->priv->title_window != NULL)
-            gdk_window_set_cursor (grip->priv->title_window, NULL);
-    };
+    grip->priv->handle_shown = FALSE;
+    gtk_widget_hide (GTK_WIDGET (grip));
 }
 
 /**
@@ -814,12 +810,7 @@ gdl_dock_item_grip_show_handle (GdlDockItemGrip *grip)
     g_return_if_fail (grip != NULL);
     if (!grip->priv->handle_shown) {
         grip->priv->handle_shown = TRUE;
-        gdl_dock_item_grip_showhide_handle (grip);
-        if (grip->priv->title_window != NULL) {
-            GdkCursor *cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (grip)), 
GDK_HAND2);
-            gdk_window_set_cursor (grip->priv->title_window, cursor);
-            g_object_unref (cursor);
-        }
+        gtk_widget_show (GTK_WIDGET (grip));
     };
 }
 
diff --git a/gdl/gdl-dock-item.c b/gdl/gdl-dock-item.c
index 3e7d7fe..982a480 100644
--- a/gdl/gdl-dock-item.c
+++ b/gdl/gdl-dock-item.c
@@ -958,8 +958,6 @@ gdl_dock_item_set_focus_child (GtkContainer *container,
     if (GTK_CONTAINER_CLASS (gdl_dock_item_parent_class)->set_focus_child) {
         (* GTK_CONTAINER_CLASS (gdl_dock_item_parent_class)->set_focus_child) (container, child);
     }
-
-    gdl_dock_item_showhide_grip (GDL_DOCK_ITEM (container));
 }
 
 static void
@@ -1868,12 +1866,14 @@ gdl_dock_item_showhide_grip (GdlDockItem *item)
 {
     gdl_dock_item_detach_menu (GTK_WIDGET (item), NULL);
 
-    if (item->priv->grip) {
-        if (GDL_DOCK_ITEM_GRIP_SHOWN (item) &&
-            GDL_DOCK_ITEM_NOT_LOCKED(item))
+    if (item->priv->grip && GDL_DOCK_ITEM_NOT_LOCKED(item) &&
+        GDL_DOCK_ITEM_HAS_GRIP(item)) {
+
+        if (item->priv->grip_shown) {
             gdl_dock_item_grip_show_handle (GDL_DOCK_ITEM_GRIP (item->priv->grip));
-        else
+        } else {
             gdl_dock_item_grip_hide_handle (GDL_DOCK_ITEM_GRIP (item->priv->grip));
+        }
     }
 }
 
@@ -2255,7 +2255,6 @@ gdl_dock_item_hide_grip (GdlDockItem *item)
         item->priv->grip_shown = FALSE;
         gdl_dock_item_showhide_grip (item);
     };
-    g_warning ("Grips always show unless GDL_DOCK_ITEM_BEH_NO_GRIP is set\n" );
 }
 
 /**
diff --git a/gdl/test-dock.c b/gdl/test-dock.c
index 9398f68..dda6b24 100644
--- a/gdl/test-dock.c
+++ b/gdl/test-dock.c
@@ -163,10 +163,20 @@ static void
 on_change_name (GtkWidget* widget, gpointer data)
 {
        static int index = 10;
+       static gboolean toggle = TRUE;
        gchar* name = g_strdup_printf ("Item %d", index);
        GdlDockItem* item3 = data;
        g_object_set (G_OBJECT (item3), "long_name", name, NULL);
        g_free (name);
+       if (toggle) {
+               gdl_dock_item_hide_grip (item3);
+               g_object_set (G_OBJECT (widget), "label", "hidden", NULL);
+               toggle = FALSE;
+       } else {
+               gdl_dock_item_show_grip (item3);
+               g_object_set (G_OBJECT (widget), "label", "shown", NULL);
+               toggle = TRUE;
+       }
        index++;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]