[gdl: 2/2] really enforce GDL_DOCK_ITEM_BEH_CANT_CLOSE
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdl: 2/2] really enforce GDL_DOCK_ITEM_BEH_CANT_CLOSE
- Date: Sat, 19 Mar 2016 09:50:56 +0000 (UTC)
commit 77bf6735c39ae66726ada29cb107020a57e0410e
Author: Lukas K <lu 0x83 eu>
Date: Fri Feb 26 17:49:06 2016 +0100
really enforce GDL_DOCK_ITEM_BEH_CANT_CLOSE
- hide menu item 'hide'
- prevent floating window from being closed
gdl/gdl-dock-item.c | 6 ++++++
gdl/gdl-dock.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gdl/gdl-dock-item.c b/gdl/gdl-dock-item.c
index 4acaf7b..f28a515 100644
--- a/gdl/gdl-dock-item.c
+++ b/gdl/gdl-dock-item.c
@@ -204,6 +204,7 @@ struct _GdlDockItemPrivate {
gint dragoff_x, dragoff_y;
GtkWidget *menu;
+ GtkWidget *menu_item_hide;
gboolean grip_shown;
GtkWidget *grip;
@@ -627,6 +628,7 @@ gdl_dock_item_init (GdlDockItem *item)
item->priv->in_predrag = item->priv->in_drag = FALSE;
item->priv->menu = NULL;
+ item->priv->menu_item_hide = NULL;
item->priv->preferred_width = item->priv->preferred_height = -1;
item->priv->tab_label = NULL;
@@ -862,6 +864,7 @@ gdl_dock_item_dispose (GObject *object)
if (priv->menu) {
gtk_menu_detach (GTK_MENU (priv->menu));
priv->menu = NULL;
+ priv->menu_item_hide = NULL;
}
if (priv->grip) {
@@ -1751,6 +1754,7 @@ gdl_dock_item_popup_menu (GdlDockItem *item,
gtk_menu_shell_append (GTK_MENU_SHELL (item->priv->menu), mitem);
g_signal_connect (mitem, "activate",
G_CALLBACK (gdl_dock_item_hide_cb), item);
+ item->priv->menu_item_hide = mitem;
/* Lock menuitem */
mitem = gtk_menu_item_new_with_label (_("Lock"));
gtk_menu_shell_append (GTK_MENU_SHELL (item->priv->menu), mitem);
@@ -1761,6 +1765,8 @@ gdl_dock_item_popup_menu (GdlDockItem *item,
/* Show popup menu. */
gtk_widget_show_all (item->priv->menu);
+ if (item->priv->menu_item_hide != NULL)
+ gtk_widget_set_visible(item->priv->menu_item_hide, !GDL_DOCK_ITEM_CANT_CLOSE(item));
gtk_menu_popup (GTK_MENU (item->priv->menu), NULL, NULL, NULL, NULL,
button, time);
}
diff --git a/gdl/gdl-dock.c b/gdl/gdl-dock.c
index 4a7fe31..c976b09 100644
--- a/gdl/gdl-dock.c
+++ b/gdl/gdl-dock.c
@@ -1014,7 +1014,9 @@ gdl_dock_floating_window_delete_event_cb (GtkWidget *widget)
dock = GDL_DOCK (g_object_get_data (G_OBJECT (widget), "dock"));
if (dock->priv->root) {
/* this will call reduce on ourselves, hiding the window if appropiate */
- gdl_dock_item_hide_item (GDL_DOCK_ITEM (dock->priv->root));
+ if(!GDL_DOCK_ITEM_CANT_CLOSE (GDL_DOCK_ITEM (dock->priv->root))) {
+ gdl_dock_item_hide_item (GDL_DOCK_ITEM (dock->priv->root));
+ }
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]