[gnome-photos] base-manager: Add an optional action ID
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-manager: Add an optional action ID
- Date: Wed, 11 Mar 2015 09:04:47 +0000 (UTC)
commit 7d858930e0931cce494d1c961bc5431ebd9712e4
Author: Alessandro Bono <shadow openaliasbox org>
Date: Tue Mar 10 00:15:26 2015 +0100
base-manager: Add an optional action ID
We're going to use this to build GActions/GMenuModels for the various
search options.
https://bugzilla.gnome.org/show_bug.cgi?id=726462
src/photos-base-manager.c | 28 ++++++++++++++++++++++++++--
src/photos-base-manager.h | 2 ++
src/photos-search-match-manager.c | 1 +
src/photos-search-type-manager.c | 5 ++++-
4 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index b1f0328..ffe27f9 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -35,12 +35,14 @@ struct _PhotosBaseManagerPrivate
{
GHashTable *objects;
GObject *active_object;
+ gchar *action_id;
gchar *title;
};
enum
{
PROP_0,
+ PROP_ACTION_ID,
PROP_TITLE
};
@@ -146,8 +148,10 @@ static void
photos_base_manager_finalize (GObject *object)
{
PhotosBaseManager *self = PHOTOS_BASE_MANAGER (object);
+ PhotosBaseManagerPrivate *priv = self->priv;
- g_free (self->priv->title);
+ g_free (priv->action_id);
+ g_free (priv->title);
G_OBJECT_CLASS (photos_base_manager_parent_class)->finalize (object);
}
@@ -157,11 +161,16 @@ static void
photos_base_manager_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
PhotosBaseManager *self = PHOTOS_BASE_MANAGER (object);
+ PhotosBaseManagerPrivate *priv = self->priv;
switch (prop_id)
{
+ case PROP_ACTION_ID:
+ priv->action_id = g_value_dup_string (value);
+ break;
+
case PROP_TITLE:
- self->priv->title = g_value_dup_string (value);
+ priv->title = g_value_dup_string (value);
break;
default:
@@ -198,6 +207,14 @@ photos_base_manager_class_init (PhotosBaseManagerClass *class)
class->set_active_object = photos_base_manager_default_set_active_object;
g_object_class_install_property (object_class,
+ PROP_ACTION_ID,
+ g_param_spec_string ("action_id",
+ "Action ID",
+ "GAction ID for search options",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (object_class,
PROP_TITLE,
g_param_spec_string ("title",
"Title",
@@ -272,6 +289,13 @@ photos_base_manager_clear (PhotosBaseManager *self)
}
+const gchar *
+photos_base_manager_get_action_id (PhotosBaseManager *self)
+{
+ return self->priv->action_id;
+}
+
+
GObject *
photos_base_manager_get_active_object (PhotosBaseManager *self)
{
diff --git a/src/photos-base-manager.h b/src/photos-base-manager.h
index 1a28cb2..22d8e7d 100644
--- a/src/photos-base-manager.h
+++ b/src/photos-base-manager.h
@@ -85,6 +85,8 @@ void photos_base_manager_add_object (PhotosBaseMana
void photos_base_manager_clear (PhotosBaseManager *self);
+const gchar *photos_base_manager_get_action_id (PhotosBaseManager *self);
+
GObject *photos_base_manager_get_active_object (PhotosBaseManager *self);
gchar *photos_base_manager_get_all_filter (PhotosBaseManager *self);
diff --git a/src/photos-search-match-manager.c b/src/photos-search-match-manager.c
index 182ee36..6410b98 100644
--- a/src/photos-search-match-manager.c
+++ b/src/photos-search-match-manager.c
@@ -201,6 +201,7 @@ photos_search_match_manager_new (PhotosSearchController *srch_cntrlr)
* "Author", as in "Match All", "Match Title" and "Match Author".
*/
return g_object_new (PHOTOS_TYPE_SEARCH_MATCH_MANAGER,
+ "action-id", "search-match",
"search-controller", srch_cntrlr,
"title", _("Match"),
NULL);
diff --git a/src/photos-search-type-manager.c b/src/photos-search-type-manager.c
index 8364cd9..4c1c221 100644
--- a/src/photos-search-type-manager.c
+++ b/src/photos-search-type-manager.c
@@ -151,5 +151,8 @@ photos_search_type_manager_new (void)
/* Translators: "Type" refers to a search filter. eg., All, Albums,
* Favorites and Photos.
*/
- return g_object_new (PHOTOS_TYPE_SEARCH_TYPE_MANAGER, "title", C_("Search Filter", "Type"), NULL);
+ return g_object_new (PHOTOS_TYPE_SEARCH_TYPE_MANAGER,
+ "action-id", "search-type",
+ "title", C_("Search Filter", "Type"),
+ NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]