[gedit/wip/panels-as-stacks: 17/19] Replace GeditPanel with GtkStacks.



commit 7a46766392d8c24dd6a494f4aa480a06f8f38ccb
Author: Steve Frécinaux <code istique net>
Date:   Sun Jan 19 22:48:29 2014 +0100

    Replace GeditPanel with GtkStacks.
    
    This reduces the amount of gedit-specific code and lets us manage the
    panel layout from the gedit-window.ui file.

 gedit/Makefile.am                                |    2 -
 gedit/gedit-commands-view.c                      |   14 +-
 gedit/gedit-panel.c                              |  710 ----------------------
 gedit/gedit-panel.h                              |  131 ----
 gedit/gedit-window-private.h                     |    2 +
 gedit/gedit-window.c                             |  136 +++--
 gedit/gedit-window.h                             |    5 +-
 gedit/gedit-window.ui                            |   67 ++-
 plugins/externaltools/tools/windowactivatable.py |    7 +-
 plugins/filebrowser/gedit-file-browser-plugin.c  |   17 +-
 plugins/pythonconsole/pythonconsole/__init__.py  |    8 +-
 11 files changed, 159 insertions(+), 940 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 28d1697..cc5aa17 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -149,7 +149,6 @@ gedit_INST_H_FILES =                                \
        gedit/gedit-menu-extension.h            \
        gedit/gedit-message-bus.h               \
        gedit/gedit-message.h                   \
-       gedit/gedit-panel.h                     \
        gedit/gedit-progress-info-bar.h         \
        gedit/gedit-statusbar.h                 \
        gedit/gedit-tab.h                       \
@@ -206,7 +205,6 @@ gedit_libgedit_c_files =                    \
        gedit/gedit-notebook.c                  \
        gedit/gedit-notebook-popup-menu.c       \
        gedit/gedit-open-menu-button.c          \
-       gedit/gedit-panel.c                     \
        gedit/gedit-plugins-engine.c            \
        gedit/gedit-preferences-dialog.c        \
        gedit/gedit-print-job.c                 \
diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
index edfb891..376312c 100644
--- a/gedit/gedit-commands-view.c
+++ b/gedit/gedit-commands-view.c
@@ -48,7 +48,7 @@ _gedit_cmd_view_toggle_side_panel (GSimpleAction *action,
                                    gpointer       user_data)
 {
        GeditWindow *window = GEDIT_WINDOW (user_data);
-       GeditPanel *panel;
+       GtkWidget *panel;
        gboolean visible;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -56,11 +56,11 @@ _gedit_cmd_view_toggle_side_panel (GSimpleAction *action,
        panel = gedit_window_get_side_panel (window);
 
        visible = g_variant_get_boolean (state);
-       gtk_widget_set_visible (GTK_WIDGET (panel), visible);
+       gtk_widget_set_visible (panel, visible);
 
        if (visible)
        {
-               gtk_widget_grab_focus (GTK_WIDGET (panel));
+               gtk_widget_grab_focus (panel);
        }
 
        g_simple_action_set_state (action, state);
@@ -72,19 +72,19 @@ _gedit_cmd_view_toggle_bottom_panel (GSimpleAction *action,
                                      gpointer       user_data)
 {
        GeditWindow *window = GEDIT_WINDOW (user_data);
-       GeditPanel *panel;
+       GtkWidget *panel_box;
        gboolean visible;
 
        gedit_debug (DEBUG_COMMANDS);
 
-       panel = gedit_window_get_bottom_panel (window);
+       panel_box = window->priv->bottom_panel_box;
 
        visible = g_variant_get_boolean (state);
-       gtk_widget_set_visible (GTK_WIDGET (panel), visible);
+       gtk_widget_set_visible (panel_box, visible);
 
        if (visible)
        {
-               gtk_widget_grab_focus (GTK_WIDGET (panel));
+               gtk_widget_grab_focus (window->priv->bottom_panel);
        }
 
        g_simple_action_set_state (action, state);
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 9508ddf..8f25b82 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -55,6 +55,8 @@ struct _GeditWindowPrivate
        GeditMultiNotebook *multi_notebook;
 
        GtkWidget      *side_panel;
+       GtkWidget      *bottom_panel_box;
+       GtkWidget      *bottom_panel_close_button;
        GtkWidget      *bottom_panel;
 
        GtkWidget      *hpaned;
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 09492d4..07e752e 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -52,7 +52,6 @@
 #include "gedit-commands.h"
 #include "gedit-debug.h"
 #include "gedit-open-menu-button.h"
-#include "gedit-panel.h"
 #include "gedit-documents-panel.h"
 #include "gedit-plugins-engine.h"
 #include "gedit-window-activatable.h"
@@ -123,7 +122,7 @@ gedit_window_get_property (GObject    *object,
 static void
 save_panels_state (GeditWindow *window)
 {
-       gint panel_page;
+       const gchar *panel_page;
 
        gedit_debug (DEBUG_WINDOW);
 
@@ -134,12 +133,12 @@ save_panels_state (GeditWindow *window)
                                    window->priv->side_panel_size);
        }
 
-       panel_page = _gedit_panel_get_active_item_id (GEDIT_PANEL (window->priv->side_panel));
-       if (panel_page != 0)
+       panel_page = gtk_stack_get_visible_child_name (GTK_STACK (window->priv->side_panel));
+       if (panel_page != NULL)
        {
-               g_settings_set_int (window->priv->window_settings,
-                                   GEDIT_SETTINGS_SIDE_PANEL_ACTIVE_PAGE,
-                                   panel_page);
+               g_settings_set_string (window->priv->window_settings,
+                                      GEDIT_SETTINGS_SIDE_PANEL_ACTIVE_PAGE,
+                                      panel_page);
        }
 
        if (window->priv->bottom_panel_size > 0)
@@ -149,11 +148,12 @@ save_panels_state (GeditWindow *window)
                                    window->priv->bottom_panel_size);
        }
 
-       panel_page = _gedit_panel_get_active_item_id (GEDIT_PANEL (window->priv->bottom_panel));
-       if (panel_page != 0)
+       panel_page = gtk_stack_get_visible_child_name (GTK_STACK (window->priv->bottom_panel));
+       if (panel_page != NULL)
        {
-               g_settings_set_int (window->priv->window_settings,
-                                   GEDIT_SETTINGS_BOTTOM_PANEL_ACTIVE_PAGE, panel_page);
+               g_settings_set_string (window->priv->window_settings,
+                                      GEDIT_SETTINGS_BOTTOM_PANEL_ACTIVE_PAGE,
+                                      panel_page);
        }
 
        g_settings_apply (window->priv->window_settings);
@@ -431,8 +431,11 @@ gedit_window_class_init (GeditWindowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_menu_app);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, hpaned);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_panel);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_stack_switcher);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, vpaned);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, multi_notebook);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, bottom_panel_box);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, bottom_panel_close_button);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, bottom_panel);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, statusbar);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, fullscreen_controls);
@@ -989,7 +992,7 @@ clone_window (GeditWindow *origin)
        GeditWindow *window;
        GdkScreen *screen;
        GeditApp  *app;
-       gint panel_page;
+       const gchar *panel_page;
 
        gedit_debug (DEBUG_WINDOW);
 
@@ -1017,18 +1020,16 @@ clone_window (GeditWindow *origin)
        window->priv->side_panel_size = origin->priv->side_panel_size;
        window->priv->bottom_panel_size = origin->priv->bottom_panel_size;
 
-       panel_page = _gedit_panel_get_active_item_id (GEDIT_PANEL (origin->priv->side_panel));
-       _gedit_panel_set_active_item_by_id (GEDIT_PANEL (window->priv->side_panel),
-                                           panel_page);
+       panel_page = gtk_stack_get_visible_child_name (GTK_STACK (origin->priv->side_panel));
+       gtk_stack_set_visible_child_name (GTK_STACK (window->priv->side_panel), panel_page);
 
-       panel_page = _gedit_panel_get_active_item_id (GEDIT_PANEL (origin->priv->bottom_panel));
-       _gedit_panel_set_active_item_by_id (GEDIT_PANEL (window->priv->bottom_panel),
-                                           panel_page);
+       panel_page = gtk_stack_get_visible_child_name (GTK_STACK (origin->priv->bottom_panel));
+       gtk_stack_set_visible_child_name (GTK_STACK (window->priv->bottom_panel), panel_page);
 
        gtk_widget_set_visible (window->priv->side_panel,
                                gtk_widget_get_visible (origin->priv->side_panel));
