[gnome-documents] all: don't use Clutter and ClutterGTK
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] all: don't use Clutter and ClutterGTK
- Date: Fri, 8 Feb 2013 21:39:24 +0000 (UTC)
commit f81833d7465ba20656e12640d4ff5b55b6443164
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Feb 8 15:41:41 2013 -0500
all: don't use Clutter and ClutterGTK
Now GTK+ and libgd have everything we used to need Clutter and
ClutterGTK for, so port Documents to be a pure GTK application. This has
huge benefits for performance, accessibility and integration.
configure.ac | 4 -
src/Makefile-js.am | 4 -
src/application.js | 6 +-
src/edit.js | 5 +-
src/embed.js | 106 ++++---------------
src/lib/gd-nav-bar.c | 25 ++----
src/mainToolbar.js | 12 +--
src/mainWindow.js | 2 -
src/notifications.js | 20 +---
src/preview.js | 84 ++++++----------
src/searchbar.js | 43 ++++----
src/selections.js | 58 ++++--------
src/util/tweener.js | 273 --------------------------------------------------
src/utils.js | 7 --
14 files changed, 109 insertions(+), 540 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3863e5b..eef18af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,15 +56,11 @@ GTK_MIN_VERSION=3.7.7
GOBJECT_INTROSPECTION_MIN_VERSION=1.31.6
GDATA_MIN_VERSION=0.13.1
GOA_MIN_VERSION=3.2.0
-CLUTTER_GTK_MIN_VERSION=1.4.2
-CLUTTER_MIN_VERSION=1.10
TRACKER_MIN_VERSION=0.13.1
ZAPOJIT_MIN_VERSION=0.0.2
SOUP_MIN_VERSION=2.41.3
PKG_CHECK_MODULES(DOCUMENTS,
- clutter-gtk-1.0 >= $CLUTTER_GTK_MIN_VERSION
- clutter-1.0 >= $CLUTTER_MIN_VERSION
evince-document-3.0 >= $EVINCE_MIN_VERSION
evince-view-3.0 >= $EVINCE_MIN_VERSION
webkitgtk-3.0 >= $WEBKITGTK_MIN_VERSION
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index 3efdd44..d81a992 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -27,10 +27,6 @@ dist_js_DATA = \
windowMode.js \
path.js
-jsutildir = $(pkgdatadir)/js/util/
-dist_jsutil_DATA = \
- util/tweener.js
-
BUILT_SOURCES += \
path.js \
config.js
diff --git a/src/application.js b/src/application.js
index 5068de6..a7dbbe9 100644
--- a/src/application.js
+++ b/src/application.js
@@ -26,7 +26,6 @@ const Gettext = imports.gettext;
const _ = imports.gettext.gettext;
// Import versions go here
-imports.gi.versions.GtkClutter = '1.0';
imports.gi.versions.GdPrivate = '1.0';
imports.gi.versions.Gd = '1.0';
imports.gi.versions.Tracker = '0.16';
@@ -34,7 +33,6 @@ imports.gi.versions.TrackerMiner = '0.16';
imports.gi.versions.EvinceDocument = '3.0';
imports.gi.versions.Goa = '1.0';
-const GtkClutter = imports.gi.GtkClutter;
const EvDoc = imports.gi.EvinceDocument;
const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
@@ -60,7 +58,6 @@ const Selections = imports.selections;
const ShellSearchProvider = imports.shellSearchProvider;
const TrackerController = imports.trackerController;
const TrackerUtils = imports.trackerUtils;
-const Tweener = imports.util.tweener;
const Utils = imports.utils;
const WindowMode = imports.windowMode;
@@ -304,9 +301,8 @@ const Application = new Lang.Class({
this.parent();
String.prototype.format = Format.format;
- GtkClutter.init(null);
+ Gtk.init(null);
EvDoc.init();
- Tweener.init();
let resource = Gio.Resource.load(Path.RESOURCE_DIR + '/gnome-documents.gresource');
resource._register();
diff --git a/src/edit.js b/src/edit.js
index 1fad4a6..e5b7144 100644
--- a/src/edit.js
+++ b/src/edit.js
@@ -17,7 +17,6 @@
*
*/
-const Clutter = imports.gi.Clutter;
const WebKit = imports.gi.WebKit;
const Soup = imports.gi.Soup;
const GdPrivate = imports.gi.GdPrivate;
@@ -25,7 +24,6 @@ const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const _ = imports.gettext.gettext;
const Lang = imports.lang;
@@ -33,7 +31,6 @@ const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Application = imports.application;
-const Tweener = imports.util.tweener;
const MainToolbar = imports.mainToolbar;
const Searchbar = imports.searchbar;
const Utils = imports.utils;
@@ -46,7 +43,7 @@ const _BLANK_URI = "about:blank";
const EditView = new Lang.Class({
Name: 'EditView',
- _init: function(overlayLayout) {
+ _init: function() {
this._uri = null;
this.widget = new Gtk.Overlay();
diff --git a/src/embed.js b/src/embed.js
index b56ee27..cbe20f2 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -21,7 +21,6 @@
const Lang = imports.lang;
const Mainloop = imports.mainloop;
-const Tweener = imports.util.tweener;
const Application = imports.application;
const MainToolbar = imports.mainToolbar;
@@ -33,13 +32,11 @@ const View = imports.view;
const WindowMode = imports.windowMode;
const Documents = imports.documents;
-const Clutter = imports.gi.Clutter;
const EvView = imports.gi.EvinceView;
const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const _ = imports.gettext.gettext;
const _ICON_SIZE = 128;
@@ -230,34 +227,6 @@ const EmptyResultsBox = new Lang.Class({
}
});
-const EmbedWidget = new Lang.Class({
- Name: 'EmbedWidget',
- Extends: GtkClutter.Embed,
-
- _init: function() {
- this.parent({ use_layout_size: true,
- can_focus: false });
- },
-
- /* We overide all keyboard handling of GtkClutter.Embed, as it interfers
- * with the key event propagation and thus focus navigation in gtk+.
- * We also make the embed itself non-focusable, as we want to treat it
- * like a container of Gtk+ widget rather than an edge widget which gets
- * keyboard events.
- * This means we will never get any Clutter key events, but that is
- * fine, as all our keyboard input is into GtkClutterActors, and clutter
- * is just used as a nice way of animating and rendering Gtk+ widgets
- * and some non-active graphical things.
- */
- vfunc_key_press_event: function(event) {
- return false;
- },
-
- vfunc_key_release_event: function(event) {
- return false;
- }
-});
-
const Embed = new Lang.Class({
Name: 'Embed',
@@ -265,57 +234,32 @@ const Embed = new Lang.Class({
this._queryErrorId = 0;
this._noResultsChangeId = 0;
- this.widget = new EmbedWidget();
- this.widget.show();
-
- // the embed is a vertical ClutterBox
- let stage = this.widget.get_stage();
- this._overlayLayout = new Clutter.BinLayout();
- this.actor = new Clutter.Box({ layout_manager: this._overlayLayout });
- this.actor.add_constraint(
- new Clutter.BindConstraint({ coordinate: Clutter.BindCoordinate.SIZE,
- source: stage }));
- stage.add_actor(this.actor);
-
- this._contentsLayout = new Clutter.BoxLayout({ vertical: true });
- this._contentsActor = new Clutter.Box({ layout_manager: this._contentsLayout });
- this._overlayLayout.add(this._contentsActor,
- Clutter.BinAlignment.FILL, Clutter.BinAlignment.FILL);
-
- // pack the main GtkNotebook and a spinnerbox in a BinLayout, so that
- // we can easily bring them front/back
- this._viewLayout = new Clutter.BinLayout();
- this._viewActor = new Clutter.Box({ layout_manager: this._viewLayout });
- this._contentsLayout.set_expand(this._viewActor, true);
- this._contentsLayout.set_fill(this._viewActor, true, true);
- this._contentsActor.add_actor(this._viewActor);
+ this.widget = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
+ visible: true });
+
+ this._notebookOverlay = new Gtk.Overlay({ visible: true });
+ this.widget.pack_end(this._notebookOverlay, true, true, 0);
this._notebook = new Gtk.Notebook({ show_tabs: false,
- show_border: false });
- this._notebook.show();
- this._notebookActor = new GtkClutter.Actor({ contents: this._notebook,
- x_align: Clutter.ActorAlign.FILL,
- x_expand: true,
- y_align: Clutter.ActorAlign.FILL,
- y_expand: true });
- this._viewActor.add_child(this._notebookActor);
+ show_border: false,
+ visible: true });
+ this._notebookOverlay.add(this._notebook);
// create the OSD toolbar for selected items, it's hidden by default
- this._selectionToolbar = new Selections.SelectionToolbar(this.actor);
- this._overlayLayout.add(this._selectionToolbar.actor,
- Clutter.BinAlignment.FIXED, Clutter.BinAlignment.FIXED);
+ this._selectionToolbar = new Selections.SelectionToolbar();
+ this._notebookOverlay.add_overlay(this._selectionToolbar.widget);
- // pack the OSD notification actor
- this._viewActor.add_child(Application.notificationManager.actor);
+ // pack the OSD notification widget
+ this._notebookOverlay.add_overlay(Application.notificationManager.widget);
// now create the actual content widgets
this._view = new View.ViewContainer();
this._viewPage = this._notebook.append_page(this._view.widget, null);
- this._preview = new Preview.PreviewView(this._overlayLayout);
+ this._preview = new Preview.PreviewView(this._notebookOverlay);
this._previewPage = this._notebook.append_page(this._preview.widget, null);
- this._edit = new Edit.EditView(this._overlayLayout);
+ this._edit = new Edit.EditView(this._notebookOverlay);
this._editPage = this._notebook.append_page(this._edit.widget, null);
this._spinnerBox = new SpinnerBox();
@@ -403,7 +347,7 @@ const Embed = new Lang.Class({
},
_onFullscreenChanged: function(controller, fullscreen) {
- this._toolbar.actor.visible = !fullscreen;
+ this._toolbar.widget.visible = !fullscreen;
this._toolbar.widget.sensitive = !fullscreen;
},
@@ -469,13 +413,11 @@ const Embed = new Lang.Class({
this._edit.setUri(null);
if (this._toolbar)
- this._toolbar.actor.destroy();
+ this._toolbar.widget.destroy();
// pack the toolbar
- this._toolbar = new MainToolbar.OverviewToolbar(this._viewLayout);
- this._contentsLayout.pack_start = true;
- this._contentsActor.add_actor(this._toolbar.actor);
- this._contentsLayout.set_fill(this._toolbar.actor, true, false);
+ this._toolbar = new MainToolbar.OverviewToolbar(this._notebookOverlay);
+ this.widget.pack_start(this._toolbar.widget, false, false, 0);
this._spinnerBox.stop();
this._notebook.set_current_page(this._viewPage);
@@ -485,13 +427,11 @@ const Embed = new Lang.Class({
if (this._edit)
this._edit.setUri(null);
if (this._toolbar)
- this._toolbar.actor.destroy();
+ this._toolbar.widget.destroy();
// pack the toolbar
this._toolbar = new Preview.PreviewToolbar(this._preview);
- this._contentsLayout.pack_start = true;
- this._contentsActor.add_actor(this._toolbar.actor);
- this._contentsLayout.set_fill(this._toolbar.actor, true, false);
+ this.widget.pack_start(this._toolbar.widget, false, false, 0);
this._notebook.set_current_page(this._previewPage);
},
@@ -500,13 +440,11 @@ const Embed = new Lang.Class({
if (this._preview)
this._preview.setModel(null);
if (this._toolbar)
- this._toolbar.actor.destroy();
+ this._toolbar.widget.destroy();
// pack the toolbar
this._toolbar = new Edit.EditToolbar(this._preview);
- this._contentsLayout.pack_start = true;
- this._contentsActor.add_actor(this._toolbar.actor);
- this._contentsLayout.set_fill(this._toolbar.actor, true, false);
+ this.widget.pack_start(this._toolbar.widget, false, false, 0);
this._notebook.set_current_page(this._editPage);
},
diff --git a/src/lib/gd-nav-bar.c b/src/lib/gd-nav-bar.c
index 6df2480..233c4c2 100644
--- a/src/lib/gd-nav-bar.c
+++ b/src/lib/gd-nav-bar.c
@@ -682,18 +682,11 @@ hide_preview (GdNavBar *self)
static void
show_preview (GdNavBar *self)
{
- GdkWindow *parent;
GdkWindow *window;
- int x;
- int y;
- int width;
- int height;
- int bx;
- int by;
- int bwidth;
- int bheight;
- int rx;
- int ry;
+ int x, y;
+ int width, height;
+ int bx, by;
+ int rx, ry;
gtk_widget_realize (self->priv->preview_window);
@@ -701,15 +694,11 @@ show_preview (GdNavBar *self)
height = gtk_widget_get_allocated_height (GTK_WIDGET (self->priv->preview_window));
window = gtk_widget_get_window (GTK_WIDGET (self));
+ gdk_window_get_root_origin (window, &rx, &ry);
gdk_window_get_position (window, &bx, &by);
- bwidth = gdk_window_get_width (window);
- bheight = gdk_window_get_height (window);
- parent = gtk_widget_get_parent_window (GTK_WIDGET (self));
- gdk_window_get_root_coords (parent, bx, by, &rx, &ry);
-
- x = rx + bwidth / 2 - width / 2;
- y = ry - height - 10;
+ x = rx + bx + (gdk_window_get_width (window) - width) / 2;
+ y = ry + by - height + 10;
gtk_window_move (GTK_WINDOW (self->priv->preview_window), x, y);
gtk_window_present (GTK_WINDOW (self->priv->preview_window));
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 531ab4a..6b1e084 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -19,12 +19,10 @@
*
*/
-const Clutter = imports.gi.Clutter;
const Gd = imports.gi.Gd;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const Pango = imports.gi.Pango;
const Gettext = imports.gettext;
@@ -35,7 +33,6 @@ const Mainloop = imports.mainloop;
const Application = imports.application;
const Searchbar = imports.searchbar;
-const Tweener = imports.util.tweener;
const MainToolbar = new Lang.Class({
Name: 'MainToolbar',
@@ -44,7 +41,7 @@ const MainToolbar = new Lang.Class({
this._model = null;
this.widget = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
- this.actor = new GtkClutter.Actor({ contents: this.widget });
+ this.widget.show();
this.toolbar = new Gd.MainToolbar({ icon_size: Gtk.IconSize.MENU });
this.toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_MENUBAR);
@@ -75,8 +72,8 @@ const OverviewToolbar = new Lang.Class({
Name: 'OverviewToolbar',
Extends: MainToolbar,
- _init: function(viewLayout) {
- this._viewLayout = viewLayout;
+ _init: function(overlay) {
+ this._overlay = overlay;
this._collBackButton = null;
this._collectionId = 0;
this._selectionChangedId = 0;
@@ -288,8 +285,7 @@ const OverviewToolbar = new Lang.Class({
createSearchbar: function() {
// create the dropdown for the search bar, it's hidden by default
let dropdown = new Searchbar.Dropdown();
- this._viewLayout.add(dropdown.actor,
- Clutter.BinAlignment.CENTER, Clutter.BinAlignment.FIXED);
+ this._overlay.add_overlay(dropdown.widget);
return new Searchbar.OverviewSearchbar(dropdown);
}
diff --git a/src/mainWindow.js b/src/mainWindow.js
index dc59313..e5dbe9c 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -19,11 +19,9 @@
*
*/
-const Clutter = imports.gi.Clutter;
const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
diff --git a/src/notifications.js b/src/notifications.js
index dfac914..52bdeb0 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -19,12 +19,10 @@
*
*/
-const Clutter = imports.gi.Clutter;
const Gd = imports.gi.Gd;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const TrackerMiner = imports.gi.TrackerMiner;
const _ = imports.gettext.gettext;
@@ -257,19 +255,13 @@ const NotificationManager = new Lang.Class({
_init: function() {
this.widget = new Gd.Notification({ timeout: -1,
- show_close_button: false });
+ show_close_button: false,
+ halign: Gtk.Align.CENTER,
+ valign: Gtk.Align.START });
this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
row_spacing: 6 });
- this.actor = new GtkClutter.Actor({ contents: this.widget,
- x_align: Clutter.ActorAlign.CENTER,
- y_align: Clutter.ActorAlign.START,
- y_expand: true,
- visible: false });
- Utils.alphaGtkWidget(this.actor.get_widget());
-
this.widget.add(this._grid);
- this.widget.show_all();
// add indexing monitor notification
this._indexingNotification = new IndexingNotification();
@@ -277,18 +269,16 @@ const NotificationManager = new Lang.Class({
addNotification: function(notification) {
this._grid.add(notification.widget);
-
- notification.widget.show_all();
notification.widget.connect('destroy', Lang.bind(this, this._onWidgetDestroy));
- this.actor.show();
+ this.widget.show_all();
},
_onWidgetDestroy: function() {
let children = this._grid.get_children();
if (children.length == 0)
- this.actor.hide();
+ this.widget.hide();
}
});
Signals.addSignalMethods(NotificationManager.prototype);
diff --git a/src/preview.js b/src/preview.js
index bed45cb..8d39fb5 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -19,22 +19,21 @@
*
*/
-const Clutter = imports.gi.Clutter;
const EvView = imports.gi.EvinceView;
+const Gd = imports.gi.Gd;
const GdPrivate = imports.gi.GdPrivate;
const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const _ = imports.gettext.gettext;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
+const Tweener = imports.tweener.tweener;
const Application = imports.application;
-const Tweener = imports.util.tweener;
const MainToolbar = imports.mainToolbar;
const Places = imports.places;
const Searchbar = imports.searchbar;
@@ -46,7 +45,7 @@ const _FULLSCREEN_TOOLBAR_TIMEOUT = 2; // seconds
const PreviewView = new Lang.Class({
Name: 'PreviewView',
- _init: function(overlayLayout) {
+ _init: function(overlay) {
this._model = null;
this._jobFind = null;
this._controlsFlipId = 0;
@@ -54,7 +53,7 @@ const PreviewView = new Lang.Class({
this._pageChanged = false;
this._viewSelectionChanged = false;
this._fsToolbar = null;
- this._overlayLayout = overlayLayout;
+ this._overlay = overlay;
this._lastSearch = '';
Application.modeController.connect('fullscreen-changed', Lang.bind(this,
@@ -73,8 +72,7 @@ const PreviewView = new Lang.Class({
// create page nav bar
this._navBar = new PreviewNav(this._model);
- this._overlayLayout.add(this._navBar.actor,
- Clutter.BinAlignment.FILL, Clutter.BinAlignment.END);
+ this._overlay.add_overlay(this._navBar.widget);
this.widget.show_all();
@@ -229,15 +227,14 @@ const PreviewView = new Lang.Class({
// create fullscreen toolbar (hidden by default)
this._fsToolbar = new PreviewFullscreenToolbar(this);
this._fsToolbar.setModel(this._model);
- this._overlayLayout.add(this._fsToolbar.actor,
- Clutter.BinAlignment.FILL, Clutter.BinAlignment.START);
+ this._overlay.add_overlay(this._fsToolbar.revealer);
this._fsToolbar.connect('show-controls', Lang.bind(this,
function() {
this.controlsVisible = true;
}));
} else {
- this._fsToolbar.actor.destroy();
+ this._fsToolbar.revealer.destroy();
this._fsToolbar = null;
}
@@ -363,13 +360,13 @@ const PreviewView = new Lang.Class({
this._jobFind = null;
}
+ this._lastSearch = str;
+
if (!str) {
this.view.queue_draw();
return;
}
- this._lastSearch = str;
-
let evDoc = this._model.get_document();
this._jobFind = EvView.JobFind.new(evDoc, this._model.get_page(), evDoc.get_n_pages(),
str, false);
@@ -426,7 +423,10 @@ const PreviewNav = new Lang.Class({
_init: function(model) {
this._model = model;
- this.widget = new GdPrivate.NavBar({ document_model: model });
+ this.widget = new GdPrivate.NavBar({ document_model: model,
+ margin: _PREVIEW_NAVBAR_MARGIN,
+ valign: Gtk.Align.END,
+ opacity: 0 });
this.widget.get_style_context().add_class('osd');
let button = new Gtk.Button({ action_name: 'app.places',
@@ -443,17 +443,6 @@ const PreviewNav = new Lang.Class({
valign: Gtk.Align.CENTER
});
buttonArea.pack_start(button, false, false, 0);
-
- this.actor = new GtkClutter.Actor({ contents: this.widget,
- visible: false,
- margin_top: _PREVIEW_NAVBAR_MARGIN,
- margin_bottom: _PREVIEW_NAVBAR_MARGIN,
- margin_left: _PREVIEW_NAVBAR_MARGIN,
- margin_right: _PREVIEW_NAVBAR_MARGIN,
- opacity: 0 });
- Utils.alphaGtkWidget(this.actor.get_widget());
-
- this.widget.show_all();
},
setModel: function(model) {
@@ -467,23 +456,20 @@ const PreviewNav = new Lang.Class({
if (!this._model)
return;
- this.actor.show();
-
- Tweener.addTween(this.actor,
- { opacity: 255,
- time: 0.30,
- transition: 'easeOutQuad' });
+ this.widget.show_all();
+ Tweener.addTween(this.widget, { opacity: 1,
+ time: 0.30,
+ transition: 'easeOutQuad' });
},
hide: function() {
- Tweener.addTween(this.actor,
- { opacity: 0,
- time: 0.30,
- transition: 'easeOutQuad',
- onComplete: function() {
- this.actor.hide();
- },
- onCompleteScope: this });
+ Tweener.addTween(this.widget, { opacity: 0,
+ time: 0.30,
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ this.widget.hide();
+ },
+ onCompleteScope: this });
}
});
@@ -641,7 +627,9 @@ const PreviewFullscreenToolbar = new Lang.Class({
_init: function(previewView) {
this.parent(previewView);
- this.actor.translation_y = -(this.widget.get_preferred_height()[1]);
+ this.revealer = new Gd.Revealer({ valign: Gtk.Align.START });
+ this.revealer.add(this.widget);
+ this.revealer.show();
// make controls show when a toolbar action is activated in fullscreen
let actionNames = ['gear-menu', 'search'];
@@ -676,24 +664,12 @@ const PreviewFullscreenToolbar = new Lang.Class({
},
show: function() {
- this.actor.show();
- Tweener.addTween(this.actor,
- { translation_y: 0,
- time: 0.20,
- transition: 'easeInQuad' });
+ this.revealer.set_revealed(true);
},
hide: function() {
- Tweener.addTween(this.actor,
- { translation_y: -(this.widget.get_preferred_height()[1]),
- time: 0.20,
- transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this.actor.hide();
- Application.application.change_action_state('search', GLib.Variant.new('b', false));
- })
- });
+ this.revealer.set_revealed(false);
+ Application.application.change_action_state('search', GLib.Variant.new('b', false));
}
});
Signals.addSignalMethods(PreviewFullscreenToolbar.prototype);
diff --git a/src/searchbar.js b/src/searchbar.js
index 0625216..b9ca7df 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -23,7 +23,6 @@ const Gd = imports.gi.Gd;
const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const Tracker = imports.gi.Tracker;
const _ = imports.gettext.gettext;
@@ -33,7 +32,7 @@ const Signals = imports.signals;
const Application = imports.application;
const Manager = imports.manager;
-const Tweener = imports.util.tweener;
+const Tweener = imports.tweener.tweener;
const Utils = imports.utils;
const _SEARCH_ENTRY_TIMEOUT = 200;
@@ -82,6 +81,9 @@ const Searchbar = new Lang.Class({
this._searchEntryTimeout = 0;
}
+ if (this._searchChangeBlocked)
+ return;
+
this._searchEntryTimeout = Mainloop.timeout_add(_SEARCH_ENTRY_TIMEOUT, Lang.bind(this,
function() {
this._searchEntryTimeout = 0;
@@ -207,7 +209,9 @@ const Searchbar = new Lang.Class({
this._in = false;
this.widget.set_revealed(false);
// clear all the search properties when hiding the entry
+ this._searchChangeBlocked = true;
this._searchEntry.set_text('');
+ this._searchChangeBlocked = false;
}
});
@@ -229,11 +233,11 @@ const Dropdown = new Lang.Class({
this._matchView.connect('item-activated',
Lang.bind(this, this._onItemActivated));
- this.widget = new Gtk.Frame({ shadow_type: Gtk.ShadowType.IN });
- this.actor = new GtkClutter.Actor({ contents: this.widget,
- opacity: 0 });
- let actorWidget = this.actor.get_widget();
- actorWidget.get_style_context().add_class('documents-dropdown');
+ this.widget = new Gtk.Frame({ shadow_type: Gtk.ShadowType.IN,
+ halign: Gtk.Align.CENTER,
+ valign: Gtk.Align.START,
+ opacity: 0 });
+ this.widget.get_style_context().add_class('documents-dropdown');
this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL });
this.widget.add(this._grid);
@@ -253,24 +257,19 @@ const Dropdown = new Lang.Class({
show: function() {
this.widget.show_all();
- let parent = this.actor.get_parent();
- parent.set_child_above_sibling(this.actor, null);
-
- Tweener.addTween(this.actor, { opacity: 245,
- time: 0.20,
- transition: 'easeOutQuad' });
+ Tweener.addTween(this.widget, { opacity: 0.9,
+ time: 0.20,
+ transition: 'easeOutQuad' });
},
hide: function() {
- this.widget.hide();
- Tweener.addTween(this.actor, { opacity: 0,
- time: 0.20,
- transition: 'easeOutQuad',
- onComplete: function() {
- let parent = this.actor.get_parent();
- parent.set_child_below_sibling(this.actor, null);
- },
- onCompleteScope: this });
+ Tweener.addTween(this.widget, { opacity: 0,
+ time: 0.20,
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ this.widget.hide();
+ },
+ onCompleteScope: this });
}
});
Signals.addSignalMethods(Dropdown.prototype);
diff --git a/src/selections.js b/src/selections.js
index f44d6cf..950d333 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -19,14 +19,12 @@
*
*/
-const Clutter = imports.gi.Clutter;
const EvView = imports.gi.EvinceView;
const Gd = imports.gi.Gd;
const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
const Pango = imports.gi.Pango;
const _ = imports.gettext.gettext;
@@ -37,7 +35,7 @@ const Notifications = imports.notifications;
const Properties = imports.properties;
const Query = imports.query;
const Sharing = imports.sharing;
-const Tweener = imports.util.tweener;
+const Tweener = imports.tweener.tweener;
const Utils = imports.utils;
const Lang = imports.lang;
@@ -721,30 +719,19 @@ const _SELECTION_TOOLBAR_DEFAULT_WIDTH = 500;
const SelectionToolbar = new Lang.Class({
Name: 'SelectionToolbar',
- _init: function(parentActor) {
+ _init: function() {
this._itemListeners = {};
this._insideRefresh = false;
- this._parentActor = parentActor;
this.widget = new Gtk.Toolbar({ show_arrow: false,
- icon_size: Gtk.IconSize.LARGE_TOOLBAR });
+ halign: Gtk.Align.CENTER,
+ valign: Gtk.Align.END,
+ margin_bottom: 40,
+ icon_size: Gtk.IconSize.LARGE_TOOLBAR,
+ opacity: 0 });
this.widget.get_style_context().add_class('osd');
this.widget.set_size_request(_SELECTION_TOOLBAR_DEFAULT_WIDTH, -1);
- this.actor = new GtkClutter.Actor({ contents: this.widget,
- show_on_set_parent: false,
- opacity: 0 });
- Utils.alphaGtkWidget(this.actor.get_widget());
-
- this.actor.add_constraint(
- new Clutter.AlignConstraint({ align_axis: Clutter.AlignAxis.X_AXIS,
- source: this._parentActor,
- factor: 0.50 }));
- this.actor.add_constraint(
- new Clutter.AlignConstraint({ align_axis: Clutter.AlignAxis.Y_AXIS,
- source: this._parentActor,
- factor: 0.95 }));
-
this._leftBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL });
this._leftGroup = new Gtk.ToolItem({ child: this._leftBox });
this.widget.insert(this._leftGroup, -1);
@@ -800,8 +787,6 @@ const SelectionToolbar = new Lang.Class({
this._rightBox.add(this._toolbarShare);
this._toolbarShare.connect('clicked', Lang.bind(this, this._onToolbarShare));
- this.widget.show_all();
-
Application.selectionController.connect('selection-mode-changed',
Lang.bind(this, this._onSelectionModeChanged));
Application.selectionController.connect('selection-changed',
@@ -971,26 +956,19 @@ const SelectionToolbar = new Lang.Class({
},
_fadeIn: function() {
- if (this.actor.opacity != 0)
- return;
-
- this.actor.opacity = 0;
- this.actor.show();
-
- Tweener.addTween(this.actor,
- { opacity: 255,
- time: 0.30,
- transition: 'easeOutQuad' });
+ this.widget.show_all();
+ Tweener.addTween(this.widget, { opacity: 1,
+ time: 0.30,
+ transition: 'easeOutQuad' });
},
_fadeOut: function() {
- Tweener.addTween(this.actor,
- { opacity: 0,
- time: 0.30,
- transition: 'easeOutQuad',
- onComplete: function() {
- this.actor.hide();
- },
- onCompleteScope: this });
+ Tweener.addTween(this.widget, { opacity: 0,
+ time: 0.30,
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ this.widget.hide();
+ },
+ onCompleteScope: this });
}
});
diff --git a/src/utils.js b/src/utils.js
index 1bbde88..d5ca532 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -99,13 +99,6 @@ function getURNFromPath(path, model) {
return id;
}
-function alphaGtkWidget(widget) {
- widget.override_background_color(0, new Gdk.RGBA({ red: 0,
- green: 0,
- blue: 0,
- alpha: 0 }));
-}
-
function debug(str) {
if (!debugInit) {
let env = GLib.getenv('DOCUMENTS_DEBUG');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]