[gedit] Remove the warning when switching to non-existing stack items.



commit c3e53c87b6499a7a83fa93189a930b66deb43aa2
Author: Steve Frécinaux <code istique net>
Date:   Tue Jan 21 09:53:27 2014 +0100

    Remove the warning when switching to non-existing stack items.

 configure.ac         |    2 +-
 gedit/gedit-window.c |   20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 68e9181..8129389 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,7 +325,7 @@ PKG_CHECK_MODULES(GEDIT, [
        libxml-2.0 >= 2.5.0
        glib-2.0 >= 2.39.3
        gio-2.0 >= 2.37.0
-       gtk+-3.0 >= 3.9.9
+       gtk+-3.0 >= 3.11.5
        gtksourceview-3.0 >= 3.11.2
        libpeas-1.0 >= 1.7.0
        libpeas-gtk-1.0 >= 1.7.0
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 9b10103..ebe3868 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2781,6 +2781,7 @@ static void
 init_panels_visibility (GeditWindow *window)
 {
        gchar *panel_page;
+       GtkWidget *panel_child;
        gboolean side_panel_visible;
        gboolean bottom_panel_visible;
 
@@ -2789,8 +2790,14 @@ init_panels_visibility (GeditWindow *window)
        /* side panel */
        panel_page = g_settings_get_string (window->priv->window_settings,
                                            GEDIT_SETTINGS_SIDE_PANEL_ACTIVE_PAGE);
-       gtk_stack_set_visible_child_name (GTK_STACK (window->priv->side_panel),
-                                         panel_page);
+       panel_child = gtk_stack_get_child_by_name (GTK_STACK (window->priv->side_panel),
+                                                  panel_page);
+       if (panel_child != NULL)
+       {
+               gtk_stack_set_visible_child (GTK_STACK (window->priv->side_panel),
+                                            panel_child);
+       }
+
        g_free (panel_page);
 
        side_panel_visible = g_settings_get_boolean (window->priv->ui_settings,
@@ -2808,8 +2815,13 @@ init_panels_visibility (GeditWindow *window)
        {
                panel_page = g_settings_get_string (window->priv->window_settings,
                                                    GEDIT_SETTINGS_BOTTOM_PANEL_ACTIVE_PAGE);
-               gtk_stack_set_visible_child_name (GTK_STACK (window->priv->bottom_panel),
-                                                 panel_page);
+               panel_child = gtk_stack_get_child_by_name (GTK_STACK (window->priv->side_panel),
+                                                          panel_page);
+               if (panel_child)
+               {
+                       gtk_stack_set_visible_child (GTK_STACK (window->priv->bottom_panel),
+                                                    panel_child);
+               }
 
                if (bottom_panel_visible)
                {


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