[gnome-software/wip/rancell/snap-auth-3-20: 56/57] Use the developer name if set in preference to the project group



commit bd485d67498916b5d5a7ea30f2fa2afcdd0c1546
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 ++++--
 3 files changed, 43 insertions(+), 2 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);


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