-       gtk_widget_set_visible (window->priv->bottom_panel,
-                               gtk_widget_get_visible (origin->priv->bottom_panel));
+       gtk_widget_set_visible (window->priv->bottom_panel_box,
+                               gtk_widget_get_visible (origin->priv->bottom_panel_box));
 
        return window;
 }
@@ -2684,22 +2685,24 @@ setup_side_panel (GeditWindow *window)
                                window);
 
        documents_panel = gedit_documents_panel_new (window);
-       gedit_panel_add_item (GEDIT_PANEL (window->priv->side_panel),
-                             documents_panel,
-                             "GeditWindowDocumentsPanel",
-                             _("Documents"),
-                             "view-list-symbolic");
+       gtk_widget_show_all (documents_panel);
+       gtk_container_add_with_properties (GTK_CONTAINER (window->priv->side_panel),
+                                          documents_panel,
+                                          "name", "GeditWindowDocumentsPanel",
+                                          "title", _("Documents"),
+                                          "icon-name", "view-list-symbolic",
+                                          NULL);
 }
 
 static void
-bottom_panel_visibility_changed (GtkWidget   *panel,
+bottom_panel_visibility_changed (GtkWidget   *panel_box,
                                  GParamSpec  *pspec,
                                  GeditWindow *window)
 {
        gboolean visible;
        GAction *action;
 
-       visible = gtk_widget_get_visible (panel);
+       visible = gtk_widget_get_visible (panel_box);
 
        g_settings_set_boolean (window->priv->ui_settings,
                                GEDIT_SETTINGS_BOTTOM_PANEL_VISIBLE,
@@ -2721,29 +2724,36 @@ bottom_panel_visibility_changed (GtkWidget   *panel,
 }
 
 static void
-bottom_panel_item_removed (GeditPanel  *panel,
+bottom_panel_item_removed (GtkStack    *panel,
                           GtkWidget   *item,
                           GeditWindow *window)
 {
        gboolean empty;
        GAction *action;
 
-       empty = gedit_panel_get_n_items (panel) == 0;
+       empty = gtk_stack_get_visible_child (GTK_STACK (panel)) == NULL;
 
-       gtk_widget_set_visible (GTK_WIDGET (panel), !empty);
+       gtk_widget_set_visible (window->priv->bottom_panel_box, !empty);
 
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "bottom_panel");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !empty);
 }
 
 static void
-bottom_panel_item_added (GeditPanel  *panel,
+bottom_panel_item_added (GtkStack    *panel,
                         GtkWidget   *item,
                         GeditWindow *window)
 {
+       GList *children;
+       int n_children;
+
+       children = gtk_container_get_children (GTK_CONTAINER (panel));
+       n_children = g_list_length (children);
+       g_list_free (children);
+
        /* if it's the first item added, set the menu item
         * sensitive and if needed show the panel */
-       if (gedit_panel_get_n_items (panel) == 1)
+       if (n_children == 1)
        {
                gboolean show;
                GAction *action;
@@ -2752,7 +2762,7 @@ bottom_panel_item_added (GeditPanel  *panel,
                                               "bottom-panel-visible");
                if (show)
                {
-                       gtk_widget_show (GTK_WIDGET (panel));
+                       gtk_widget_show (window->priv->bottom_panel_box);
                }
 
                action = g_action_map_lookup_action (G_ACTION_MAP (window), "bottom_panel");
@@ -2765,7 +2775,7 @@ setup_bottom_panel (GeditWindow *window)
 {
        gedit_debug (DEBUG_WINDOW);
 
-       g_signal_connect_after (window->priv->bottom_panel,
+       g_signal_connect_after (window->priv->bottom_panel_box,
                                "notify::visible",
                                G_CALLBACK (bottom_panel_visibility_changed),
                                window);
@@ -2774,17 +2784,18 @@ setup_bottom_panel (GeditWindow *window)
 static void
 init_panels_visibility (GeditWindow *window)
 {
-       gint active_page;
+       gchar *panel_page;
        gboolean side_panel_visible;
        gboolean bottom_panel_visible;
 
        gedit_debug (DEBUG_WINDOW);
 
        /* side panel */
-       active_page = g_settings_get_int (window->priv->window_settings,
-                                         GEDIT_SETTINGS_SIDE_PANEL_ACTIVE_PAGE);
-       _gedit_panel_set_active_item_by_id (GEDIT_PANEL (window->priv->side_panel),
-                                           active_page);
+       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);
+       g_free (panel_page);
 
        side_panel_visible = g_settings_get_boolean (window->priv->ui_settings,
                                                    GEDIT_SETTINGS_SIDE_PANEL_VISIBLE);
@@ -2797,16 +2808,16 @@ init_panels_visibility (GeditWindow *window)
        }
 
        /* bottom pane, it can be empty */
-       if (gedit_panel_get_n_items (GEDIT_PANEL (window->priv->bottom_panel)) > 0)
+       if (gtk_stack_get_visible_child (GTK_STACK (window->priv->bottom_panel)) != NULL)
        {
-               active_page = g_settings_get_int (window->priv->window_settings,
-                                                 GEDIT_SETTINGS_BOTTOM_PANEL_ACTIVE_PAGE);
-               _gedit_panel_set_active_item_by_id (GEDIT_PANEL (window->priv->bottom_panel),
-                                                   active_page);
+               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);
 
                if (bottom_panel_visible)
                {
-                       gtk_widget_show (window->priv->bottom_panel);
+                       gtk_widget_show (window->priv->bottom_panel_box);
                }
        }
        else
@@ -2820,14 +2831,14 @@ init_panels_visibility (GeditWindow *window)
        /* start track sensitivity after the initial state is set */
        window->priv->bottom_panel_item_removed_handler_id =
                g_signal_connect (window->priv->bottom_panel,
-                                 "item_removed",
+                                 "remove",
                                  G_CALLBACK (bottom_panel_item_removed),
                                  window);
 
-       g_signal_connect (window->priv->bottom_panel,
-                         "item_added",
-                         G_CALLBACK (bottom_panel_item_added),
-                         window);
+       g_signal_connect_after (window->priv->bottom_panel,
+                               "add",
+                               G_CALLBACK (bottom_panel_item_added),
+                               window);
 }
 
 static void
@@ -2993,15 +3004,6 @@ gedit_window_init (GeditWindow *window)
                                "position",
                                G_BINDING_DEFAULT | G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
 
-
-       window->priv->side_stack_switcher = gedit_menu_stack_switcher_new ();
-       gedit_menu_stack_switcher_set_stack (GEDIT_MENU_STACK_SWITCHER (window->priv->side_stack_switcher),
-                                            GTK_STACK (_gedit_panel_get_stack (GEDIT_PANEL 
(window->priv->side_panel))));
-
-       gtk_header_bar_set_custom_title (GTK_HEADER_BAR (window->priv->side_headerbar),
-                                        window->priv->side_stack_switcher);
-       gtk_widget_show (window->priv->side_stack_switcher);
-
        setup_headerbar_open_button (window);
 
        if (_gedit_app_has_app_menu (GEDIT_APP (g_application_get_default ())))
@@ -3602,32 +3604,32 @@ _gedit_window_is_removing_tabs (GeditWindow *window)
  * gedit_window_get_side_panel:
  * @window: a #GeditWindow
  *
- * Gets the side #GeditPanel of the @window.
+ * Gets the side panel of the @window.
  *
- * Returns: (transfer none): the side #GeditPanel.
+ * Returns: (transfer none): the side panel's #GtkStack.
  */
-GeditPanel *
+GtkWidget *
 gedit_window_get_side_panel (GeditWindow *window)
 {
        g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
 
-       return GEDIT_PANEL (window->priv->side_panel);
+       return window->priv->side_panel;
 }
 
 /**
  * gedit_window_get_bottom_panel:
  * @window: a #GeditWindow
  *
- * Gets the bottom #GeditPanel of the @window.
+ * Gets the bottom panel of the @window.
  *
- * Returns: (transfer none): the bottom #GeditPanel.
+ * Returns: (transfer none): the bottom panel's #GtkStack.
  */
-GeditPanel *
+GtkWidget *
 gedit_window_get_bottom_panel (GeditWindow *window)
 {
        g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
 
-       return GEDIT_PANEL (window->priv->bottom_panel);
+       return window->priv->bottom_panel;
 }
 
 /**
diff --git a/gedit/gedit-window.h b/gedit/gedit-window.h
index 1ccacbd..a312dd7 100644
--- a/gedit/gedit-window.h
+++ b/gedit/gedit-window.h
@@ -35,7 +35,6 @@
 #include <gtk/gtk.h>
 
 #include <gedit/gedit-tab.h>
-#include <gedit/gedit-panel.h>
 #include <gedit/gedit-message-bus.h>
 
 G_BEGIN_DECLS
@@ -134,9 +133,9 @@ GList               *gedit_window_get_views                 (GeditWindow         *window);
 
 GtkWindowGroup  *gedit_window_get_group                        (GeditWindow         *window);
 
-GeditPanel     *gedit_window_get_side_panel            (GeditWindow         *window);
+GtkWidget      *gedit_window_get_side_panel            (GeditWindow         *window);
 
-GeditPanel     *gedit_window_get_bottom_panel          (GeditWindow         *window);
+GtkWidget      *gedit_window_get_bottom_panel          (GeditWindow         *window);
 
 GtkWidget      *gedit_window_get_statusbar             (GeditWindow         *window);
 
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index 6af289f..407585d 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -226,12 +226,17 @@
         <child>
           <object class="GtkHeaderBar" id="side_headerbar">
             <property name="visible">True</property>
-            <property name="title">Documents</property>
             <property name="show_close_button">True</property>
             <style>
               <class name="gedit-titlebar-left"/>
               <class name="titlebar"/>
             </style>
+           <child type="title">
+             <object class="GeditMenuStackSwitcher" id="side_stack_switcher">
+               <property name="visible">True</property>
+               <property name="stack">side_panel</property>
+             </object>
+           </child>
           </object>
           <packing>
             <property name="resize">False</property>
@@ -357,9 +362,8 @@
               <class name="gedit-sidepanel-paned"/>
             </style>
             <child>
-              <object class="GeditPanel" id="side_panel">
+              <object class="GtkStack" id="side_panel">
                 <property name="visible">False</property>
-                <property name="orientation">vertical</property>
               </object>
               <packing>
                 <property name="resize">False</property>
@@ -387,9 +391,64 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GeditPanel" id="bottom_panel">
+                      <object class="GtkBox" id="bottom_panel_box">
                         <property name="visible">False</property>
                         <property name="orientation">horizontal</property>
+                       <child>
+                         <object class="GtkBox" id="bottom_panel_stack_box">
+                           <property name="visible">True</property>
+                           <property name="orientation">vertical</property>
+                           <child>
+                             <object class="GtkStack" id="bottom_panel">
+                               <property name="visible">True</property>
+                             </object>
+                             <packing>
+                               <property name="expand">True</property>
+                               <property name="fill">True</property>
+                               <property name="position">1</property>
+                             </packing>
+                           </child>
+                           <child>
+                             <object class="GtkStackSwitcher" id="bottom_panel_stack_switcher">
+                               <property name="visible">True</property>
+                               <property name="stack">bottom_panel</property>
+                             </object>
+                             <packing>
+                               <property name="expand">False</property>
+                               <property name="fill">False</property>
+                               <property name="position">2</property>
+                             </packing>
+                           </child>
+                         </object>
+                         <packing>
+                           <property name="expand">True</property>
+                           <property name="fill">True</property>
+                           <property name="position">1</property>
+                         </packing>
+                       </child>
+                       <child>
+                         <object class="GtkBox" id="bottom_panel_sidebar">
+                           <property name="visible">True</property>
+                           <property name="orientation">vertical</property>
+                           <child>
+                             <object class="GeditCloseButton" id="bottom_panel_close_button">
+                               <property name="visible">True</property>
+                               <property name="tooltip-text" translatable="True">Hide panel</property>
+                                <property name="action_name">win.bottom_panel</property>
+                             </object>
+                             <packing>
+                               <property name="expand">False</property>
+                               <property name="fill">False</property>
+                               <property name="position">1</property>
+                             </packing>
+                           </child>
+                         </object>
+                         <packing>
+                           <property name="expand">False</property>
+                           <property name="fill">False</property>
+                           <property name="position">2</property>
+                         </packing>
+                       </child>
                       </object>
                       <packing>
                         <property name="resize">False</property>
diff --git a/plugins/externaltools/tools/windowactivatable.py 
b/plugins/externaltools/tools/windowactivatable.py
index ba79c0c..676df96 100644
--- a/plugins/externaltools/tools/windowactivatable.py
+++ b/plugins/externaltools/tools/windowactivatable.py
@@ -153,10 +153,7 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable):
         self.menu = ToolMenu(self._library, self.window, self._output_buffer, external_tools_submenu_section)
 
         bottom = self.window.get_bottom_panel()
-        bottom.add_item(self._output_buffer.panel,
-                        "GeditExternalToolsShellOutput",
-                        _("Tool Output"),
-                        "system-run-symbolic")
+        bottom.add_titled(self._output_buffer.panel, "GeditExternalToolsShellOutput", _("Tool Output"))
 
     def do_update_state(self):
         if self.menu is not None:
@@ -168,7 +165,7 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable):
         self.window.remove_action("manage_tools")
 
         bottom = self.window.get_bottom_panel()
-        bottom.remove_item(self._output_buffer.panel)
+        bottom.remove(self._output_buffer.panel)
 
     def open_dialog(self):
         if not self._manager:
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.c b/plugins/filebrowser/gedit-file-browser-plugin.c
index 5d47552..d7817e1 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.c
+++ b/plugins/filebrowser/gedit-file-browser-plugin.c
@@ -481,7 +481,7 @@ gedit_file_browser_plugin_activate (GeditWindowActivatable *activatable)
 {
        GeditFileBrowserPlugin *plugin = GEDIT_FILE_BROWSER_PLUGIN (activatable);
        GeditFileBrowserPluginPrivate *priv;
-       GeditPanel *panel;
+       GtkWidget *panel;
        GeditFileBrowserStore *store;
 
        priv = plugin->priv;
@@ -523,11 +523,12 @@ gedit_file_browser_plugin_activate (GeditWindowActivatable *activatable)
 
        panel = gedit_window_get_side_panel (priv->window);
 
-       gedit_panel_add_item (panel,
-                             GTK_WIDGET (priv->tree_widget),
-                             "GeditFileBrowserPanel",
-                             _("File Browser"),
-                             "system-file-manager-symbolic");
+       gtk_container_add_with_properties (GTK_CONTAINER (panel),
+                                          GTK_WIDGET (priv->tree_widget),
+                                          "name", "GeditFileBrowserPanel",
+                                          "title", _("File Browser"),
+                                          "icon-name", "system-file-manager-symbolic",
+                                          NULL);
 
        gtk_widget_show (GTK_WIDGET (priv->tree_widget));
 
@@ -580,7 +581,7 @@ gedit_file_browser_plugin_deactivate (GeditWindowActivatable *activatable)
 {
        GeditFileBrowserPlugin *plugin = GEDIT_FILE_BROWSER_PLUGIN (activatable);
        GeditFileBrowserPluginPrivate *priv = plugin->priv;
-       GeditPanel *panel;
+       GtkWidget *panel;
 
 
        /* Unregister messages from the bus */
@@ -610,7 +611,7 @@ gedit_file_browser_plugin_deactivate (GeditWindowActivatable *activatable)
        }
 
        panel = gedit_window_get_side_panel (priv->window);
-       gedit_panel_remove_item (panel, GTK_WIDGET (priv->tree_widget));
+       gtk_container_remove (GTK_CONTAINER (panel), GTK_WIDGET (priv->tree_widget));
 }
 
 static void
diff --git a/plugins/pythonconsole/pythonconsole/__init__.py b/plugins/pythonconsole/pythonconsole/__init__.py
index 310a10d..6c56932 100644
--- a/plugins/pythonconsole/pythonconsole/__init__.py
+++ b/plugins/pythonconsole/pythonconsole/__init__.py
@@ -44,13 +44,15 @@ class PythonConsolePlugin(GObject.Object, Gedit.WindowActivatable, PeasGtk.Confi
         self._console.eval('print("You can access the main window through ' \
                            '\'window\' :\\n%s" % window)', False)
         bottom = self.window.get_bottom_panel()
-        bottom.add_item(self._console, "GeditPythonConsolePanel",
-                        _('Python Console'), "system-run-symbolic")
+        print(bottom)
+        print(self._console)
+        self._console.show_all()
+        bottom.add_titled(self._console, "GeditPythonConsolePanel", _('Python Console'))
 
     def do_deactivate(self):
         self._console.stop()
         bottom = self.window.get_bottom_panel()
-        bottom.remove_item(self._console)
+        bottom.remove(self._console)
 
     def do_update_state(self):
         pass


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