[gnome-software] Save the application menu path in GsApp



commit e4c6792a1a697b1a314bd45b5b8a79aac5aa7246
Author: Richard Hughes <richard hughsie com>
Date:   Wed Oct 9 22:19:10 2013 +0100

    Save the application menu path in GsApp
    
    We'll need this if we want to show the menu in the details panel.

 src/gs-app.c |   25 +++++++++++++++++++++++++
 src/gs-app.h |    3 +++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 71eee79..06cae2c 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -65,6 +65,7 @@ struct GsAppPrivate
        GPtrArray               *categories;
        gchar                   *url;
        gchar                   *licence;
+       gchar                   *menu_path;
        gchar                   *update_version;
        gchar                   *update_version_ui;
        gchar                   *update_details;
@@ -202,6 +203,8 @@ gs_app_to_string (GsApp *app)
                g_string_append_printf (str, "\turl:\t%s\n", priv->url);
        if (priv->licence != NULL)
                g_string_append_printf (str, "\tlicence:\t%s\n", priv->licence);
+       if (priv->menu_path != NULL)
+               g_string_append_printf (str, "\tmenu-path:\t%s\n", priv->menu_path);
        if (priv->rating != -1)
                g_string_append_printf (str, "\trating:\t%i\n", priv->rating);
        if (priv->pixbuf != NULL)
@@ -773,6 +776,27 @@ gs_app_set_licence (GsApp *app, const gchar *licence)
 }
 
 /**
+ * gs_app_get_menu_path:
+ */
+const gchar *
+gs_app_get_menu_path (GsApp *app)
+{
+       g_return_val_if_fail (GS_IS_APP (app), NULL);
+       return app->priv->menu_path;
+}
+
+/**
+ * gs_app_set_menu_path:
+ */
+void
+gs_app_set_menu_path (GsApp *app, const gchar *menu_path)
+{
+       g_return_if_fail (GS_IS_APP (app));
+       g_free (app->priv->menu_path);
+       app->priv->menu_path = g_strdup (menu_path);
+}
+
+/**
  * gs_app_add_screenshot:
  */
 void
@@ -1261,6 +1285,7 @@ gs_app_finalize (GObject *object)
        g_free (priv->name);
        g_free (priv->url);
        g_free (priv->licence);
+       g_free (priv->menu_path);
        g_free (priv->source);
        g_free (priv->project_group);
        g_free (priv->version);
diff --git a/src/gs-app.h b/src/gs-app.h
index 38b3eff..ec129f4 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -119,6 +119,9 @@ void                 gs_app_set_url                 (GsApp          *app,
 const gchar    *gs_app_get_licence             (GsApp          *app);
 void            gs_app_set_licence             (GsApp          *app,
                                                 const gchar    *licence);
+const gchar    *gs_app_get_menu_path           (GsApp          *app);
+void            gs_app_set_menu_path           (GsApp          *app,
+                                                const gchar    *menu_path);
 GPtrArray      *gs_app_get_screenshots         (GsApp          *app);
 void            gs_app_add_screenshot          (GsApp          *app,
                                                 GsScreenshot   *screenshot);


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