[gedit/wip/documentspanel] Create Documents Panel from the UI file
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/documentspanel] Create Documents Panel from the UI file
- Date: Sun, 9 Feb 2014 20:33:29 +0000 (UTC)
commit c4917b057535019f3b54efc95eccad858831225f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sun Feb 9 21:32:51 2014 +0100
Create Documents Panel from the UI file
gedit/gedit-documents-panel.c | 17 +++++++++++------
gedit/gedit-documents-panel.h | 7 +++++--
gedit/gedit-window-private.h | 1 +
gedit/gedit-window.c | 11 +++--------
gedit/gedit-window.ui | 9 +++++++++
5 files changed, 29 insertions(+), 16 deletions(-)
---
diff --git a/gedit/gedit-documents-panel.c b/gedit/gedit-documents-panel.c
index 918d706..0402972 100644
--- a/gedit/gedit-documents-panel.c
+++ b/gedit/gedit-documents-panel.c
@@ -864,7 +864,6 @@ gedit_documents_panel_class_init (GeditDocumentsPanelClass *klass)
"The GeditWindow this GeditDocumentsPanel is
associated with",
GEDIT_TYPE_WINDOW,
G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
}
@@ -914,13 +913,19 @@ gedit_documents_panel_init (GeditDocumentsPanel *panel)
}
GtkWidget *
-gedit_documents_panel_new (GeditWindow *window)
+gedit_documents_panel_new (void)
{
- g_return_val_if_fail (GEDIT_IS_WINDOW (window), NULL);
+ return g_object_new (GEDIT_TYPE_DOCUMENTS_PANEL, NULL);
+}
+
+void
+gedit_documents_panel_set_window (GeditDocumentsPanel *panel,
+ GeditWindow *window)
+{
+ g_return_if_fail (GEDIT_IS_DOCUMENTS_PANEL (panel));
+ g_return_if_fail (GEDIT_IS_WINDOW (window));
- return g_object_new (GEDIT_TYPE_DOCUMENTS_PANEL,
- "window", window,
- NULL);
+ set_window (panel, window);
}
static gchar *
diff --git a/gedit/gedit-documents-panel.h b/gedit/gedit-documents-panel.h
index b0e0a8f..6d3ce7e 100644
--- a/gedit/gedit-documents-panel.h
+++ b/gedit/gedit-documents-panel.h
@@ -66,9 +66,12 @@ struct _GeditDocumentsPanelClass
/*
* Public methods
*/
-GType gedit_documents_panel_get_type (void) G_GNUC_CONST;
+GType gedit_documents_panel_get_type (void) G_GNUC_CONST;
-GtkWidget *gedit_documents_panel_new (GeditWindow *window);
+GtkWidget *gedit_documents_panel_new (void);
+
+void gedit_documents_panel_set_window (GeditDocumentsPanel *panel,
+ GeditWindow *window);
G_END_DECLS
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 6bc0625..0d9d0cb 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -45,6 +45,7 @@ struct _GeditWindowPrivate
GeditMultiNotebook *multi_notebook;
GtkWidget *side_panel;
+ GtkWidget *documents_panel;
GtkWidget *bottom_panel_box;
GtkWidget *bottom_panel;
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 8befab6..f58e0ed 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -419,6 +419,7 @@ gedit_window_class_init (GeditWindowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, gear_button);
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, documents_panel);
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);
@@ -2659,8 +2660,6 @@ side_panel_visibility_changed (GtkWidget *panel,
static void
setup_side_panel (GeditWindow *window)
{
- GtkWidget *documents_panel;
-
gedit_debug (DEBUG_WINDOW);
g_signal_connect_after (window->priv->side_panel,
@@ -2668,12 +2667,8 @@ setup_side_panel (GeditWindow *window)
G_CALLBACK (side_panel_visibility_changed),
window);
- documents_panel = gedit_documents_panel_new (window);
- gtk_widget_show_all (documents_panel);
- gtk_stack_add_titled (GTK_STACK (window->priv->side_panel),
- documents_panel,
- "GeditWindowDocumentsPanel",
- _("Documents"));
+ gedit_documents_panel_set_window (GEDIT_DOCUMENTS_PANEL (window->priv->documents_panel),
+ window);
}
static void
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index 6661443..4b26487 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -153,6 +153,15 @@
<child>
<object class="GtkStack" id="side_panel">
<property name="visible">False</property>
+ <child>
+ <object class="GeditDocumentsPanel" id="documents_panel">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="name">GeditDocumentsPanel</property>
+ <property name="title" translatable="yes">Documents</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="resize">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]