[gnome-builder] libide/tweaks: improve window reset
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/tweaks: improve window reset
- Date: Sun, 28 Aug 2022 05:01:44 +0000 (UTC)
commit 3637c9081ceacae17c5a1b33926acb5465ebaea4
Author: Christian Hergert <chergert redhat com>
Date: Sat Aug 27 21:58:17 2022 -0700
libide/tweaks: improve window reset
src/libide/tweaks/ide-tweaks-window.c | 57 +++++++++++++++++++++++------------
1 file changed, 37 insertions(+), 20 deletions(-)
---
diff --git a/src/libide/tweaks/ide-tweaks-window.c b/src/libide/tweaks/ide-tweaks-window.c
index c87b38870..2334add38 100644
--- a/src/libide/tweaks/ide-tweaks-window.c
+++ b/src/libide/tweaks/ide-tweaks-window.c
@@ -289,27 +289,11 @@ ide_tweaks_window_addin_removed_cb (PeasExtensionSet *set,
}
static void
-ide_tweaks_window_rebuild (IdeTweaksWindow *self)
+ide_tweaks_window_add_initial_list (IdeTweaksWindow *self)
{
GtkWidget *list;
g_assert (IDE_IS_TWEAKS_WINDOW (self));
- g_assert (IDE_IS_TWEAKS (self->tweaks));
- g_assert (self->addins == NULL);
-
- /* Allow addins to extend the tweaks instance */
- self->addins = peas_extension_set_new (peas_engine_get_default (),
- IDE_TYPE_TWEAKS_ADDIN,
- NULL);
- g_signal_connect (self->addins,
- "extension-added",
- G_CALLBACK (ide_tweaks_window_addin_added_cb),
- self);
- g_signal_connect (self->addins,
- "extension-removed",
- G_CALLBACK (ide_tweaks_window_addin_removed_cb),
- self);
- peas_extension_set_foreach (self->addins, ide_tweaks_window_addin_added_cb, self);
/* Now create our list for toplevel pages */
list = ide_tweaks_panel_list_new (IDE_TWEAKS_ITEM (self->tweaks));
@@ -327,6 +311,30 @@ ide_tweaks_window_rebuild (IdeTweaksWindow *self)
ide_tweaks_panel_list_set_selection_mode (IDE_TWEAKS_PANEL_LIST (list), GTK_SELECTION_NONE);
else
ide_tweaks_panel_list_select_first (IDE_TWEAKS_PANEL_LIST (list));
+}
+
+static void
+ide_tweaks_window_rebuild (IdeTweaksWindow *self)
+{
+ g_assert (IDE_IS_TWEAKS_WINDOW (self));
+ g_assert (IDE_IS_TWEAKS (self->tweaks));
+ g_assert (self->addins == NULL);
+
+ /* Allow addins to extend the tweaks instance */
+ self->addins = peas_extension_set_new (peas_engine_get_default (),
+ IDE_TYPE_TWEAKS_ADDIN,
+ NULL);
+ g_signal_connect (self->addins,
+ "extension-added",
+ G_CALLBACK (ide_tweaks_window_addin_added_cb),
+ self);
+ g_signal_connect (self->addins,
+ "extension-removed",
+ G_CALLBACK (ide_tweaks_window_addin_removed_cb),
+ self);
+ peas_extension_set_foreach (self->addins, ide_tweaks_window_addin_added_cb, self);
+
+ ide_tweaks_window_add_initial_list (self);
ide_tweaks_window_update_title (self);
ide_tweaks_window_update_actions (self);
@@ -754,8 +762,17 @@ ide_tweaks_window_navigate_initial (IdeTweaksWindow *self)
if (self->tweaks != NULL)
{
- ide_tweaks_window_clear (self);
- ide_action_muxer_remove_all (self->muxer);
- ide_tweaks_window_rebuild (self);
+ GtkWidget *child;
+
+ while (ide_tweaks_window_get_can_navigate_back (self))
+ ide_tweaks_window_navigate_back (self);
+
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (self->panel_list_stack))))
+ gtk_stack_remove (self->panel_list_stack, child);
+
+ ide_tweaks_window_add_initial_list (self);
+
+ ide_tweaks_window_update_title (self);
+ ide_tweaks_window_update_actions (self);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]