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>
This commit is contained in:
Ernestas Kulik 2018-07-10 15:11:46 +03:00 committed by Ondrej Holy
parent cd0299b20e
commit 0105bfb8ac

View file

@ -9403,25 +9403,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)
{
@ -9437,8 +9434,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;
@ -9674,7 +9669,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
oclass->set_property = nautilus_files_view_set_property;
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;
@ -9871,6 +9865,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);