seed r786 - trunk/examples/browser
- From: hortont svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r786 - trunk/examples/browser
- Date: Wed, 21 Jan 2009 02:19:18 +0000 (UTC)
Author: hortont
Date: Wed Jan 21 02:19:18 2009
New Revision: 786
URL: http://svn.gnome.org/viewvc/seed?rev=786&view=rev
Log:
Update browser to use progress-in-GtkEntry, like Ephy/Safari. Shouldn't
break on old Gtks, just won't get progress.
Modified:
trunk/examples/browser/BrowserStatusbar.js
trunk/examples/browser/BrowserToolbar.js
trunk/examples/browser/BrowserView.js
trunk/examples/browser/main.js
Modified: trunk/examples/browser/BrowserStatusbar.js
==============================================================================
--- trunk/examples/browser/BrowserStatusbar.js (original)
+++ trunk/examples/browser/BrowserStatusbar.js Wed Jan 21 02:19:18 2009
@@ -4,16 +4,9 @@
init: function (klass)
{
// Private
- var progress = new Gtk.ProgressBar();
- var progress_box = new Gtk.VBox();
var transient_status_group = this.get_context_id("transient");
// Public
- this.get_progress = function ()
- {
- return progress;
- };
-
this.set_status = function (status)
{
this.pop(transient_status_group);
@@ -21,8 +14,5 @@
};
// Implementation
- this.pack_end(progress_box, false, false, 3);
- progress_box.pack_start(progress, true, true, 3);
- progress.set_size_request(-1, 10);
}
});
Modified: trunk/examples/browser/BrowserToolbar.js
==============================================================================
--- trunk/examples/browser/BrowserToolbar.js (original)
+++ trunk/examples/browser/BrowserToolbar.js Wed Jan 21 02:19:18 2009
@@ -46,6 +46,12 @@
forward_button.sensitive = can_go_forward;
};
+ this.set_progress = function (progress)
+ {
+ if(have_progress_bar)
+ url_bar.set_progress_fraction(progress);
+ };
+
// Implementation
back_button.signal.clicked.connect(back);
forward_button.signal.clicked.connect(forward);
Modified: trunk/examples/browser/BrowserView.js
==============================================================================
--- trunk/examples/browser/BrowserView.js (original)
+++ trunk/examples/browser/BrowserView.js Wed Jan 21 02:19:18 2009
@@ -25,7 +25,7 @@
var update_progress = function (bar, progress)
{
- tab.get_statusbar().get_progress().fraction = progress / 100;
+ tab.get_toolbar().set_progress(progress / 100);
};
var create_new_tab = function (web_view, web_frame, new_web_view)
@@ -49,16 +49,12 @@
var load_finished = function ()
{
- tab.get_statusbar().get_progress().hide();
+ tab.get_toolbar().set_progress(0);
};
var load_committed = function (web_view, web_frame)
{
update_url(web_view, web_frame);
-
- // Show statusbar in committed; otherwise, open-in-new-tab views
- // haven't yet acquired a tab on which to show a progressbar.
- tab.get_statusbar().get_progress().show();
};
// Public
Modified: trunk/examples/browser/main.js
==============================================================================
--- trunk/examples/browser/main.js (original)
+++ trunk/examples/browser/main.js Wed Jan 21 02:19:18 2009
@@ -12,6 +12,15 @@
Seed.include("TabbedBrowser.js");
Seed.include("BrowserToolbar.js");
+// Test for Gtk >= 2.16 (otherwise don't have a progress bar)
+
+have_progress_bar = false;
+
+if(Gtk.Entry.prototype.set_progress_fraction)
+{
+ have_progress_bar = true;
+}
+
window = new Gtk.Window({title: "Browser"});
window.resize(800, 600);
window.signal.hide.connect(function () { Gtk.main_quit(); });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]