[nautilus/wip/antoniof/gtk4-preparation-drop-outgoing-api: 61/74] files-view: Handle parent changes in GObject::notify
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-drop-outgoing-api: 61/74] files-view: Handle parent changes in GObject::notify
- Date: Sun, 17 Oct 2021 12:24:51 +0000 (UTC)
commit 2f27d1262490b3b4008bc71324d165fc5927251b
Author: Ernestas Kulik <ernestask gnome org>
Date: Tue Jul 10 15:11:46 2018 +0300
files-view: Handle parent changes in GObject::notify
GtkWidget::parent-set is gone in GTK4.
Rebased and ammended by António Fernandes <antoniof gnome org>
src/nautilus-files-view.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 4e57ae61e..43a132df3 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -9447,25 +9447,22 @@ action_stop_enabled_changed (GActionGroup *action_group,
}
static void
-nautilus_files_view_parent_set (GtkWidget *widget,
- GtkWidget *old_parent)
+on_parent_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
{
+ GtkWidget *widget;
NautilusWindow *window;
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
GtkWidget *parent;
- view = NAUTILUS_FILES_VIEW (widget);
+ widget = GTK_WIDGET (object);
+ view = NAUTILUS_FILES_VIEW (object);
priv = nautilus_files_view_get_instance_private (view);
parent = gtk_widget_get_parent (widget);
window = nautilus_files_view_get_window (view);
- g_assert (parent == NULL || old_parent == NULL);
-
- if (GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->parent_set != NULL)
- {
- GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->parent_set (widget, old_parent);
- }
if (priv->stop_signal_handler > 0)
{
@@ -9481,8 +9478,6 @@ nautilus_files_view_parent_set (GtkWidget *widget,
if (parent != NULL)
{
- g_assert (old_parent == NULL);
-
if (priv->slot == nautilus_window_get_active_slot (window))
{
priv->active = TRUE;
@@ -9718,7 +9713,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
widget_class->destroy = nautilus_files_view_destroy;
widget_class->event = nautilus_files_view_event;
- widget_class->parent_set = nautilus_files_view_parent_set;
widget_class->grab_focus = nautilus_files_view_grab_focus;
@@ -9915,6 +9909,10 @@ nautilus_files_view_init (NautilusFilesView *view)
"notify::selection",
G_CALLBACK (nautilus_files_view_preview_update),
view);
+ g_signal_connect (view,
+ "notify::parent",
+ G_CALLBACK (on_parent_changed),
+ NULL);
g_object_unref (builder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]