[gnome-builder] tab: add GbTab:dirty.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] tab: add GbTab:dirty.
- Date: Tue, 9 Sep 2014 08:26:14 +0000 (UTC)
commit fa1d43c0942e8d36ebbf9862dd2155d221d34467
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 9 01:24:15 2014 -0700
tab: add GbTab:dirty.
src/tabs/gb-tab.c | 41 +++++++++++++++++++++++++++++++++++++++--
src/tabs/gb-tab.h | 4 +++-
2 files changed, 42 insertions(+), 3 deletions(-)
---
diff --git a/src/tabs/gb-tab.c b/src/tabs/gb-tab.c
index 8703b34..47d1e10 100644
--- a/src/tabs/gb-tab.c
+++ b/src/tabs/gb-tab.c
@@ -22,12 +22,14 @@
struct _GbTabPrivate
{
- gchar *icon_name;
- gchar *title;
+ gchar *icon_name;
+ gchar *title;
+ gboolean dirty;
};
enum {
PROP_0,
+ PROP_DIRTY,
PROP_ICON_NAME,
PROP_TITLE,
LAST_PROP
@@ -45,6 +47,24 @@ G_DEFINE_TYPE_WITH_PRIVATE (GbTab, gb_tab, GTK_TYPE_BOX)
static GParamSpec *gParamSpecs [LAST_PROP];
static guint gSignals [LAST_SIGNAL];
+gboolean
+gb_tab_get_dirty (GbTab *tab)
+{
+ g_return_val_if_fail (GB_IS_TAB (tab), FALSE);
+
+ return tab->priv->dirty;
+}
+
+void
+gb_tab_set_dirty (GbTab *tab,
+ gboolean dirty)
+{
+ g_return_if_fail (GB_IS_TAB (tab));
+
+ tab->priv->dirty = dirty;
+ g_object_notify_by_pspec (G_OBJECT (tab), gParamSpecs [PROP_DIRTY]);
+}
+
void
gb_tab_close (GbTab *tab)
{
@@ -130,6 +150,10 @@ gb_tab_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_DIRTY:
+ g_value_set_boolean (value, gb_tab_get_dirty (tab));
+ break;
+
case PROP_ICON_NAME:
g_value_set_string (value, gb_tab_get_icon_name (tab));
break;
@@ -153,6 +177,10 @@ gb_tab_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_DIRTY:
+ gb_tab_set_dirty (tab, g_value_get_boolean (value));
+ break;
+
case PROP_ICON_NAME:
gb_tab_set_icon_name (tab, g_value_get_string (value));
break;
@@ -176,6 +204,15 @@ gb_tab_class_init (GbTabClass *klass)
object_class->get_property = gb_tab_get_property;
object_class->set_property = gb_tab_set_property;
+ gParamSpecs [PROP_DIRTY] =
+ g_param_spec_boolean ("dirty",
+ _("Dirty"),
+ _("If the tab has dirty state."),
+ FALSE,
+ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_DIRTY,
+ gParamSpecs [PROP_DIRTY]);
+
gParamSpecs[PROP_ICON_NAME] =
g_param_spec_string ("icon-name",
_ ("Icon Name"),
diff --git a/src/tabs/gb-tab.h b/src/tabs/gb-tab.h
index a8c0376..5f98e3e 100644
--- a/src/tabs/gb-tab.h
+++ b/src/tabs/gb-tab.h
@@ -59,7 +59,9 @@ void gb_tab_set_title (GbTab *tab,
const gchar *gb_tab_get_icon_name (GbTab *tab);
void gb_tab_set_icon_name (GbTab *tab,
const gchar *icon_name);
-
+gboolean gb_tab_get_dirty (GbTab *tab);
+void gb_tab_set_dirty (GbTab *tab,
+ gboolean dirty);
void gb_tab_freeze_drag (GbTab *tab);
void gb_tab_thaw_drag (GbTab *tab);
void gb_tab_close (GbTab *tab);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]