[gnome-software: 2/3] gs-app: Rename get_origin_ui() to dup_origin_ui()




commit e18d92fefb929af21eefb54ac97419b79bf303ad
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu May 12 13:38:09 2022 +0100

    gs-app: Rename get_origin_ui() to dup_origin_ui()
    
    This better reflects the fact that it returns a newly allocated string.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-app.c                    | 10 +++++-----
 lib/gs-app.h                    |  2 +-
 plugins/epiphany/gs-self-test.c |  2 +-
 src/gs-common.c                 |  2 +-
 src/gs-details-page.c           | 10 +++++-----
 src/gs-origin-popover-row.c     |  2 +-
 src/gs-repos-dialog.c           |  2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index efbdb5eed..7dfb6e02f 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -5027,7 +5027,7 @@ gs_app_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *
                g_value_take_boxed (value, gs_app_get_relations (app));
                break;
        case PROP_ORIGIN_UI:
-               g_value_take_string (value, gs_app_get_origin_ui (app));
+               g_value_take_string (value, gs_app_dup_origin_ui (app));
                break;
        case PROP_HAS_TRANSLATIONS:
                g_value_set_boolean (value, gs_app_get_has_translations (app));
@@ -5715,18 +5715,18 @@ gs_app_new_from_unique_id (const gchar *unique_id)
 }
 
 /**
- * gs_app_get_origin_ui:
+ * gs_app_dup_origin_ui:
  * @app: a #GsApp
  *
  * Gets the package origin that's suitable for UI use. i.e. The value of
  * #GsApp:origin-ui.
  *
- * Returns: (not nullable): The package origin for UI use
+ * Returns: (not nullable) (transfer full): The package origin for UI use
  *
- * Since: 3.32
+ * Since: 43
  **/
 gchar *
-gs_app_get_origin_ui (GsApp *app)
+gs_app_dup_origin_ui (GsApp *app)
 {
        GsAppPrivate *priv;
        g_autoptr(GMutexLocker) locker = NULL;
diff --git a/lib/gs-app.h b/lib/gs-app.h
index 54e6bd430..e5e64272a 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -481,7 +481,7 @@ void                 gs_app_remove_quirk            (GsApp          *app,
                                                 GsAppQuirk      quirk);
 gboolean        gs_app_is_installed            (GsApp          *app);
 gboolean        gs_app_is_updatable            (GsApp          *app);
-gchar          *gs_app_get_origin_ui           (GsApp          *app);
+gchar          *gs_app_dup_origin_ui           (GsApp          *app);
 void            gs_app_set_origin_ui           (GsApp          *app,
                                                 const gchar    *origin_ui);
 gchar          *gs_app_get_packaging_format    (GsApp          *app);
diff --git a/plugins/epiphany/gs-self-test.c b/plugins/epiphany/gs-self-test.c
index 49d468bbf..89f384359 100644
--- a/plugins/epiphany/gs-self-test.c
+++ b/plugins/epiphany/gs-self-test.c
@@ -174,7 +174,7 @@ gs_plugins_epiphany_installed_func (GsPluginLoader *plugin_loader)
        g_assert_cmpstr (gs_app_get_name (app), ==, "Pinafore");
        g_assert_cmpstr (gs_app_get_summary (app), ==, "pinafore.social");
        g_assert_cmpstr (gs_app_get_origin (app), ==, "gnome-web");
-       origin_ui = gs_app_get_origin_ui (app);
+       origin_ui = gs_app_dup_origin_ui (app);
        g_assert_cmpstr (origin_ui, ==, "GNOME Web");
        icon = gs_app_get_icon_for_size (app, 4096, 1, NULL);
        g_assert_nonnull (icon);
diff --git a/src/gs-common.c b/src/gs-common.c
index 2c4fc7789..5cfc055ee 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -287,7 +287,7 @@ gs_app_notify_unavailable (GsApp *app, GtkWindow *parent)
        gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), title->str);
 
        body = g_string_new ("");
-       origin_ui = gs_app_get_origin_ui (app);
+       origin_ui = gs_app_dup_origin_ui (app);
 
        if (hint & GS_APP_LICENSE_NONFREE) {
                g_string_append_printf (body,
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index fe0f38dc1..7c1130e6d 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -259,7 +259,7 @@ gs_details_page_update_origin_button (GsDetailsPage *self,
                return;
        }
 
-       origin_ui = gs_app_get_origin_ui (self->app);
+       origin_ui = gs_app_dup_origin_ui (self->app);
        if (origin_ui != NULL)
                gtk_menu_button_set_label (GTK_MENU_BUTTON (self->origin_button), origin_ui);
        else
@@ -529,8 +529,8 @@ app_origin_equal (GsApp *a,
        if (a == b)
                return TRUE;
 
-       a_origin_ui = gs_app_get_origin_ui (a);
-       b_origin_ui = gs_app_get_origin_ui (b);
+       a_origin_ui = gs_app_dup_origin_ui (a);
+       b_origin_ui = gs_app_dup_origin_ui (b);
 
        a_local_file = gs_app_get_local_file (a);
        b_local_file = gs_app_get_local_file (b);
@@ -1704,8 +1704,8 @@ origin_popover_list_sort_func (GtkListBoxRow *a,
 {
        GsApp *a1 = gs_origin_popover_row_get_app (GS_ORIGIN_POPOVER_ROW (a));
        GsApp *a2 = gs_origin_popover_row_get_app (GS_ORIGIN_POPOVER_ROW (b));
-       g_autofree gchar *a1_origin = gs_app_get_origin_ui (a1);
-       g_autofree gchar *a2_origin = gs_app_get_origin_ui (a2);
+       g_autofree gchar *a1_origin = gs_app_dup_origin_ui (a1);
+       g_autofree gchar *a2_origin = gs_app_dup_origin_ui (a2);
 
        return gs_utils_sort_strcmp (a1_origin, a2_origin);
 }
diff --git a/src/gs-origin-popover-row.c b/src/gs-origin-popover-row.c
index b03d667d1..eae58cf86 100644
--- a/src/gs-origin-popover-row.c
+++ b/src/gs-origin-popover-row.c
@@ -43,7 +43,7 @@ refresh_ui (GsOriginPopoverRow *row)
        g_assert (GS_IS_ORIGIN_POPOVER_ROW (row));
        g_assert (GS_IS_APP (priv->app));
 
-       origin_ui = gs_app_get_origin_ui (priv->app);
+       origin_ui = gs_app_dup_origin_ui (priv->app);
        if (origin_ui != NULL) {
                gtk_label_set_text (GTK_LABEL (priv->name_label), origin_ui);
        }
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index e12a4ac5e..7bd94264d 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -374,7 +374,7 @@ add_repo (GsReposDialog *dialog,
                return;
        }
 
-       origin_ui = gs_app_get_origin_ui (repo);
+       origin_ui = gs_app_dup_origin_ui (repo);
        if (!origin_ui)
                origin_ui = gs_app_get_packaging_format (repo);
        if (!origin_ui) {


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