struct _MidoriBrowser
{
+ #if HAVE_HILDON
+ HildonWindow parent_instance;
+ #else
GtkWindow parent_instance;
+ #endif
GtkActionGroup* action_group;
GtkWidget* menubar;
KatzeNet* net;
};
+#if HAVE_HILDON
+G_DEFINE_TYPE (MidoriBrowser, midori_browser, HILDON_TYPE_WINDOW)
+#else
G_DEFINE_TYPE (MidoriBrowser, midori_browser, GTK_TYPE_WINDOW)
+#endif
enum
{
GdkEventButton* event,
MidoriBrowser* browser);
+#if !HAVE_HILDON
static void
_midori_browser_save_toolbar_items (MidoriBrowser* browser)
{
gtk_container_remove (GTK_CONTAINER (browser->navigationbar), widget);
_midori_browser_save_toolbar_items (browser);
}
+#endif
static gboolean
midori_browser_toolbar_popup_context_menu_cb (GtkWidget* widget,
_action_by_name (browser, "Statusbar"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ #if !HAVE_HILDON
if (widget == browser->navigationbar ||
gtk_widget_is_ancestor (widget, browser->navigationbar))
{
GtkAction* widget_action = gtk_widget_get_action (widget);
const gchar* actions[] = { "TabNew", "Open", "SaveAs", "Print", "Find",
"Preferences", "Window", "Bookmarks", "ReloadStop", "ZoomIn",
- "ZoomOut", "Back", "Forward", "Homepage", "Trash", "Search" };
+ "ZoomOut", "Back", "Forward", "Homepage", "Panel", "Trash", "Search" };
GtkWidget* submenu;
gsize i;
menuitem = gtk_separator_menu_item_new ();
+ gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
submenu = gtk_menu_new ();
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_ADD, NULL);
+ gtk_widget_show (menuitem);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_REMOVE, NULL);
+ gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
if (widget_action &&
strcmp (gtk_action_get_name (widget_action), "Location"))
g_signal_connect (menuitem, "activate",
G_CALLBACK (midori_browser_toolbar_add_item_cb), browser);
}
+ sokoke_container_show_children (GTK_CONTAINER (submenu));
}
+ #endif
- sokoke_container_show_children (GTK_CONTAINER (menu));
katze_widget_popup (widget, GTK_MENU (menu), NULL,
button == -1 ? KATZE_MENU_POSITION_LEFT : KATZE_MENU_POSITION_CURSOR);
return TRUE;
{
gboolean active = gtk_toggle_action_get_active (action);
g_object_set (browser->settings, "show-menubar", active, NULL);
+ #if !HAVE_HILDON
sokoke_widget_set_visible (browser->menubar, active);
+ #endif
}
static void
{
gboolean active = gtk_toggle_action_get_active (action);
g_object_set (browser->settings, "show-statusbar", active, NULL);
+ #if !HAVE_HILDON
sokoke_widget_set_visible (browser->statusbar, active);
+ #endif
}
static void
GError* error;
GtkAction* action;
GtkWidget* menuitem;
+ #if HAVE_HILDON
+ GtkWidget* menu;
+ GList* children;
+ #endif
GtkSettings* gtk_settings;
GtkWidget* hbox;
GtkWidget* hpaned;
/* Create the menubar */
browser->menubar = gtk_ui_manager_get_widget (ui_manager, "/menubar");
+ #if HAVE_HILDON
+ menu = gtk_menu_new ();
+ children = gtk_container_get_children (GTK_CONTAINER (browser->menubar));
+ while (children)
+ {
+ menuitem = GTK_WIDGET (children->data);
+ gtk_widget_reparent (menuitem, menu);
+ children = g_list_next (children);
+ }
+ browser->menubar = menu;
+ hildon_window_set_menu (HILDON_WINDOW (browser), GTK_MENU (browser->menubar));
+ hildon_program_add_window (hildon_program_get_instance (),
+ HILDON_WINDOW (browser));
+ #else
+ gtk_box_pack_start (GTK_BOX (vbox), browser->menubar, FALSE, FALSE, 0);
+ gtk_widget_hide (browser->menubar);
+ g_signal_connect (browser->menubar, "button-press-event",
+ G_CALLBACK (midori_browser_toolbar_item_button_press_event_cb), browser);
+ #endif
menuitem = gtk_menu_item_new ();
+ #if !HAVE_HILDON
gtk_widget_show (menuitem);
+ #endif
browser->throbber = katze_throbber_new ();
gtk_widget_show (browser->throbber);
gtk_container_add (GTK_CONTAINER (menuitem), browser->throbber);
gtk_widget_set_sensitive (menuitem, FALSE);
gtk_menu_item_set_right_justified (GTK_MENU_ITEM (menuitem), TRUE);
gtk_menu_shell_append (GTK_MENU_SHELL (browser->menubar), menuitem);
- gtk_box_pack_start (GTK_BOX (vbox), browser->menubar, FALSE, FALSE, 0);
browser->menu_tools = gtk_menu_item_get_submenu (GTK_MENU_ITEM (
gtk_ui_manager_get_widget (ui_manager, "/menubar/Tools")));
menuitem = gtk_separator_menu_item_new ();
gtk_widget_show (menuitem);
gtk_menu_shell_append (GTK_MENU_SHELL (browser->menu_tools), menuitem);
- gtk_widget_hide (browser->menubar);
- g_signal_connect (browser->menubar, "button-press-event",
- G_CALLBACK (midori_browser_toolbar_item_button_press_event_cb), browser);
_action_set_sensitive (browser, "PrivateBrowsing", FALSE);
_action_set_sensitive (browser, "FindQuick", FALSE);
+ #if HAVE_HILDON
+ g_object_set (_action_by_name (browser, "Menubar"), "visible", FALSE, NULL);
+ g_object_set (_action_by_name (browser, "Statusbar"), "visible", FALSE, NULL);
+ #endif
_action_set_sensitive (browser, "Transferbar", FALSE);
_action_set_sensitive (browser, "SelectionSourceView", FALSE);
g_signal_connect (gtk_settings, "notify::gtk-toolbar-style",
G_CALLBACK (midori_browser_navigationbar_notify_style_cb), browser);
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (browser->navigationbar), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), browser->navigationbar, FALSE, FALSE, 0);
g_object_set (_action_by_name (browser, "Back"), "is-important", TRUE, NULL);
gtk_widget_hide (browser->navigationbar);
g_signal_connect (browser->navigationbar, "popup-context-menu",
G_CALLBACK (midori_browser_toolbar_popup_context_menu_cb), browser);
+ #if HAVE_HILDON
+ hildon_window_add_toolbar (HILDON_WINDOW (browser),
+ GTK_TOOLBAR (browser->navigationbar));
+ #else
+ gtk_box_pack_start (GTK_BOX (vbox), browser->navigationbar, FALSE, FALSE, 0);
+ #endif
/* Bookmarkbar */
browser->bookmarkbar = gtk_toolbar_new ();
GTK_ICON_SIZE_MENU);
gtk_toolbar_set_style (GTK_TOOLBAR (browser->bookmarkbar),
GTK_TOOLBAR_BOTH_HORIZ);
+ #if HAVE_HILDON
+ hildon_window_add_toolbar (HILDON_WINDOW (browser),
+ GTK_TOOLBAR (browser->bookmarkbar));
+ #else
gtk_box_pack_start (GTK_BOX (vbox), browser->bookmarkbar, FALSE, FALSE, 0);
+ #endif
g_signal_connect (browser->bookmarkbar, "popup-context-menu",
G_CALLBACK (midori_browser_toolbar_popup_context_menu_cb), browser);
gtk_toolbar_insert (GTK_TOOLBAR (browser->find), toolitem, -1);
#endif
sokoke_container_show_children (GTK_CONTAINER (browser->find));
+ #if HAVE_HILDON
+ hildon_window_add_toolbar (HILDON_WINDOW (browser),
+ GTK_TOOLBAR (browser->find));
+ #else
gtk_box_pack_start (GTK_BOX (vbox), browser->find, FALSE, FALSE, 0);
+ #endif
/* Statusbar */
browser->statusbar = gtk_statusbar_new ();
_midori_browser_set_toolbar_style (MidoriBrowser* browser,
MidoriToolbarStyle toolbar_style)
{
+ #if HAVE_HILDON
+ GtkToolbarStyle gtk_toolbar_style = GTK_TOOLBAR_ICONS;
+ #else
GtkToolbarStyle gtk_toolbar_style;
GtkSettings* gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
if (toolbar_style == MIDORI_TOOLBAR_DEFAULT && gtk_settings)
gtk_toolbar_style = GTK_TOOLBAR_BOTH_HORIZ;
}
}
+ #endif
gtk_toolbar_set_style (GTK_TOOLBAR (browser->navigationbar),
gtk_toolbar_style);
}
GtkAction* action;
GtkWidget* toolitem;
+ #if HAVE_HILDON
+ items = "Bookmarks,Window,Back,Forward,ReloadStop,Location,Panel,Trash";
+ #endif
+
gtk_container_foreach (GTK_CONTAINER (browser->navigationbar),
(GtkCallback)gtk_widget_destroy, NULL);
/* Page "Interface" */
PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));
+ #if !HAVE_HILDON
FRAME_NEW (_("Navigationbar"));
TABLE_NEW (1, 2);
INDENTED_ADD (katze_property_label (settings, "toolbar-style"), 0, 1, 0, 1);
button = katze_property_proxy (settings, "toolbar-style", NULL);
FILLED_ADD (button, 1, 2, 0, 1);
+ #endif
FRAME_NEW (_("Browsing"));
TABLE_NEW (5, 2);
label = katze_property_label (settings, "open-new-pages-in");
#endif
button = katze_property_proxy (settings, "always-show-tabbar", NULL);
INDENTED_ADD (button, 0, 1, 2, 3);
- button = katze_property_proxy (settings, "compact-sidepanel", NULL);
+ button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
INDENTED_ADD (button, 1, 2, 2, 3);
+ #if !HAVE_HILDON
button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
INDENTED_ADD (button, 0, 1, 3, 4);
- button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
+ button = katze_property_proxy (settings, "compact-sidepanel", NULL);
WIDGET_ADD (button, 1, 2, 3, 4);
+ #endif
/* button = katze_property_proxy (settings, "open-popups-in-tabs", NULL);
SPANNED_ADD (button, 0, 1, 4, 5);*/
button = katze_property_proxy (settings, "open-tabs-next-to-current", NULL);
conf.check_tool ('intltool')
if conf.env['INTLTOOL'] and conf.env['POCOM']:
nls = 'yes'
- conf.define ('ENABLE_NLS', 1)
else:
option_checkfatal ('nls', 'localization')
nls = 'N/A'
else:
nls = 'no '
+ conf.define ('ENABLE_NLS', [0,1][nls == 'yes'])
dirname_default ('LIBDIR', os.path.join (conf.env['PREFIX'], 'lib'))
dirname_default ('DATADIR', os.path.join (conf.env['PREFIX'], 'share'))
unique = ['N/A', 'yes'][conf.env['HAVE_UNIQUE'] == 1]
else:
option_checkfatal ('unique', 'single instance')
- conf.define ('HAVE_UNIQUE', 0)
unique = 'no '
+ conf.define ('HAVE_UNIQUE', [0,1][unique == 'yes'])
if option_enabled ('libsoup'):
check_pkg ('libsoup-2.4', '2.23.1', False)
libsoup_25_2 = ['N/A','yes'][conf.env['HAVE_LIBSOUP_2_25_2'] == 1]
else:
option_checkfatal ('libsoup', 'libsoup')
- conf.define ('HAVE_LIBSOUP', 0)
- conf.define ('HAVE_LIBSOUP_2_25_2', 0)
libsoup = 'no '
libsoup_25_2 = 'no '
+ conf.define ('HAVE_LIBSOUP', [0,1][libsoup == 'yes'])
+ conf.define ('HAVE_LIBSOUP_2_25_2', [0,1][libsoup_25_2 == 'yes'])
if option_enabled ('sqlite'):
check_pkg ('sqlite3', '3.0', False, var='SQLITE')
sqlite = ['N/A','yes'][conf.env['HAVE_SQLITE'] == 1]
else:
option_checkfatal ('sqlite', 'history database')
- conf.define ('HAVE_SQLITE', 0)
sqlite = 'no '
+ conf.define ('HAVE_SQLITE', [0,1][sqlite == 'yes'])
check_pkg ('gmodule-2.0', '2.8.0', False)
check_pkg ('gthread-2.0', '2.8.0', False)
check_pkg ('webkit-1.0', '0.1')
check_pkg ('libxml-2.0', '2.6')
+ if option_enabled ('hildon'):
+ check_pkg ('hildon-1', mandatory=False, var='HILDON')
+ hildon = ['N/A','yes'][conf.env['HAVE_HILDON'] == 1]
+ else:
+ option_checkfatal ('hildon', 'Maemo integration')
+ hildon = 'no '
+ conf.define ('HAVE_HILDON', [0,1][hildon == 'yes'])
+
conf.check (header_name='unistd.h')
conf.define ('HAVE_OSX', int(sys.platform == 'darwin'))
else:
Utils.pprint ('RED', 'WebKit was NOT built with libsoup')
print "Persistent history: " + sqlite + " (sqlite3)"
+ print "Maemo integration: " + hildon + " (hildon)"
def set_options (opt):
def add_enable_option (option, desc, group=None, disable=False):
add_enable_option ('libsoup', 'icon and view source support', group)
add_enable_option ('sqlite', 'history database support', group)
add_enable_option ('addons', 'building of extensions', group)
+ add_enable_option ('hildon', 'Maemo integration', group)
def build (bld):
def mkdir (path):
bld.add_subdirs ('docs/api')
bld.install_files ('${DOCDIR}/midori/api/', blddir + '/docs/api/*')
+ if bld.env['HAVE_HILDON']:
+ appdir = '${DATADIR}/applications/hildon'
+ bld.install_files ('${DATADIR}/dbus-1/services',
+ 'data/com.nokia.' + APPNAME + '.service')
+ else:
+ appdir = '${DATADIR}/applications'
if bld.env['INTLTOOL']:
obj = bld.new_task_gen ('intltool_in')
- obj.source = APPNAME + '.desktop.in'
- obj.install_path = '${DATADIR}/applications'
- obj.flags = '-d'
- bld.install_files ('${DATADIR}/applications', APPNAME + '.desktop')
+ obj.source = 'data/' + APPNAME + '.desktop.in'
+ obj.install_path = '${DATADIR}/applications/hildon'
+ obj.flags = '-d'
+ bld.install_files (appdir, 'data/' + APPNAME + '.desktop')
else:
- folder = os.path.dirname (bld.env['waf_config_files'][0])
+ folder = os.path.dirname (bld.env['waf_config_files'][0]) + '/data'
desktop = APPNAME + '.desktop'
pre = open (desktop + '.in')
after = open (folder + '/' + desktop, 'w')
after.write (line)
after.close ()
Utils.pprint ('BLUE', desktop + '.in -> ' + desktop)
- bld.install_files ('${DATADIR}/applications', folder + '/' + desktop)
+ bld.install_files (appdir, folder + '/' + desktop)
except:
Utils.pprint ('BLUE', 'File ' + desktop + ' not generated')
finally: