[sushi] all: factor out a method to create a full screen button
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] all: factor out a method to create a full screen button
- Date: Wed, 11 May 2011 19:01:33 +0000 (UTC)
commit 037cee8ed77eadccd18b856a3c61c3c379c48a34
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed May 11 14:26:24 2011 -0400
all: factor out a method to create a full screen button
src/js/ui/utils.js | 12 ++++++++++++
src/js/viewers/evince.js | 9 +--------
src/js/viewers/gst.js | 8 +-------
src/js/viewers/image.js | 10 +---------
4 files changed, 15 insertions(+), 24 deletions(-)
---
diff --git a/src/js/ui/utils.js b/src/js/ui/utils.js
index a010363..8101e9d 100644
--- a/src/js/ui/utils.js
+++ b/src/js/ui/utils.js
@@ -64,3 +64,15 @@ function getStaticSize(renderer, widget) {
/* return the natural */
return [ width, height ];
}
+
+function createFullScreenButton(mainWindow) {
+ let toolbarZoom = new Gtk.ToolButton({ expand: false,
+ "icon-name": "view-fullscreen-symbolic" });
+ toolbarZoom.show();
+ toolbarZoom.connect("clicked",
+ function () {
+ mainWindow.toggleFullScreen();
+ });
+
+ return toolbarZoom;
+}
diff --git a/src/js/viewers/evince.js b/src/js/viewers/evince.js
index 6f64dd0..937b1b5 100644
--- a/src/js/viewers/evince.js
+++ b/src/js/viewers/evince.js
@@ -131,16 +131,9 @@ EvinceRenderer.prototype = {
this._toolbarActor = new GtkClutter.Actor({ contents: this._mainToolbar,
"show-on-set-parent": false });
- this._toolbarZoom = new Gtk.ToolButton({ expand: false,
- "icon-name": "view-fullscreen-symbolic" });
- this._toolbarZoom.show();
+ this._toolbarZoom = Utils.createFullScreenButton(this._mainWindow);
this._mainToolbar.insert(this._toolbarZoom, 0);
- this._toolbarZoom.connect("clicked",
- Lang.bind(this, function () {
- this._mainWindow.toggleFullScreen();
- }));
-
let separator = new Gtk.SeparatorToolItem();
separator.show();
this._mainToolbar.insert(separator, 1);
diff --git a/src/js/viewers/gst.js b/src/js/viewers/gst.js
index 57c7205..bdf038d 100644
--- a/src/js/viewers/gst.js
+++ b/src/js/viewers/gst.js
@@ -194,15 +194,9 @@ GstRenderer.prototype = {
item.show_all();
this._mainToolbar.insert(item, 3);
- this._toolbarZoom = new Gtk.ToolButton({ "icon-name": "view-fullscreen-symbolic" });
- this._toolbarZoom.show();
+ this._toolbarZoom = Utils.createFullScreenButton(this._mainWindow);
this._mainToolbar.insert(this._toolbarZoom, 4);
- this._toolbarZoom.connect("clicked",
- Lang.bind(this, function () {
- this._mainWindow.toggleFullScreen();
- }));
-
return this._toolbarActor;
},
diff --git a/src/js/viewers/image.js b/src/js/viewers/image.js
index dfb7926..71977b6 100644
--- a/src/js/viewers/image.js
+++ b/src/js/viewers/image.js
@@ -117,17 +117,9 @@ ImageRenderer.prototype = {
this._toolbarActor = new GtkClutter.Actor({ contents: this._mainToolbar,
"show-on-set-parent": false });
- this._toolbarZoom = new Gtk.ToolButton({ expand: false,
- "icon-name": "view-fullscreen-symbolic" });
- this._toolbarZoom.show();
- this._toolbarZoom.set_expand(true);
+ this._toolbarZoom = Utils.createFullScreenButton(this._mainWindow);
this._mainToolbar.insert(this._toolbarZoom, 0);
- this._toolbarZoom.connect("clicked",
- Lang.bind(this, function () {
- this._mainWindow.toggleFullScreen();
- }));
-
return this._toolbarActor;
},
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]