[gnome-builder] add GbView:modified property
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] add GbView:modified property
- Date: Tue, 24 Mar 2015 00:32:40 +0000 (UTC)
commit f307d0881189c8fec6abc4c21975d4daa32fbc76
Author: Christian Hergert <christian hergert me>
Date: Sat Mar 21 15:09:09 2015 -0700
add GbView:modified property
this is primary a proxy from the underlying document, but it helps so that
UI code doesn't need to attach/detacth when documents "may" be changed
out from under them.
src/views/gb-view.c | 25 +++++++++++++++++++++++++
src/views/gb-view.h | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/views/gb-view.c b/src/views/gb-view.c
index 12ad936..6d4e08c 100644
--- a/src/views/gb-view.c
+++ b/src/views/gb-view.c
@@ -35,6 +35,7 @@ enum {
PROP_0,
PROP_CAN_SPLIT,
PROP_DOCUMENT,
+ PROP_MODIFIED,
PROP_TITLE,
LAST_PROP
};
@@ -188,6 +189,17 @@ gb_view_navigate_to (GbView *self,
GB_VIEW_GET_CLASS (self)->navigate_to (self, location);
}
+gboolean
+gb_view_get_modified (GbView *self)
+{
+ g_return_val_if_fail (GB_IS_VIEW (self), FALSE);
+
+ if (GB_VIEW_GET_CLASS (self)->get_modified)
+ return GB_VIEW_GET_CLASS (self)->get_modified (self);
+
+ return FALSE;
+}
+
static void
gb_view_destroy (GtkWidget *widget)
{
@@ -217,6 +229,10 @@ gb_view_get_property (GObject *object,
g_value_set_object (value, gb_view_get_document (self));
break;
+ case PROP_MODIFIED:
+ g_value_set_boolean (value, gb_view_get_modified (self));
+ break;
+
case PROP_TITLE:
g_value_set_string (value, gb_view_get_title (self));
break;
@@ -253,6 +269,15 @@ gb_view_class_init (GbViewClass *klass)
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_DOCUMENT, gParamSpecs [PROP_DOCUMENT]);
+ gParamSpecs [PROP_MODIFIED] =
+ g_param_spec_boolean ("modified",
+ _("Modified"),
+ _("If the document has been modified."),
+ FALSE,
+ (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_MODIFIED,
+ gParamSpecs [PROP_MODIFIED]);
+
gParamSpecs [PROP_TITLE] =
g_param_spec_string ("title",
_("Title"),
diff --git a/src/views/gb-view.h b/src/views/gb-view.h
index ecdb7a7..9e3647d 100644
--- a/src/views/gb-view.h
+++ b/src/views/gb-view.h
@@ -37,6 +37,7 @@ struct _GbViewClass
gboolean (*get_can_preview) (GbView *self);
gboolean (*get_can_split) (GbView *self);
GbDocument *(*get_document) (GbView *self);
+ gboolean (*get_modified) (GbView *self);
const gchar *(*get_title) (GbView *self);
GbView *(*create_split) (GbView *self);
void (*set_split_view) (GbView *self,
@@ -53,6 +54,7 @@ gboolean gb_view_get_can_split (GbView *self);
GbDocument *gb_view_get_document (GbView *self);
const gchar *gb_view_get_title (GbView *self);
GtkWidget *gb_view_get_controls (GbView *self);
+gboolean gb_view_get_modified (GbView *self);
void gb_view_set_split_view (GbView *self,
gboolean split_view);
void gb_view_set_back_forward_list (GbView *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]