[gnome-software/wip/ubuntu-3-20] Use the developer name if set in preference to the project group



commit 8de7226568abc5cae49cab256f7216dab30ff76b
Author: Richard Hughes <richard hughsie com>
Date:   Fri Mar 24 12:30:10 2017 +0000

    Use the developer name if set in preference to the project group

 src/gs-app.c                 |   36 ++++++++++++++++++++++++++++++++++++
 src/gs-app.h                 |    3 +++
 src/gs-shell-details.c       |    6 ++++--
 src/plugins/gs-plugin-snap.c |    2 +-
 4 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 564afff..424548b 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -61,6 +61,7 @@ struct _GsApp
        GPtrArray               *sources;
        GPtrArray               *source_ids;
        gchar                   *project_group;
+       gchar                   *developer_name;
        gchar                   *version;
        gchar                   *version_ui;
        gchar                   *summary;
@@ -884,6 +885,40 @@ gs_app_set_project_group (GsApp *app, const gchar *project_group)
 }
 
 /**
+ * gs_app_get_developer_name:
+ * @app: a #GsApp
+ *
+ * Gets the developer name for the application.
+ *
+ * Returns: a string, or %NULL for unset
+ *
+ * Since: 3.22
+ **/
+const gchar *
+gs_app_get_developer_name (GsApp *app)
+{
+       g_return_val_if_fail (GS_IS_APP (app), NULL);
+       return app->developer_name;
+}
+
+/**
+ * gs_app_set_developer_name:
+ * @app: a #GsApp
+ * @developer_name: The developer name, e.g. "Richard Hughes"
+ *
+ * Sets a developer name for the application.
+ *
+ * Since: 3.22
+ **/
+void
+gs_app_set_developer_name (GsApp *app, const gchar *developer_name)
+{
+       g_return_if_fail (GS_IS_APP (app));
+       g_free (app->developer_name);
+       app->developer_name = g_strdup (developer_name);
+}
+
+/**
  * gs_app_is_addon_id_kind
  **/
 static gboolean
@@ -2366,6 +2401,7 @@ gs_app_finalize (GObject *object)
        g_ptr_array_unref (app->sources);
        g_ptr_array_unref (app->source_ids);
        g_free (app->project_group);
+       g_free (app->developer_name);
        g_free (app->version);
        g_free (app->version_ui);
        g_free (app->summary);
diff --git a/src/gs-app.h b/src/gs-app.h
index 2290b30..b14c73a 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -126,6 +126,9 @@ void                 gs_app_clear_source_ids        (GsApp          *app);
 const gchar    *gs_app_get_project_group       (GsApp          *app);
 void            gs_app_set_project_group       (GsApp          *app,
                                                 const gchar    *source);
+const gchar    *gs_app_get_developer_name      (GsApp          *app);
+void            gs_app_set_developer_name      (GsApp          *app,
+                                                const gchar    *developer_name);
 const gchar    *gs_app_get_version             (GsApp          *app);
 const gchar    *gs_app_get_version_ui          (GsApp          *app);
 void            gs_app_set_version             (GsApp          *app,
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index df7a434..28f792e 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -654,8 +654,10 @@ gs_shell_details_refresh_all (GsShellDetails *self)
                gtk_widget_set_visible (self->button_details_website, FALSE);
        }
 
-       /* set the project group */
-       tmp = gs_app_get_project_group (self->app);
+       /* set the developer name, falling back to the project group */
+       tmp = gs_app_get_developer_name (self->app);
+       if (tmp == NULL)
+               tmp = gs_app_get_project_group (self->app);
        if (tmp == NULL) {
                gtk_widget_set_visible (self->label_details_developer_title, FALSE);
                gtk_widget_set_visible (self->label_details_developer_value, FALSE);
diff --git a/src/plugins/gs-plugin-snap.c b/src/plugins/gs-plugin-snap.c
index 2dcb9f7..bf7bc29 100644
--- a/src/plugins/gs-plugin-snap.c
+++ b/src/plugins/gs-plugin-snap.c
@@ -68,7 +68,7 @@ gs_plugin_initialize (GsPlugin *plugin)
                plugin->priv->store_name = g_strdup (json_object_get_string_member (system_information, 
"store"));
        else
                plugin->priv->store_name = g_strdup (/* TRANSLATORS: default snap store name */
-                                                    _("Ubuntu Store"));
+                                                    _("Snap Store"));
 
        plugin->priv->store_snaps = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                           g_free, (GDestroyNotify) json_object_unref);


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