Commit ff578fc8 authored by Dominique Lasserre's avatar Dominique Lasserre Committed by Sebastien Granjoux

Fix bgo#515755 - Manually show and hide grip

 * Also update example.
parent b2f4d398
......@@ -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));
};
}
......
......@@ -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" );
}
/**
......
......@@ -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++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment