Skip to content

Commit

Permalink
xapp-gtk3-module.c: Use the 'realize' signal to trigger injecting
Browse files Browse the repository at this point in the history
the favorites:// uri into the sidebar places.

It's not important where this occurs, but doing it during the
GtkPlacesSidebar constructed vfunc now causes a deadlock in the
dconf engine between the GSettings instance for favorites, and
the one for GtkFileChooserWidget settings, created during its
construction.

I've been unable to determine any particular commit that may be
to blame, between gtk, gio, meld and dconf, and I'm unable to
reproduce this anywhere but in Meld thus far.

The 'realize' signal is sent after widget construction so is
safely outside the template machinery.

Fixes #171.
  • Loading branch information
mtwebster committed Jul 25, 2023
1 parent 7945d74 commit 8570496
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libxapp/xapp-gtk3-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ static void (* original_window_realize) (GtkWidget *widget);
static void (* original_window_unrealize) (GtkWidget *widget);

static void
xapp_sidebar_constructed (GObject *object)
on_sidebar_realized (GtkWidget *widget, gpointer data)
{
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (object);
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (widget);
GSettings *fav_settings;
gchar **list;

(* original_sidebar_constructed) (object);

// This is better than initializing favorites to count.
// That way if there aren't any favorites, fav_settings
// will go away. XAppFavorites is a singleton.
Expand All @@ -47,6 +45,14 @@ xapp_sidebar_constructed (GObject *object)

g_strfreev (list);
g_object_unref (fav_settings);
g_signal_handlers_disconnect_by_func (widget, on_sidebar_realized, NULL);
}

static void
xapp_sidebar_constructed (GObject *object)
{
(* original_sidebar_constructed) (object);
g_signal_connect (object, "realize", G_CALLBACK (on_sidebar_realized), NULL);
}

static void
Expand Down

0 comments on commit 8570496

Please sign in to comment.