Commit e8c0107f authored by Sebastien Granjoux's avatar Sebastien Granjoux

bgo #544988 - Iconifying should be remebered

parent 4d726f31
......@@ -382,7 +382,8 @@ update_dock_items (GdlDockBar *dockbar, gboolean full_update)
!GDL_DOCK_ITEM_ICONIFIED (item))
gdl_dock_bar_remove_item (dockbar, item);
else if (g_slist_index (dockbar->priv->items, item) == -1 &&
GDL_DOCK_ITEM_ICONIFIED (item))
GDL_DOCK_ITEM_ICONIFIED (item) &&
!gdl_dock_item_is_placeholder (item))
gdl_dock_bar_add_item (dockbar, item);
}
} else {
......@@ -391,7 +392,8 @@ update_dock_items (GdlDockBar *dockbar, gboolean full_update)
if (g_slist_index (dockbar->priv->items, item) != -1)
gdl_dock_bar_remove_item (dockbar, item);
if (GDL_DOCK_ITEM_ICONIFIED (item))
if (GDL_DOCK_ITEM_ICONIFIED (item) &&
!gdl_dock_item_is_placeholder (item))
gdl_dock_bar_add_item (dockbar, item);
}
}
......
......@@ -167,7 +167,8 @@ enum {
PROP_BEHAVIOR,
PROP_LOCKED,
PROP_PREFERRED_WIDTH,
PROP_PREFERRED_HEIGHT
PROP_PREFERRED_HEIGHT,
PROP_ICONIFIED
};
enum {
......@@ -372,8 +373,24 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
-1, G_MAXINT, -1,
G_PARAM_READWRITE));
/* signals */
/**
* GdlDockItem:iconified:
*
* If set, the dock item is hidden but it has a corresponding icon in the
* dock bar allowing to show it again.
*
* Since: 3.6
*/
g_object_class_install_property (
object_class, PROP_ICONIFIED,
g_param_spec_boolean ("iconified", _("Iconified"),
_("If set, the dock item is hidden but it has a "
"corresponding icon in the dock bar allowing to "
"show it again."),
FALSE,
G_PARAM_READWRITE |
GDL_DOCK_PARAM_EXPORT));
/**
* GdlDockItem::dock-drag-begin:
* @item: The dock item which is being dragged.
......@@ -689,6 +706,16 @@ gdl_dock_item_set_property (GObject *g_object,
case PROP_PREFERRED_HEIGHT:
item->priv->preferred_height = g_value_get_int (value);
break;
case PROP_ICONIFIED:
if (g_value_get_boolean (value)) {
if (!GDL_DOCK_ITEM_ICONIFIED (item)) gdl_dock_item_iconify_item (item);
}
else if (GDL_DOCK_ITEM_ICONIFIED (item)) {
GDL_DOCK_OBJECT_UNSET_FLAGS (item, GDL_DOCK_ICONIFIED);
gtk_widget_show (GTK_WIDGET (item));
gtk_widget_queue_resize (GTK_WIDGET (item));
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (g_object, prop_id, pspec);
break;
......@@ -722,6 +749,9 @@ gdl_dock_item_get_property (GObject *g_object,
case PROP_PREFERRED_HEIGHT:
g_value_set_int (value, item->priv->preferred_height);
break;
case PROP_ICONIFIED:
g_value_set_boolean (value, GDL_DOCK_ITEM_ICONIFIED (item));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (g_object, prop_id, pspec);
break;
......@@ -2278,6 +2308,23 @@ gdl_dock_item_or_child_has_focus (GdlDockItem *item)
return item_or_child_has_focus;
}
/**
* gdl_dock_item_is_placeholder:
* @item: The dock item to be checked
*
* Checks whether a given #GdlDockItem is a placeholder created by the
* #GdlDockLayout object and does not contain a child.
*
* Returns: %TRUE if the dock item is a placeholder
*
* Since: 3.6
*/
gboolean
gdl_dock_item_is_placeholder (GdlDockItem *item)
{
return item->child == NULL;
}
/* ----- gtk orientation type exporter/importer ----- */
......
......@@ -319,6 +319,8 @@ void gdl_dock_item_preferred_size (GdlDockItem *item,
gboolean gdl_dock_item_or_child_has_focus (GdlDockItem *item);
gboolean gdl_dock_item_is_placeholder (GdlDockItem *item);
G_END_DECLS
#endif
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