Implement and optimize for portrait mode support for Fremantle
Listen to accelerometer movement. Hide tool items in portrait mode. Omit Homepage and View Source from app menu. Include Compact Add, View Source and Fullscreen in context menu. Hide buttons in portrait mode in preferences.
This commit is contained in:
parent
11de65af92
commit
1d68dc9fb7
4 changed files with 123 additions and 15 deletions
|
@ -66,6 +66,19 @@ katze_preferences_response_cb (KatzePreferences* preferences,
|
||||||
gtk_widget_destroy (GTK_WIDGET (preferences));
|
gtk_widget_destroy (GTK_WIDGET (preferences));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_HILDON_2_2
|
||||||
|
static void
|
||||||
|
katze_preferences_size_request_cb (KatzePreferences* preferences,
|
||||||
|
GtkRequisition* requisition)
|
||||||
|
{
|
||||||
|
GdkScreen* screen = gtk_widget_get_screen (GTK_WIDGET (preferences));
|
||||||
|
if (gdk_screen_get_height (screen) > gdk_screen_get_width (screen))
|
||||||
|
gtk_widget_hide (gtk_dialog_get_action_area (GTK_DIALOG (preferences)));
|
||||||
|
else
|
||||||
|
gtk_widget_show (gtk_dialog_get_action_area (GTK_DIALOG (preferences)));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
katze_preferences_init (KatzePreferences* preferences)
|
katze_preferences_init (KatzePreferences* preferences)
|
||||||
{
|
{
|
||||||
|
@ -94,9 +107,17 @@ katze_preferences_init (KatzePreferences* preferences)
|
||||||
#endif
|
#endif
|
||||||
NULL);
|
NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_object_connect (preferences,
|
g_object_connect (preferences,
|
||||||
"signal::response", katze_preferences_response_cb, NULL,
|
"signal::response", katze_preferences_response_cb, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
#ifdef HAVE_HILDON_2_2
|
||||||
|
katze_preferences_size_request_cb (preferences, NULL);
|
||||||
|
g_object_connect (preferences,
|
||||||
|
"signal::size-request", katze_preferences_size_request_cb, NULL,
|
||||||
|
NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -168,7 +189,8 @@ katze_preferences_prepare (KatzePreferences* preferences)
|
||||||
priv->sizegroup = NULL;
|
priv->sizegroup = NULL;
|
||||||
priv->sizegroup2 = NULL;
|
priv->sizegroup2 = NULL;
|
||||||
|
|
||||||
g_signal_connect (priv->scrolled, "destroy", G_CALLBACK (gtk_widget_destroyed), &priv->scrolled);
|
g_signal_connect (priv->scrolled, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &priv->scrolled);
|
||||||
#else
|
#else
|
||||||
priv->notebook = gtk_notebook_new ();
|
priv->notebook = gtk_notebook_new ();
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 6);
|
||||||
|
@ -195,7 +217,8 @@ katze_preferences_prepare (KatzePreferences* preferences)
|
||||||
priv->box = NULL;
|
priv->box = NULL;
|
||||||
priv->hbox = NULL;
|
priv->hbox = NULL;
|
||||||
|
|
||||||
g_signal_connect (priv->notebook, "destroy", G_CALLBACK (gtk_widget_destroyed), &priv->notebook);
|
g_signal_connect (priv->notebook, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &priv->notebook);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_OSX
|
#if HAVE_OSX
|
||||||
|
@ -206,8 +229,7 @@ katze_preferences_prepare (KatzePreferences* preferences)
|
||||||
gtk_button_set_image (GTK_BUTTON (button), icon);
|
gtk_button_set_image (GTK_BUTTON (button), icon);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
G_CALLBACK (katze_preferences_help_clicked_cb), preferences);
|
G_CALLBACK (katze_preferences_help_clicked_cb), preferences);
|
||||||
gtk_box_pack_end (GTK_BOX (hbox),
|
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 4);
|
||||||
button, FALSE, FALSE, 4);
|
|
||||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (preferences)->action_area),
|
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (preferences)->action_area),
|
||||||
hbox, FALSE, FALSE, 0);
|
hbox, FALSE, FALSE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
|
|
||||||
#if HAVE_HILDON
|
#if HAVE_HILDON
|
||||||
#include <libosso.h>
|
#include <libosso.h>
|
||||||
|
#ifdef HAVE_HILDON_2_2
|
||||||
|
#include <dbus/dbus.h>
|
||||||
|
#include <mce/mode-names.h>
|
||||||
|
#include <mce/dbus-names.h>
|
||||||
|
#endif
|
||||||
typedef osso_context_t* MidoriAppInstance;
|
typedef osso_context_t* MidoriAppInstance;
|
||||||
#define MidoriAppInstanceNull NULL
|
#define MidoriAppInstanceNull NULL
|
||||||
#elif HAVE_UNIQUE
|
#elif HAVE_UNIQUE
|
||||||
|
@ -642,6 +647,12 @@ midori_app_create_instance (MidoriApp* app,
|
||||||
osso_deinitialize (instance);
|
osso_deinitialize (instance);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_HILDON_2_2
|
||||||
|
if (OSSO_OK == osso_rpc_run_system (instance, MCE_SERVICE, MCE_REQUEST_PATH,
|
||||||
|
MCE_REQUEST_IF, MCE_ACCELEROMETER_ENABLE_REQ, NULL, DBUS_TYPE_INVALID))
|
||||||
|
/* Accelerometer enabled */;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
GdkDisplay* display;
|
GdkDisplay* display;
|
||||||
gchar* display_name;
|
gchar* display_name;
|
||||||
|
|
|
@ -38,6 +38,16 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_HILDON_2_2
|
||||||
|
#include <dbus/dbus.h>
|
||||||
|
#include <mce/mode-names.h>
|
||||||
|
#include <mce/dbus-names.h>
|
||||||
|
#define MCE_SIGNAL_MATCH "type='signal'," \
|
||||||
|
"sender='" MCE_SERVICE "'," \
|
||||||
|
"path='" MCE_SIGNAL_PATH "'," \
|
||||||
|
"interface='" MCE_SIGNAL_IF "'"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct _MidoriBrowser
|
struct _MidoriBrowser
|
||||||
{
|
{
|
||||||
#if HAVE_HILDON
|
#if HAVE_HILDON
|
||||||
|
@ -3029,8 +3039,6 @@ _action_compact_menu_populate_popup (GtkAction* action,
|
||||||
{ "Open" },
|
{ "Open" },
|
||||||
#if HAVE_HILDON
|
#if HAVE_HILDON
|
||||||
{ "Find" },
|
{ "Find" },
|
||||||
{ "Homepage" },
|
|
||||||
{ "SourceView" },
|
|
||||||
#else
|
#else
|
||||||
{ "Print" },
|
{ "Print" },
|
||||||
{ "About" },
|
{ "About" },
|
||||||
|
@ -3057,12 +3065,7 @@ _action_compact_menu_populate_popup (GtkAction* action,
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (actions); i++)
|
for (i = 0; i < G_N_ELEMENTS (actions); i++)
|
||||||
{
|
{
|
||||||
#if HAVE_HILDON
|
#ifdef HAVE_HILDON_2_2
|
||||||
#if HILDON_CHECK_VERSION (2, 2, 0)
|
|
||||||
#define HAVE_APP_MENU 1
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_APP_MENU
|
|
||||||
GtkAction* _action;
|
GtkAction* _action;
|
||||||
gchar* label;
|
gchar* label;
|
||||||
GtkWidget* button;
|
GtkWidget* button;
|
||||||
|
@ -5474,6 +5477,58 @@ midori_browser_ui_manager_disconnect_proxy_cb (GtkUIManager* ui_manager,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_HILDON_2_2
|
||||||
|
static void
|
||||||
|
midori_browser_set_portrait_mode (MidoriBrowser* browser,
|
||||||
|
gboolean portrait)
|
||||||
|
{
|
||||||
|
if (portrait)
|
||||||
|
hildon_gtk_window_set_portrait_flags (GTK_WINDOW (browser),
|
||||||
|
HILDON_PORTRAIT_MODE_REQUEST);
|
||||||
|
else
|
||||||
|
hildon_gtk_window_set_portrait_flags (GTK_WINDOW (browser),
|
||||||
|
~HILDON_PORTRAIT_MODE_REQUEST);
|
||||||
|
_action_set_visible (browser, "Bookmarks", !portrait);
|
||||||
|
_action_set_visible (browser, "CompactAdd", !portrait);
|
||||||
|
_action_set_visible (browser, "Back", !portrait);
|
||||||
|
_action_set_visible (browser, "SourceView", !portrait);
|
||||||
|
_action_set_visible (browser, "Fullscreen", !portrait);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DBusHandlerResult
|
||||||
|
midori_browser_mce_filter_cb (DBusConnection* connection,
|
||||||
|
DBusMessage* message,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
if (dbus_message_is_signal (message, MCE_SIGNAL_IF, MCE_DEVICE_ORIENTATION_SIG))
|
||||||
|
{
|
||||||
|
DBusError error;
|
||||||
|
char *rotation, *stand, *face;
|
||||||
|
int x, y, z;
|
||||||
|
|
||||||
|
dbus_error_init (&error);
|
||||||
|
if (dbus_message_get_args (message,
|
||||||
|
&error,
|
||||||
|
DBUS_TYPE_STRING, &rotation,
|
||||||
|
DBUS_TYPE_STRING, &stand,
|
||||||
|
DBUS_TYPE_STRING, &face,
|
||||||
|
DBUS_TYPE_INT32, &x,
|
||||||
|
DBUS_TYPE_INT32, &y,
|
||||||
|
DBUS_TYPE_INT32, &z, DBUS_TYPE_INVALID))
|
||||||
|
{
|
||||||
|
gboolean portrait = !strcmp (rotation, MCE_ORIENTATION_PORTRAIT);
|
||||||
|
midori_browser_set_portrait_mode (MIDORI_BROWSER (data), portrait);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_warning ("%s: %s\n", error.name, error.message);
|
||||||
|
dbus_error_free (&error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_browser_init (MidoriBrowser* browser)
|
midori_browser_init (MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
|
@ -5792,6 +5847,18 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), browser->navigationbar, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), browser->navigationbar, FALSE, FALSE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_HILDON_2_2
|
||||||
|
DBusConnection* system_bus = dbus_bus_get (DBUS_BUS_SYSTEM, NULL);
|
||||||
|
if (system_bus)
|
||||||
|
{
|
||||||
|
dbus_bus_add_match (system_bus, MCE_SIGNAL_MATCH, NULL);
|
||||||
|
dbus_connection_add_filter (system_bus,
|
||||||
|
midori_browser_mce_filter_cb, browser, NULL);
|
||||||
|
hildon_gtk_window_set_portrait_flags (GTK_WINDOW (browser),
|
||||||
|
HILDON_PORTRAIT_MODE_SUPPORT);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Bookmarkbar */
|
/* Bookmarkbar */
|
||||||
browser->bookmarkbar = gtk_toolbar_new ();
|
browser->bookmarkbar = gtk_toolbar_new ();
|
||||||
gtk_widget_set_name (browser->bookmarkbar, "MidoriBookmarkbar");
|
gtk_widget_set_name (browser->bookmarkbar, "MidoriBookmarkbar");
|
||||||
|
|
|
@ -1977,12 +1977,14 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
|
||||||
gtk_menu_shell_append (menu_shell, menuitem);
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !HAVE_HILDON
|
||||||
menuitem = sokoke_action_create_popup_menu_item (
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
gtk_action_group_get_action (actions, "ZoomIn"));
|
gtk_action_group_get_action (actions, "ZoomIn"));
|
||||||
gtk_menu_shell_append (menu_shell, menuitem);
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
menuitem = sokoke_action_create_popup_menu_item (
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
gtk_action_group_get_action (actions, "ZoomOut"));
|
gtk_action_group_get_action (actions, "ZoomOut"));
|
||||||
gtk_menu_shell_append (menu_shell, menuitem);
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
|
#endif
|
||||||
|
|
||||||
menuitem = sokoke_action_create_popup_menu_item (
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
gtk_action_group_get_action (actions, "Encoding"));
|
gtk_action_group_get_action (actions, "Encoding"));
|
||||||
|
@ -2012,7 +2014,15 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !HAVE_HILDON
|
#if HAVE_HILDON
|
||||||
|
gtk_menu_shell_append (menu_shell, gtk_separator_menu_item_new ());
|
||||||
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
|
gtk_action_group_get_action (actions, "CompactAdd"));
|
||||||
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
|
gtk_action_group_get_action (actions, "Fullscreen"));
|
||||||
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
|
#else
|
||||||
gtk_menu_shell_append (menu_shell, gtk_separator_menu_item_new ());
|
gtk_menu_shell_append (menu_shell, gtk_separator_menu_item_new ());
|
||||||
menuitem = sokoke_action_create_popup_menu_item (
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
gtk_action_group_get_action (actions, "BookmarkAdd"));
|
gtk_action_group_get_action (actions, "BookmarkAdd"));
|
||||||
|
@ -2033,7 +2043,6 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
|
||||||
menuitem = sokoke_action_create_popup_menu_item (
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
gtk_action_group_get_action (actions, "SaveAs"));
|
gtk_action_group_get_action (actions, "SaveAs"));
|
||||||
gtk_menu_shell_append (menu_shell, menuitem);
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
#if !HAVE_HILDON
|
|
||||||
/* Currently views that don't support source, don't support
|
/* Currently views that don't support source, don't support
|
||||||
saving either. If that changes, we need to think of something. */
|
saving either. If that changes, we need to think of something. */
|
||||||
if (!midori_view_can_view_source (view))
|
if (!midori_view_can_view_source (view))
|
||||||
|
@ -2041,7 +2050,6 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view,
|
||||||
menuitem = sokoke_action_create_popup_menu_item (
|
menuitem = sokoke_action_create_popup_menu_item (
|
||||||
gtk_action_group_get_action (actions, "SourceView"));
|
gtk_action_group_get_action (actions, "SourceView"));
|
||||||
gtk_menu_shell_append (menu_shell, menuitem);
|
gtk_menu_shell_append (menu_shell, menuitem);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_show_all (menu);
|
gtk_widget_show_all (menu);
|
||||||
|
|
Loading…
Reference in a new issue