[gnome-software] Use the developer name if set in preference to the project group
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Use the developer name if set in preference to the project group
- Date: Fri, 24 Mar 2017 12:31:19 +0000 (UTC)
commit aebd7262e4fb62006643e3a4d9c0df915df8e9f5
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
lib/gs-app.c | 36 ++++++++++++++++++++++++++++++++++++
lib/gs-app.h | 3 +++
plugins/core/gs-appstream.c | 5 +++++
src/gs-details-page.c | 6 ++++--
4 files changed, 48 insertions(+), 2 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index bde06d7..0bb6140 100644
--- a/lib/gs-app.c
+++ b/lib/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;
@@ -1378,6 +1379,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"
@@ -1395,6 +1413,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
*
@@ -3616,6 +3651,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/lib/gs-app.h b/lib/gs-app.h
index f7a27f5..284a90e 100644
--- a/lib/gs-app.h
+++ b/lib/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/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index 578a5d9..ed66f5b 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -725,6 +725,11 @@ gs_appstream_refine_app (GsPlugin *plugin,
gs_app_get_project_group (app) == NULL)
gs_app_set_project_group (app, as_app_get_project_group (item));
+ /* set developer name */
+ if (gs_app_get_developer_name (app) == NULL &&
+ as_app_get_developer_name (item, NULL) != NULL)
+ gs_app_set_developer_name (app, as_app_get_developer_name (item, NULL));
+
/*
* Set the core applications for the current desktop that cannot be
* removed -- but note: XDG_CURRENT_DESKTOP="GNOME" is different to
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index f65c397..c8a271e 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -788,8 +788,10 @@ gs_details_page_refresh_all (GsDetailsPage *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]