[gnome-documents] selections: Port to templates
- From: Alessandro Bono <abono src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] selections: Port to templates
- Date: Tue, 17 Nov 2015 17:23:19 +0000 (UTC)
commit 21bfc567880d81595c264061cacca9956f14a87e
Author: Alessandro Bono <abono gnome org>
Date: Mon Nov 9 23:07:06 2015 +0100
selections: Port to templates
https://bugzilla.gnome.org/show_bug.cgi?id=758182
data/org.gnome.Documents.data.gresource.xml | 1 +
data/ui/selection-toolbar.ui | 62 +++++++++++++++++++++++++++
po/POTFILES.in | 1 +
src/selections.js | 40 +++++------------
4 files changed, 75 insertions(+), 29 deletions(-)
---
diff --git a/data/org.gnome.Documents.data.gresource.xml b/data/org.gnome.Documents.data.gresource.xml
index 482c42c..e374424 100644
--- a/data/org.gnome.Documents.data.gresource.xml
+++ b/data/org.gnome.Documents.data.gresource.xml
@@ -7,6 +7,7 @@
<file preprocess="xml-stripblanks">ui/preview-context-menu.ui</file>
<file preprocess="xml-stripblanks">ui/preview-menu.ui</file>
<file preprocess="xml-stripblanks">ui/selection-menu.ui</file>
+ <file preprocess="xml-stripblanks">ui/selection-toolbar.ui</file>
<file preprocess="xml-stripblanks">ui/view-menu.ui</file>
<file alias="ui/dnd-counter.svg" preprocess="to-pixdata">media/dnd-counter.svg</file>
<file alias="ui/thumbnail-frame.png" preprocess="to-pixdata">media/thumbnail-frame.png</file>
diff --git a/data/ui/selection-toolbar.ui b/data/ui/selection-toolbar.ui
new file mode 100644
index 0000000..b86d460
--- /dev/null
+++ b/data/ui/selection-toolbar.ui
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.11 -->
+ <template class="Gjs_SelectionToolbar" parent="GtkActionBar">
+ <property name="visible">0</property>
+ <child>
+ <object class="GtkButton" id="toolbarOpen">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Open</property>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="toolbarPrint">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Print</property>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="toolbarTrash">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Delete</property>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="toolbarShare">
+ <property name="visible">0</property>
+ <property name="no-show-all">1</property>
+ <property name="label" translatable="yes">Share</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="toolbarProperties">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Properties</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="toolbarCollection">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Collections</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ </template>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index dab6e21..8da97ff 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -11,6 +11,7 @@ data/org.gnome.documents.gschema.xml
[type: gettext/glade]data/ui/preview-context-menu.ui
[type: gettext/glade]data/ui/preview-menu.ui
[type: gettext/glade]data/ui/selection-menu.ui
+[type: gettext/glade]data/ui/selection-toolbar.ui
[type: gettext/glade]data/ui/view-menu.ui
src/application.js
src/documents.js
diff --git a/src/selections.js b/src/selections.js
index e92d858..e303eef 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -861,6 +861,13 @@ const _SELECTION_TOOLBAR_DEFAULT_WIDTH = 500;
const SelectionToolbar = new Lang.Class({
Name: 'SelectionToolbar',
Extends: Gtk.ActionBar,
+ Template: 'resource:///org/gnome/Documents/ui/selection-toolbar.ui',
+ InternalChildren: [ 'toolbarOpen',
+ 'toolbarPrint',
+ 'toolbarTrash',
+ 'toolbarShare',
+ 'toolbarProperties',
+ 'toolbarCollection' ],
_init: function() {
this._itemListeners = {};
@@ -868,43 +875,18 @@ const SelectionToolbar = new Lang.Class({
this.parent();
- // open button
- this._toolbarOpen = new Gtk.Button({ label: _("Open") });
- this._toolbarOpen.show();
- this.pack_start(this._toolbarOpen);
- this._toolbarOpen.connect('clicked', Lang.bind(this, this._onToolbarOpen));
- // print button
- this._toolbarPrint = new Gtk.Button({ label: _("Print") });
- this._toolbarPrint.show();
- this.pack_start(this._toolbarPrint);
+ this._toolbarOpen.connect('clicked', Lang.bind(this, this._onToolbarOpen));
this._toolbarPrint.connect('clicked', Lang.bind(this, this._onToolbarPrint));
-
- // trash button
- this._toolbarTrash = new Gtk.Button({ label: _("Delete") });
- this._toolbarTrash.show();
- this.pack_start(this._toolbarTrash);
this._toolbarTrash.connect('clicked', Lang.bind(this, this._onToolbarTrash));
- // share button
if (!Application.application.isBooks) {
- this._toolbarShare = new Gtk.Button({ label: _("Share") });
- this._toolbarShare.show();
- this.pack_end(this._toolbarShare);
this._toolbarShare.connect('clicked', Lang.bind(this, this._onToolbarShare));
+ this._toolbarShare.show();
}
-
- // properties button
- this._toolbarProperties = new Gtk.Button({ label: _("Properties") });
- this._toolbarProperties.show();
- this.pack_end(this._toolbarProperties);
this._toolbarProperties.connect('clicked', Lang.bind(this, this._onToolbarProperties));
-
- // collections button
- this._toolbarCollection = new Gtk.Button({ label: _("Collections") });
- this._toolbarCollection.show();
- this.pack_end(this._toolbarCollection);
this._toolbarCollection.connect('clicked', Lang.bind(this, this._onToolbarCollection));
+
Application.modeController.connect('window-mode-changed',
Lang.bind(this, this._updateCollectionsButton));
Application.documentManager.connect('active-collection-changed',
@@ -1009,7 +991,7 @@ const SelectionToolbar = new Lang.Class({
this._toolbarProperties.set_sensitive(showProperties);
this._toolbarTrash.set_sensitive(showTrash);
this._toolbarOpen.set_sensitive(showOpen);
- if (this._toolbarShare)
+ if (!Application.application.isBooks)
this._toolbarShare.set_sensitive(showShare);
this._toolbarCollection.set_sensitive(showCollection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]