[gnome-builder/document-manager] GbDocumentStack: hide menu button if no documents are available.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/document-manager] GbDocumentStack: hide menu button if no documents are available.
- Date: Tue, 9 Dec 2014 01:56:53 +0000 (UTC)
commit 25145b376541de5bc3b7bb263719c502b2625b6a
Author: Christian Hergert <christian hergert me>
Date: Mon Dec 8 17:56:42 2014 -0800
GbDocumentStack: hide menu button if no documents are available.
src/documents/gb-document-stack.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/documents/gb-document-stack.c b/src/documents/gb-document-stack.c
index b0503de..fb615c5 100644
--- a/src/documents/gb-document-stack.c
+++ b/src/documents/gb-document-stack.c
@@ -118,6 +118,16 @@ gb_document_stack_remove_view (GbDocumentStack *stack,
g_signal_emit (stack, gSignals [EMPTY], 0);
}
+static gboolean
+transform_uint_to_boolean (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data)
+{
+ g_value_set_boolean (to_value, !!g_value_get_uint (from_value));
+ return TRUE;
+}
+
/**
* gb_document_stack_get_document_manager:
*
@@ -176,6 +186,11 @@ gb_document_stack_set_document_manager (GbDocumentStack *stack,
priv->document_manager = g_object_ref (document_manager);
gb_document_menu_button_set_document_manager (priv->document_button,
document_manager);
+ g_object_bind_property_full (document_manager, "count",
+ priv->document_button, "visible",
+ G_BINDING_SYNC_CREATE,
+ transform_uint_to_boolean,
+ NULL, NULL, NULL);
}
g_object_notify_by_pspec (G_OBJECT (stack),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]