[recipes] Add a readonly flag to chefs



commit de281b0e3a99b44f9ffca7c28b760f3b175836b4
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Dec 19 20:16:47 2016 -0500

    Add a readonly flag to chefs
    
    This will be used to mark preinstalled chefs as readonly.

 src/gr-chef.c |   23 +++++++++++++++++++++++
 src/gr-chef.h |    1 +
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-chef.c b/src/gr-chef.c
index fecdd66..3206c2f 100644
--- a/src/gr-chef.c
+++ b/src/gr-chef.c
@@ -37,6 +37,8 @@ struct _GrChef
         char *fullname;
         char *description;
         char *image_path;
+
+        gboolean readonly;
 };
 
 G_DEFINE_TYPE (GrChef, gr_chef, G_TYPE_OBJECT)
@@ -48,6 +50,7 @@ enum {
         PROP_FULLNAME,
         PROP_DESCRIPTION,
         PROP_IMAGE_PATH,
+        PROP_READONLY,
         N_PROPS
 };
 
@@ -94,6 +97,10 @@ gr_chef_get_property (GObject    *object,
                 g_value_set_string (value, self->image_path);
                 break;
 
+        case PROP_READONLY:
+                g_value_set_boolean (value, self->readonly);
+                break;
+
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         }
@@ -132,6 +139,10 @@ gr_chef_set_property (GObject      *object,
                 self->image_path = g_value_dup_string (value);
                 break;
 
+        case PROP_READONLY:
+                self->readonly = g_value_get_boolean (value);
+                break;
+
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         }
@@ -171,6 +182,11 @@ gr_chef_class_init (GrChefClass *klass)
                                      NULL,
                                      G_PARAM_READWRITE);
         g_object_class_install_property (object_class, PROP_IMAGE_PATH, pspec);
+
+        pspec = g_param_spec_boolean ("readonly", NULL, NULL,
+                                      FALSE,
+                                      G_PARAM_READWRITE);
+        g_object_class_install_property (object_class, PROP_READONLY, pspec);
 }
 
 static void
@@ -219,3 +235,10 @@ gr_chef_get_image (GrChef *chef)
 {
         return chef->image_path;
 }
+
+gboolean
+gr_chef_is_readonly (GrChef *chef)
+{
+        return chef->readonly;
+}
+
diff --git a/src/gr-chef.h b/src/gr-chef.h
index b253db5..e1288c7 100644
--- a/src/gr-chef.h
+++ b/src/gr-chef.h
@@ -34,5 +34,6 @@ const char      *gr_chef_get_name        (GrChef *chef);
 const char      *gr_chef_get_fullname    (GrChef *chef);
 const char      *gr_chef_get_description (GrChef *chef);
 const char      *gr_chef_get_image       (GrChef *chef);
+gboolean         gr_chef_is_readonly     (GrChef *chef);
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]