[recipes] Add a contributed property to GrRecipe
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Add a contributed property to GrRecipe
- Date: Sun, 19 Feb 2017 16:52:14 +0000 (UTC)
commit eef542427e33f5474ceabe3a66ace742278d18f8
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Feb 19 10:44:05 2017 -0500
Add a contributed property to GrRecipe
This will detangle readonly-ness from contribution.
src/gr-recipe.c | 22 ++++++++++++++++++++++
src/gr-recipe.h | 1 +
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index ca2cfcc..8725ccf 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -62,6 +62,7 @@ struct _GrRecipe
int spiciness;
gboolean readonly;
+ gboolean contributed;
char *translated_name;
char *translated_description;
@@ -92,6 +93,7 @@ enum {
PROP_CTIME,
PROP_MTIME,
PROP_READONLY,
+ PROP_CONTRIBUTED,
N_PROPS
};
@@ -216,6 +218,10 @@ gr_recipe_get_property (GObject *object,
g_value_set_boolean (value, self->readonly);
break;
+ case PROP_CONTRIBUTED:
+ g_value_set_boolean (value, self->contributed);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -389,6 +395,11 @@ gr_recipe_set_property (GObject *object,
update_mtime (self);
break;
+ case PROP_CONTRIBUTED:
+ self->contributed = g_value_get_boolean (value);
+ update_mtime (self);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -503,6 +514,11 @@ gr_recipe_class_init (GrRecipeClass *klass)
FALSE,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_READONLY, pspec);
+
+ pspec = g_param_spec_boolean ("contributed", NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_CONTRIBUTED, pspec);
}
static void
@@ -670,6 +686,12 @@ gr_recipe_is_readonly (GrRecipe *recipe)
return recipe->readonly;
}
+gboolean
+gr_recipe_is_contributed (GrRecipe *recipe)
+{
+ return recipe->contributed;
+}
+
/* terms are assumed to be g_utf8_casefold'ed where appropriate */
gboolean
gr_recipe_matches (GrRecipe *recipe,
diff --git a/src/gr-recipe.h b/src/gr-recipe.h
index daaaf44..1b21538 100644
--- a/src/gr-recipe.h
+++ b/src/gr-recipe.h
@@ -54,6 +54,7 @@ int gr_recipe_get_default_image (GrRecipe *recipe);
GDateTime *gr_recipe_get_ctime (GrRecipe *recipe);
GDateTime *gr_recipe_get_mtime (GrRecipe *recipe);
gboolean gr_recipe_is_readonly (GrRecipe *recipe);
+gboolean gr_recipe_is_contributed (GrRecipe *recipe);
const char *gr_recipe_get_translated_name (GrRecipe *recipe);
const char *gr_recipe_get_translated_description (GrRecipe *recipe);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]