[gnome-packagekit] Resolve all remaining deprecation warnings



commit fd46938869413358d4a2665037b2185125bca760
Author: Matthias Klumpp <matthias tenstral net>
Date:   Tue Sep 27 19:15:21 2022 +0200

    Resolve all remaining deprecation warnings

 src/gpk-application.c        |  5 ++---
 src/gpk-cell-renderer-info.c |  2 +-
 src/gpk-task.c               | 19 ++++++++-----------
 src/gpk-task.h               |  1 +
 src/gpk-update-viewer.c      |  6 ++----
 5 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 7851c97f..7e07858b 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -456,7 +456,7 @@ out:
 static void
 gpk_application_menu_homepage_cb (GtkAction *action, GpkApplicationPrivate *priv)
 {
-       gtk_show_uri (NULL, priv->homepage_url, GDK_CURRENT_TIME, NULL);
+       gtk_show_uri_on_window (NULL, priv->homepage_url, GDK_CURRENT_TIME, NULL);
 }
 
 static gint
@@ -2127,8 +2127,7 @@ gpk_application_entry_text_icon_press_cb (GtkEntry *entry, GtkEntryIconPosition
        }
 
        gtk_widget_show_all (GTK_WIDGET (menu));
-       gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
-                       event->button, event->time);
+       gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent*) event);
 }
 
 static void
diff --git a/src/gpk-cell-renderer-info.c b/src/gpk-cell-renderer-info.c
index e52fe81b..cb8a7aec 100644
--- a/src/gpk-cell-renderer-info.c
+++ b/src/gpk-cell-renderer-info.c
@@ -99,7 +99,7 @@ gpk_cell_renderer_info_set_property (GObject *object, guint param_id,
                if (!ret) {
                        g_object_set (cru, "icon-name", NULL, NULL);
                } else {
-                       cru->icon_name = gpk_info_status_enum_to_icon_name (cru->value);
+                       cru->icon_name = gpk_info_status_enum_to_icon_name ((GpkInfoStatusEnum) cru->value);
                        g_object_set (cru, "icon-name", cru->icon_name, NULL);
                }
                break;
diff --git a/src/gpk-task.c b/src/gpk-task.c
index ab903ec2..5102ce10 100644
--- a/src/gpk-task.c
+++ b/src/gpk-task.c
@@ -31,8 +31,6 @@
 
 static void     gpk_task_finalize      (GObject     *object);
 
-#define GPK_TASK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_TASK, GpkTaskPrivate))
-
 struct _GpkTaskPrivate
 {
        gpointer                 user_data;
@@ -46,7 +44,8 @@ struct _GpkTaskPrivate
        const gchar             *help_id;
 };
 
-G_DEFINE_TYPE (GpkTask, gpk_task, PK_TYPE_TASK)
+G_DEFINE_TYPE_WITH_PRIVATE (GpkTask, gpk_task, PK_TYPE_TASK)
+#define GET_PRIVATE(o) (gpk_task_get_instance_private (o))
 
 gboolean
 gpk_task_set_parent_window (GpkTask *task, GtkWindow *parent_window)
@@ -92,7 +91,7 @@ gpk_task_untrusted_question (PkTask *task, guint request, PkResults *results)
        GtkWidget *widget;
        g_autofree gchar *message = NULL;
        PkRoleEnum role;
-       GpkTaskPrivate *priv = GPK_TASK(task)->priv;
+       GpkTaskPrivate *priv = GET_PRIVATE (GPK_TASK(task));
 
        /* save the current request */
        priv->request = request;
@@ -151,7 +150,7 @@ gpk_task_key_question (PkTask *task, guint request, PkResults *results)
        g_autofree gchar *key_userid = NULL;
        g_autofree gchar *key_id = NULL;
        PkRepoSignatureRequired *item;
-       GpkTaskPrivate *priv = GPK_TASK(task)->priv;
+       GpkTaskPrivate *priv = GET_PRIVATE (GPK_TASK(task));
 
        /* save the current request */
        priv->request = request;
@@ -211,7 +210,7 @@ gpk_task_eula_question (PkTask *task, guint request, PkResults *results)
        g_autofree gchar *package_id = NULL;
        g_autofree gchar *vendor_name = NULL;
        g_autofree gchar *license_agreement = NULL;
-       GpkTaskPrivate *priv = GPK_TASK(task)->priv;
+       GpkTaskPrivate *priv = GET_PRIVATE (GPK_TASK(task));
 
        /* save the current request */
        priv->request = request;
@@ -268,7 +267,7 @@ gpk_task_media_change_question (PkTask *task, guint request, PkResults *results)
        gchar *media_id;
        PkMediaTypeEnum media_type;
        gchar *media_text;
-       GpkTaskPrivate *priv = GPK_TASK(task)->priv;
+       GpkTaskPrivate *priv = GET_PRIVATE (GPK_TASK(task));
 
        /* save the current request */
        priv->request = request;
@@ -390,7 +389,7 @@ gpk_task_simulate_question (PkTask *task, guint request, PkResults *results)
 {
        gboolean ret;
        g_autoptr(GPtrArray) array = NULL;
-       GpkTaskPrivate *priv = GPK_TASK(task)->priv;
+       GpkTaskPrivate *priv = GET_PRIVATE (GPK_TASK(task));
        PkRoleEnum role;
        g_autoptr(PkPackageSack) sack = NULL;
        guint inputs;
@@ -608,14 +607,12 @@ gpk_task_class_init (GpkTaskClass *klass)
        task_class->eula_question = gpk_task_eula_question;
        task_class->media_change_question = gpk_task_media_change_question;
        task_class->simulate_question = gpk_task_simulate_question;
-
-       g_type_class_add_private (klass, sizeof (GpkTaskPrivate));
 }
 
 static void
 gpk_task_init (GpkTask *task)
 {
-       task->priv = GPK_TASK_GET_PRIVATE (task);
+       task->priv = GET_PRIVATE (task);
        task->priv->request = 0;
        task->priv->parent_window = NULL;
        task->priv->current_window = NULL;
diff --git a/src/gpk-task.h b/src/gpk-task.h
index 10c0de49..4d2c20d0 100644
--- a/src/gpk-task.h
+++ b/src/gpk-task.h
@@ -50,6 +50,7 @@ struct _GpkTaskClass
        PkTaskClass              parent_class;
 };
 
+GType           gpk_task_get_type              (void);
 GQuark          gpk_task_error_quark           (void);
 GpkTask                *gpk_task_new                   (void);
 gboolean        gpk_task_set_parent_window     (GpkTask        *task,
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 535b46f1..88623b83 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -2208,9 +2208,7 @@ gpk_update_viewer_detail_popup_menu_create (GtkWidget *treeview, GdkEventButton
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 
        gtk_widget_show_all (menu);
-       gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
-                       (event != NULL) ? event->button : 0,
-                       gdk_event_get_time((GdkEvent*)event));
+       gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent*) event);
 }
 
 static gboolean
@@ -2440,7 +2438,7 @@ gpk_update_viewer_textview_follow_link (GtkWidget *text_view, GtkTextIter *iter)
                GtkTextTag *tag = tagp->data;
                const gchar *href = (const gchar *) (g_object_get_data (G_OBJECT (tag), "href"));
                if (href != NULL)
-                       gtk_show_uri (NULL, href, GDK_CURRENT_TIME, NULL);
+                       gtk_show_uri_on_window (NULL, href, GDK_CURRENT_TIME, NULL);
        }
 
        if (tags != NULL)


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