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



commit 93e9032ec152cff0bff5b3e556806df3568a1471
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 03845ba..20c2bca 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -69,6 +69,7 @@ struct _GsApp
        GPtrArray               *sources;
        GPtrArray               *source_ids;
        gchar                   *project_group;
+       gchar                   *developer_name;
        gchar                   *version;
        gchar                   *version_ui;
        gchar                   *summary;
@@ -1372,6 +1373,23 @@ gs_app_get_project_group (GsApp *app)
 }
 
 /**
+ * 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_project_group:
  * @app: a #GsApp
  * @project_group: The non-localized project group, e.g. "GNOME" or "KDE"
@@ -1389,6 +1407,23 @@ gs_app_set_project_group (GsApp *app, const gchar *project_group)
 }
 
 /**
+ * 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_autoptr(GMutexLocker) locker = g_mutex_locker_new (&app->mutex);
+       g_return_if_fail (GS_IS_APP (app));
+       _g_set_str (&app->developer_name, developer_name);
+}
+
+/**
  * gs_app_get_pixbuf:
  * @app: a #GsApp
  *
@@ -3582,6 +3617,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 1e90de0..2a4612b 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -144,6 +144,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    *project_group);
+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 068ee2d..1e70294 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -782,8 +782,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]