[gedit/wip/tabs: 4/8] Use a template for gedit notebook and add a documents menu
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/tabs: 4/8] Use a template for gedit notebook and add a documents menu
- Date: Wed, 26 Jun 2013 15:26:22 +0000 (UTC)
commit fb67802bdb24c3a96cff8474739abf080b718c0a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Jun 24 17:16:01 2013 +0200
Use a template for gedit notebook and add a documents menu
gedit/gedit-notebook.c | 15 ++++++++++++---
gedit/gedit-notebook.ui | 23 +++++++++++++++++++++++
gedit/gedit.gresource.xml | 1 +
3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index d65b29a..cad2018 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -59,6 +59,8 @@ struct _GeditNotebookPrivate
{
GSettings *ui_settings;
+ GtkWidget *documents_button;
+
GList *focused_pages;
GeditNotebookShowTabsModeType show_tabs_mode;
@@ -481,7 +483,7 @@ static void
gedit_notebook_class_init (GeditNotebookClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
@@ -490,8 +492,8 @@ gedit_notebook_class_init (GeditNotebookClass *klass)
object_class->get_property = gedit_notebook_get_property;
object_class->set_property = gedit_notebook_set_property;
- gtkwidget_class->grab_focus = gedit_notebook_grab_focus;
- gtkwidget_class->button_press_event = gedit_notebook_button_press;
+ widget_class->grab_focus = gedit_notebook_grab_focus;
+ widget_class->button_press_event = gedit_notebook_button_press;
notebook_class->change_current_page = gedit_notebook_change_current_page;
notebook_class->switch_page = gedit_notebook_switch_page;
@@ -531,6 +533,11 @@ gedit_notebook_class_init (GeditNotebookClass *klass)
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
GEDIT_TYPE_TAB);
+ /* Bind class to template */
+ gtk_widget_class_set_template_from_resource (widget_class,
+ "/org/gnome/gedit/ui/gedit-notebook.ui");
+ gtk_widget_class_bind_child (widget_class, GeditNotebookPrivate, documents_button);
+
g_type_class_add_private (object_class, sizeof (GeditNotebookPrivate));
}
@@ -555,6 +562,8 @@ gedit_notebook_init (GeditNotebook *notebook)
notebook->priv = GEDIT_NOTEBOOK_GET_PRIVATE (notebook);
priv = notebook->priv;
+ gtk_widget_init_template (GTK_WIDGET (notebook));
+
priv->ui_settings = g_settings_new ("org.gnome.gedit.preferences.ui");
priv->show_tabs_mode = GEDIT_NOTEBOOK_SHOW_TABS_ALWAYS;
diff --git a/gedit/gedit-notebook.ui b/gedit/gedit-notebook.ui
new file mode 100644
index 0000000..746bcbe
--- /dev/null
+++ b/gedit/gedit-notebook.ui
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.8 -->
+ <template class="GeditNotebook" parent="GtkNotebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <child type="action-end">
+ <object class="GtkMenuButton" id="documents_button">
+ <property name="visible">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="documents_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">view-more-symbolic</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/gedit/gedit.gresource.xml b/gedit/gedit.gresource.xml
index e277680..a620f82 100644
--- a/gedit/gedit.gresource.xml
+++ b/gedit/gedit.gresource.xml
@@ -13,5 +13,6 @@
<file preprocess="xml-stripblanks">gedit-status-menu-button.ui</file>
<file preprocess="xml-stripblanks">gedit-view-frame.ui</file>
<file preprocess="xml-stripblanks">gedit-highlight-mode-dialog.ui</file>
+ <file preprocess="xml-stripblanks">gedit-notebook.ui</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]