[Xfce4-commits] <midori:master> Integrate GraniteWidgets.NavigationBox into Midori.Tab
Christian Dywan
noreply at xfce.org
Mon Oct 29 11:26:01 CET 2012
Updating branch refs/heads/master
to 4abfbf7d44ea8b0cfd247b7b8105b443b2954930 (commit)
from bc557f9988141f5ed14ad259edeb7d17a86e1261 (commit)
commit 4abfbf7d44ea8b0cfd247b7b8105b443b2954930
Author: Tom Beckmann <tom at elementaryos.org>
Date: Sun Oct 28 16:43:28 2012 +0100
Integrate GraniteWidgets.NavigationBox into Midori.Tab
extensions/wscript_build | 4 ++-
midori/midori-app.c | 5 +++
midori/midori-tab.vala | 11 +++++++
midori/midori-view.c | 70 +++++++++++++++++++++++++++++-----------------
midori/wscript_build | 4 ++-
wscript | 2 +
6 files changed, 68 insertions(+), 28 deletions(-)
diff --git a/extensions/wscript_build b/extensions/wscript_build
index cf556c9..5e2b41e 100644
--- a/extensions/wscript_build
+++ b/extensions/wscript_build
@@ -32,13 +32,15 @@ for extension in extensions:
obj.target = target
obj.includes = '.. ../katze ../midori'
obj.source = source
- obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML HILDON'
+ obj.uselib = 'UNIQUE LIBSOUP GIO GTK SQLITE WEBKIT LIBXML HILDON CLUTTER GRANITE'
obj.vapi_dirs = '../midori ../katze'
obj.packages = 'glib-2.0 gio-2.0 libsoup-2.4 sqlite3 midori midori-core katze'
if bld.env['HAVE_GTK3']:
obj.packages += ' gtk+-3.0 webkitgtk-3.0'
else:
obj.packages += ' gtk+-2.0 webkit-1.0 unique-1.0'
+ if bld.env['HAVE_GRANITE']:
+ obj.packages += ' clutter-gtk-1.0 granite'
obj.install_path = '${LIBDIR}/midori'
if bld.env['platform'] == 'win32':
obj.uselib_local = 'midori'
diff --git a/midori/midori-app.c b/midori/midori-app.c
index 0b4fba5..05fc559 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -1436,8 +1436,13 @@ midori_app_setup (gint *argc,
textdomain (GETTEXT_PACKAGE);
#endif
+ #ifdef HAVE_GRANITE
+ success = gtk_clutter_init_with_args (argc, argument_vector, _("[Addresses]"),
+ (GOptionEntry*)entries, GETTEXT_PACKAGE, error);
+ #else
success = gtk_init_with_args (argc, argument_vector, _("[Addresses]"),
entries, GETTEXT_PACKAGE, error);
+ #endif
factory = gtk_icon_factory_new ();
for (i = 0; i < G_N_ELEMENTS (items); i++)
diff --git a/midori/midori-tab.vala b/midori/midori-tab.vala
index b6c78a9..db6e6a8 100644
--- a/midori/midori-tab.vala
+++ b/midori/midori-tab.vala
@@ -36,6 +36,10 @@ namespace Midori {
public class Tab : Gtk.VBox {
public WebKit.WebView web_view { get; private set; }
+ #if HAVE_GRANITE
+ public Granite.Widgets.NavigationBox navigation_box { get; private set; }
+ #endif
+
private string current_uri = "about:blank";
public string uri { get {
return current_uri;
@@ -90,6 +94,10 @@ namespace Midori {
orientation = Gtk.Orientation.VERTICAL;
#endif
+ #if HAVE_GRANITE
+ navigation_box = new Granite.Widgets.NavigationBox ();
+ #endif
+
web_view = new WebKit.WebView ();
/* Load something to avoid a bug where WebKit might not set a main frame */
web_view.load_uri ("");
@@ -187,6 +195,9 @@ namespace Midori {
}
public void go_forward () {
+ #if HAVE_GRANITE
+ navigation_box.forward ();
+ #endif
web_view.go_forward ();
}
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 59df6a6..47c1028 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -787,6 +787,10 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view,
if (web_frame != webkit_web_view_get_main_frame (web_view))
return;
+ #ifdef HAVE_GRANITE
+ GraniteWidgetsNavigationBox* navigation_box = midori_tab_get_navigation_box (MIDORI_TAB (view));
+ granite_widgets_navigation_box_transition_ready (navigation_box);
+ #endif
g_object_freeze_notify (G_OBJECT (view));
uri = webkit_web_frame_get_uri (web_frame);
@@ -3071,32 +3075,6 @@ midori_view_init (MidoriView* view)
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->scrolled_window),
GTK_SHADOW_NONE);
- #if GTK_CHECK_VERSION(3, 2, 0)
- view->overlay = gtk_overlay_new ();
- gtk_widget_show (view->overlay);
- gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);
- gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0);
-
- /* Overlays must be created before showing GtkOverlay as of GTK+ 3.2 */
- {
- GtkWidget* frame = gtk_frame_new (NULL);
- view->overlay_label = gtk_label_new (NULL);
- gtk_widget_show (view->overlay_label);
- gtk_container_add (GTK_CONTAINER (frame), view->overlay_label);
- gtk_widget_set_halign (frame, GTK_ALIGN_START);
- gtk_widget_set_valign (frame, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay), frame);
- }
- view->overlay_find = g_object_new (MIDORI_TYPE_FINDBAR, NULL);
- gtk_widget_set_halign (view->overlay_find, GTK_ALIGN_END);
- gtk_widget_set_valign (view->overlay_find, GTK_ALIGN_START);
- gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay),
- view->overlay_find);
- gtk_widget_set_no_show_all (view->overlay_find, TRUE);
- #else
- gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
- #endif
-
g_signal_connect (view->item, "meta-data-changed",
G_CALLBACK (midori_view_item_meta_data_changed), view);
g_signal_connect (view->scrolled_window, "notify::hadjustment",
@@ -3553,6 +3531,41 @@ midori_view_constructor (GType type,
type, n_construct_properties, construct_properties);
MidoriView* view = MIDORI_VIEW (object);
+ #if GTK_CHECK_VERSION(3, 2, 0)
+ view->overlay = gtk_overlay_new ();
+ gtk_widget_show (view->overlay);
+ #ifdef HAVE_GRANITE
+ {
+ GraniteWidgetsNavigationBox* navigation_box = midori_tab_get_navigation_box (MIDORI_TAB (view));
+ granite_widgets_navigation_box_add (navigation_box, GTK_WIDGET (view->scrolled_window));
+ gtk_widget_show (GTK_WIDGET (view->scrolled_window));
+ gtk_container_add (GTK_CONTAINER (view->overlay), GTK_WIDGET (navigation_box));
+ }
+ #else
+ gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);
+ #endif
+ gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0);
+
+ /* Overlays must be created before showing GtkOverlay as of GTK+ 3.2 */
+ {
+ GtkWidget* frame = gtk_frame_new (NULL);
+ view->overlay_label = gtk_label_new (NULL);
+ gtk_widget_show (view->overlay_label);
+ gtk_container_add (GTK_CONTAINER (frame), view->overlay_label);
+ gtk_widget_set_halign (frame, GTK_ALIGN_START);
+ gtk_widget_set_valign (frame, GTK_ALIGN_END);
+ gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay), frame);
+ }
+ view->overlay_find = g_object_new (MIDORI_TYPE_FINDBAR, NULL);
+ gtk_widget_set_halign (view->overlay_find, GTK_ALIGN_END);
+ gtk_widget_set_valign (view->overlay_find, GTK_ALIGN_START);
+ gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay),
+ view->overlay_find);
+ gtk_widget_set_no_show_all (view->overlay_find, TRUE);
+ #else
+ gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
+ #endif
+
view->web_view = GTK_WIDGET (midori_tab_get_web_view (MIDORI_TAB (view)));
g_object_connect (view->web_view,
"signal::navigation-policy-decision-requested",
@@ -4963,6 +4976,11 @@ midori_view_go_back (MidoriView* view)
{
g_return_if_fail (MIDORI_IS_VIEW (view));
+ #ifdef HAVE_GRANITE
+ GraniteWidgetsNavigationBox* navigation_box = midori_tab_get_navigation_box (MIDORI_TAB (view));
+ granite_widgets_navigation_box_back (navigation_box);
+ #endif
+
webkit_web_view_go_back (WEBKIT_WEB_VIEW (view->web_view));
/* Force the speed dial to kick in if going back to a blank page */
if (midori_view_is_blank (view))
diff --git a/midori/wscript_build b/midori/wscript_build
index 957cc2c..76bafbc 100644
--- a/midori/wscript_build
+++ b/midori/wscript_build
@@ -9,7 +9,7 @@ import os
progressive = True
libs = 'M UNIQUE LIBSOUP GMODULE GTHREAD LIBIDN GIO GTK SQLITE ' \
'LIBNOTIFY WEBKIT JAVASCRIPTCOREGTK LIBXML X11 XSS WS2_32 HILDON' \
- 'HILDON_FM GCR GRANITE ZEITGEIST'
+ 'HILDON_FM GCR GRANITE CLUTTER ZEITGEIST'
if Options.commands['build'] or Options.commands['check']:
blddir = str (bld.bldnode)[6:] # dir:// + absolute path
@@ -31,6 +31,8 @@ if progressive:
obj.packages += ' gtk+-3.0 webkitgtk-3.0'
else:
obj.packages += ' gtk+-2.0 webkit-1.0'
+ if bld.env['HAVE_GRANITE']:
+ obj.packages += ' clutter-gtk-1.0 granite'
bld.add_group ()
obj = bld.new_task_gen ('cc', 'program')
diff --git a/wscript b/wscript
index f8d4167..829e968 100644
--- a/wscript
+++ b/wscript
@@ -219,6 +219,7 @@ def configure (conf):
conf.define ('HAVE_LIBNOTIFY', [0,1][libnotify == 'yes'])
if option_enabled ('granite'):
+ check_pkg ('clutter-gtk-1.0', '1.0')
if not option_enabled ('gtk3'):
if getattr (Options.options, 'enable_granite'):
Utils.pprint ('RED', 'Granite requires --enable-gtk3')
@@ -233,6 +234,7 @@ def configure (conf):
conf.define ('GRANITE_VERSION', 'No')
else:
conf.define ('GRANITE_VERSION', conf.check_cfg (modversion='granite'))
+ conf.env.append_value ('VALAFLAGS', '-D HAVE_GRANITE')
else:
granite = 'no '
conf.define ('GRANITE_VERSION', 'No')
More information about the Xfce4-commits
mailing list