patches for origin/hildon-2-28 branch
- From: David Fries <david fries net>
- To: evince-list gnome org
- Subject: patches for origin/hildon-2-28 branch
- Date: Thu, 26 Aug 2010 21:13:18 -0500
I have a Nokia N900 and I needed to view PDF files, but the viewer
that came with it is a little lacking, but there is a version of
evince modified to better support the device. From what I can tell,
some of the changes have already made it into the origin/hildon-2-28
branch, but the rest haven't. I sorted through the changes and it's
patch one of five. The other four are my additions. I would
appreciate it if someone could add these to the master repository.
http://maemo.org/packages/view/evince/
>From 92ceee3448cf062b8c09ef4f69935946c60c5935 Mon Sep 17 00:00:00 2001
From: David Fries <david fries net>
Date: Wed, 25 Aug 2010 20:07:07 -0500
Subject: [PATCH 1/5] evince_2.28.2-1maemo2.diff.gz changes
These are the non-debian package manager files from
evince_2.28.2-1maemo2.diff.gz
http://repository.maemo.org/extras-devel/pool/fremantle/free/source/e/evince/
Built with the following configuration line and tested on the N900.
CFLAGS="-g -Wall -O2" CXXFLAGS="-g -Wall -O2" ../evince_git_orig/configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-maintainer-mode --disable-dependency-tracking --disable-scrollkeeper --disable-gtk-doc --enable-djvu --enable-dvi --enable-t1lib --enable-pixbuf --enable-comics --enable-impress --without-keyring --disable-nautilus --with-platform=hildon --enable-dbus --disable-thumbnailer --disable-previewer
---
cut-n-paste/toolbar-editor/Makefile.am | 4 -
cut-n-paste/zoom-control/ephy-zoom-control.c | 54 +++-
data/Makefile.am | 37 +--
data/evince-hildon-ui.xml | 103 ------
data/evince-ui.xml | 26 +-
data/evince.desktop.in.in | 14 +-
data/evince.service.in | 3 -
data/gtkrc-hildon | 27 --
help/Makefile.am | 2 +-
libmisc/ev-page-action-widget.c | 5 +
libmisc/ev-page-action.c | 9 +
libview/ev-stock-icons.c | 4 +
libview/ev-stock-icons.h | 4 +
libview/ev-view.c | 102 +++++-
libview/ev-view.h | 4 +
po/LINGUAS | 63 ----
properties/ev-properties-view.c | 23 ++-
shell/eggfindbar.c | 46 ++-
shell/ev-application.c | 243 ++++----------
shell/ev-application.h | 1 -
shell/ev-open-recent-action.c | 3 +
shell/ev-password-view.c | 45 +++-
shell/ev-properties-dialog.c | 102 ++++---
shell/ev-properties-fonts.c | 24 +-
shell/ev-utils.c | 54 +++
shell/ev-utils.h | 13 +
shell/ev-window.c | 444 +++++++++++++++++++-------
shell/ev-window.h | 19 +-
shell/main.c | 94 ++++--
29 files changed, 895 insertions(+), 677 deletions(-)
delete mode 100644 data/evince-hildon-ui.xml
delete mode 100644 data/evince.service.in
delete mode 100644 data/gtkrc-hildon
diff --git a/cut-n-paste/toolbar-editor/Makefile.am b/cut-n-paste/toolbar-editor/Makefile.am
index 96f3a9d..a5600f9 100644
--- a/cut-n-paste/toolbar-editor/Makefile.am
+++ b/cut-n-paste/toolbar-editor/Makefile.am
@@ -14,8 +14,6 @@ noinst_HEADERS = \
noinst_LTLIBRARIES = libtoolbareditor.la
-if !PLATFORM_HILDON
-
libtoolbareditor_la_SOURCES = \
$(BUILT_SOURCES) \
$(EGGSOURCES) \
@@ -31,8 +29,6 @@ libtoolbareditor_la_CFLAGS = \
-DCURSOR_DIR=\"$(pkgdatadir)\" \
$(AM_CFLAGS)
-endif # PLATFORM_HILDON
-
BUILT_SOURCES = \
eggmarshalers.c \
eggmarshalers.h \
diff --git a/cut-n-paste/zoom-control/ephy-zoom-control.c b/cut-n-paste/zoom-control/ephy-zoom-control.c
index 09a2be3..a917258 100644
--- a/cut-n-paste/zoom-control/ephy-zoom-control.c
+++ b/cut-n-paste/zoom-control/ephy-zoom-control.c
@@ -28,12 +28,21 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#ifdef PLATFORM_HILDON
+#include <hildon/hildon.h>
+#endif
+
#define EPHY_ZOOM_CONTROL_GET_PRIVATE(object)\
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ZOOM_CONTROL, EphyZoomControlPrivate))
struct _EphyZoomControlPrivate
{
+#ifndef PLATFORM_HILDON
GtkComboBox *combo;
+#else
+ GtkWidget *combo;
+ GtkWidget *selector;
+#endif
float zoom;
guint handler_id;
};
@@ -61,12 +70,20 @@ static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (EphyZoomControl, ephy_zoom_control, GTK_TYPE_TOOL_ITEM)
static void
+#ifndef PLATFORM_HILDON
combo_changed_cb (GtkComboBox *combo, EphyZoomControl *control)
+#else
+combo_changed_cb (HildonPickerButton *combo, EphyZoomControl *control)
+#endif
{
gint index;
float zoom;
+#ifndef PLATFORM_HILDON
index = gtk_combo_box_get_active (combo);
+#else
+ index = hildon_picker_button_get_active (combo);
+#endif
zoom = zoom_levels[index].level;
if (zoom != control->priv->zoom)
@@ -84,10 +101,15 @@ sync_zoom_cb (EphyZoomControl *control, GParamSpec *pspec, gpointer data)
index = ephy_zoom_get_zoom_level_index (p->zoom);
g_signal_handler_block (p->combo, p->handler_id);
+#ifdef PLATFORM_HILDON
+ hildon_picker_button_set_active (HILDON_PICKER_BUTTON (p->combo), index);
+#else
gtk_combo_box_set_active (p->combo, index);
+#endif
g_signal_handler_unblock (p->combo, p->handler_id);
}
+#ifndef PLATFORM_HILDON
static gboolean
row_is_separator (GtkTreeModel *model,
GtkTreeIter *iter,
@@ -97,6 +119,7 @@ row_is_separator (GtkTreeModel *model,
gtk_tree_model_get (model, iter, COL_IS_SEP, &is_sep, -1);
return is_sep;
}
+#endif
static void
ephy_zoom_control_finalize (GObject *o)
@@ -113,6 +136,9 @@ ephy_zoom_control_init (EphyZoomControl *control)
{
EphyZoomControlPrivate *p;
GtkWidget *vbox;
+#ifdef PLATFORM_HILDON
+ HildonTouchSelectorColumn *column;
+#endif
GtkCellRenderer *renderer;
GtkListStore *store;
GtkTreeIter iter;
@@ -140,23 +166,42 @@ ephy_zoom_control_init (EphyZoomControl *control)
}
}
+#ifdef PLATFORM_HILDON
+ p->combo = hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
+ hildon_button_set_title (HILDON_BUTTON (p->combo), NULL);
+ p->selector = hildon_touch_selector_new ();
+#else
p->combo = GTK_COMBO_BOX (gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)));
- g_object_unref (store);
+#endif
renderer = gtk_cell_renderer_text_new ();
+#ifdef PLATFORM_HILDON
+ g_object_set (G_OBJECT (renderer), "width", 1, "xalign", 0.5f, NULL);
+ column = hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (p->selector), GTK_TREE_MODEL (store), renderer, "text", COL_TEXT, NULL );
+ hildon_touch_selector_column_set_text_column (column, COL_TEXT);
+ hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (p->combo), HILDON_TOUCH_SELECTOR (p->selector));
+#else
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (p->combo), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (p->combo), renderer,
"text", COL_TEXT, NULL);
gtk_combo_box_set_row_separator_func (p->combo,
(GtkTreeViewRowSeparatorFunc) row_is_separator,
NULL, NULL);
+#endif
+ g_object_unref (store);
+#ifndef PLATFORM_HILDON
gtk_combo_box_set_focus_on_click (p->combo, FALSE);
+#endif
g_object_ref_sink (G_OBJECT (p->combo));
- gtk_widget_show (GTK_WIDGET (p->combo));
+ gtk_widget_show_all (GTK_WIDGET (p->combo));
i = ephy_zoom_get_zoom_level_index (p->zoom);
+#ifdef PLATFORM_HILDON
+ hildon_picker_button_set_active (HILDON_PICKER_BUTTON (p->combo), i);
+#else
gtk_combo_box_set_active (p->combo, i);
+#endif
vbox = gtk_vbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (p->combo), TRUE, FALSE, 0);
@@ -164,8 +209,13 @@ ephy_zoom_control_init (EphyZoomControl *control)
gtk_container_add (GTK_CONTAINER (control), vbox);
+#ifdef PLATFORM_HILDON
+ p->handler_id = g_signal_connect (G_OBJECT (p->combo), "value-changed",
+ G_CALLBACK (combo_changed_cb), control);
+#else
p->handler_id = g_signal_connect (p->combo, "changed",
G_CALLBACK (combo_changed_cb), control);
+#endif
g_signal_connect_object (control, "notify::zoom",
G_CALLBACK (sync_zoom_cb), NULL, 0);
diff --git a/data/Makefile.am b/data/Makefile.am
index 8ff55ab..6bf0ea6 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -16,27 +16,13 @@ man_MANS=evince.1
uidir = $(pkgdatadir)
ui_DATA = \
+ evince-ui.xml \
hand-open.png
-if !PLATFORM_HILDON
-ui_DATA += \
- evince-ui.xml \
- evince-toolbar.xml
-else
-ui_DATA += evince-hildon-ui.xml
-endif
-
if ENABLE_PREVIEWER
ui_DATA += evince-previewer-ui.xml
endif
-# GtkRC file
-
-if PLATFORM_HILDON
-rcdir = $(pkgdatadir)
-dist_rc_DATA = gtkrc-hildon
-endif
-
#
# Desktop file
#
@@ -46,7 +32,7 @@ endif
DESKTOP_IN_FILES= evince.desktop.in.in
DESKTOP_FILES= $(DESKTOP_IN_FILES:.desktop.in.in=.desktop)
-desktopdir = $(datadir)/applications
+desktopdir = $(datadir)/applications/hildon
desktop_DATA = $(DESKTOP_FILES)
@@ -112,22 +98,6 @@ update-icon-cache:
#
-# Hildon service file
-#
-
-ossoservice_in_files = evince.service.in
-
-if PLATFORM_HILDON
-
-servicedir = $(shell $(PKG_CONFIG) osso-af-settings --variable=dbusservicedir)
-service_DATA = $(ossoservice_in_files:.service.in=.service)
-
-%.service: %.service.in Makefile
- sed -e "s|%bindir%|$(bindir)|" $< > $@
-
-endif # PLATFORM_HILDON
-
-#
# Extra files to be included in the tarball
#
@@ -136,8 +106,7 @@ EXTRA_DIST = \
$(DESKTOP_IN_FILES) \
$(schema_in_files) \
$(man_MANS) \
- $(NULL) \
- $(ossoservice_in_files)
+ $(NULL)
#
# Clean up properly
diff --git a/data/evince-hildon-ui.xml b/data/evince-hildon-ui.xml
deleted file mode 100644
index 6b32bd0..0000000
--- a/data/evince-hildon-ui.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<ui>
- <popup name="MainMenu">
- <menu name="FileMenu" action="File">
- <menuitem name="FileOpenMenu" action="FileOpen"/>
- <menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
- <separator/>
- <menuitem name="FilePropertiesMenu" action="FileProperties"/>
- <separator/>
- <placeholder name="RecentFilesMenu"/>
- </menu>
-
- <menu name="EditMenu" action="Edit">
- <menuitem name="EditCopyMenu" action="EditCopy"/>
- <separator/>
- <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
- <separator/>
- <menuitem name="EditFindMenu" action="EditFind"/>
- <menuitem name="EditFindNextMenu" action="EditFindNext"/>
- <separator/>
- <menuitem name="EditRotateLeftMenu" action="EditRotateLeft"/>
- <menuitem name="EditRotateRigtMenu" action="EditRotateRight"/>
- </menu>
-
- <menu name="ViewMenu" action="View">
- <menuitem name="ViewToolbarMenu" action="ViewToolbar"/>
- <menuitem name="ViewSidebarMenu" action="ViewSidebar"/>
- <separator/>
- <menuitem name="ViewFullscreenMenu" action="ViewFullscreen"/>
- <menuitem name="ViewPresentationMenu" action="ViewPresentation"/>
- <separator/>
- <menuitem name="ViewContinuousMenu" action="ViewContinuous"/>
- <menuitem name="ViewDualMenu" action="ViewDual"/>
- <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/>
- <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/>
- <menuitem name="ViewZoomOutMenu" action="ViewZoomOut"/>
- <menuitem name="ViewBestFitMenu" action="ViewBestFit"/>
- <menuitem name="ViewPageWidthMenu" action="ViewPageWidth"/>
- <separator/>
- <menuitem name="ViewReload" action="ViewReload"/>
- </menu>
-
- <menu name="GoMenu" action="Go">
- <menuitem name="GoPreviousPageMenu" action="GoPreviousPage"/>
- <menuitem name="GoNextPageMenu" action="GoNextPage"/>
- <separator/>
- <menuitem name="GoFirstPageMenu" action="GoFirstPage"/>
- <menuitem name="GoLastPageMenu" action="GoLastPage"/>
- </menu>
-
- <menu name="HelpMenu" action="Help">
- <menuitem name="HelpAboutMenu" action="HelpAbout"/>
- </menu>
- <menuitem name="FileCloseWindowMenu" action="FileCloseWindow"/>
- </popup>
-
- <popup name="DocumentPopup" action="PopupAction">
- <menuitem name="OpenLink" action="OpenLink"/>
- <menuitem name="CopyLinkAddress" action="CopyLinkAddress"/>
- <menuitem name="GoLink" action="GoLink"/>
- <separator/>
- <menuitem name="GoPreviousPage" action="GoPreviousPage"/>
- <menuitem name="GoNextPage" action="GoNextPage"/>
- <menuitem name="ViewReload" action="ViewReload"/>
- <separator/>
- <menuitem name="EditCopy" action="EditCopy"/>
- <menuitem name="EditSelectAllPopup" action="EditSelectAll"/>
- </popup>
-
- <toolbar name="DefaultToolBar">
- <toolitem action="FileOpen"/>
- <separator/>
- <toolitem action="GoFirstPage"/>
- <toolitem action="GoPreviousPage"/>
- <toolitem action="PageSelector"/>
- <toolitem action="GoNextPage"/>
- <toolitem action="GoLastPage"/>
- <separator/>
- <toolitem action="ViewZoom"/>
- </toolbar>
-
- <accelerator name="PageDownAccel" action="PageDown"/>
- <accelerator name="PageUpAccel" action="PageUp"/>
- <accelerator name="GoBackwardFastAccel" action="GoBackwardFast"/>
- <accelerator name="GoForwardFastAccel" action="GoForwardFast"/>
- <accelerator name="EscapeAccel" action="Escape"/>
- <accelerator name="SlashAccel" action="Slash"/>
- <accelerator name="SpaceAccel" action="Space"/>
- <accelerator name="ReturnAccel" action="Return"/>
- <accelerator name="BackSpaceAccel" action="BackSpace"/>
- <accelerator name="ShiftSpaceAccel" action="ShiftSpace"/>
- <accelerator name="ShiftBackSpaceAccel" action="ShiftBackSpace"/>
- <accelerator name="ShiftReturnAccel" action="ShiftReturn"/>
- <accelerator name="FocusPageSelectorAccel" action="FocusPageSelector"/>
- <accelerator name="PlusAccel" action="Plus"/>
- <accelerator name="MinusAccel" action="Minus"/>
- <accelerator name="Equal" action="Equal"/>
- <accelerator name="CtrlEqualAccel" action="CtrlEqual"/>
- <accelerator name="KpPlusAccel" action="KpPlus"/>
- <accelerator name="KpMinusAccel" action="KpMinus"/>
- <accelerator name="CtrlKpPlusAccel" action="CtrlKpPlus"/>
- <accelerator name="CtrlKpMinusAccel" action="CtrlKpMinus"/>
-
-</ui>
diff --git a/data/evince-ui.xml b/data/evince-ui.xml
index 7ac4edb..6e3f695 100644
--- a/data/evince-ui.xml
+++ b/data/evince-ui.xml
@@ -26,8 +26,6 @@
<separator/>
<menuitem name="EditRotateLeftMenu" action="EditRotateLeft"/>
<menuitem name="EditRotateRigtMenu" action="EditRotateRight"/>
- <separator/>
- <menuitem name="EditToolbarMenu" action="EditToolbar"/>
</menu>
<menu name="ViewMenu" action="View">
@@ -56,7 +54,6 @@
</menu>
<menu name="HelpMenu" action="Help">
- <menuitem name="HelpContentsMenu" action="HelpContents"/>
<menuitem name="HelpAboutMenu" action="HelpAbout"/>
</menu>
</menubar>
@@ -85,10 +82,6 @@
<menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
</popup>
- <popup name="ToolbarPopup" action="ToolbarPopupAction">
- <menuitem name="EditToolbarMenu" action="EditToolbar"/>
- </popup>
-
<accelerator name="PageDownAccel" action="PageDown"/>
<accelerator name="PageUpAccel" action="PageUp"/>
<accelerator name="GoBackwardFastAccel" action="GoBackwardFast"/>
@@ -98,10 +91,7 @@
<accelerator name="F3Accel" action="F3"/>
<accelerator name="SpaceAccel" action="Space"/>
<accelerator name="ReturnAccel" action="Return"/>
- <accelerator name="BackSpaceAccel" action="BackSpace"/>
<accelerator name="ShiftSpaceAccel" action="ShiftSpace"/>
- <accelerator name="ShiftBackSpaceAccel" action="ShiftBackSpace"/>
- <accelerator name="ShiftReturnAccel" action="ShiftReturn"/>
<accelerator name="FocusPageSelectorAccel" action="FocusPageSelector"/>
<accelerator name="PlusAccel" action="Plus"/>
<accelerator name="MinusAccel" action="Minus"/>
@@ -115,13 +105,23 @@
<toolbar name="FullscreenToolbar">
<toolitem name="GoPreviousPage" action="GoPreviousPage"/>
- <toolitem name="GoNextPage" action="GoNextPage"/>
- <separator/>
<toolitem name="PageSelector" action="PageSelector"/>
- <separator/>
+ <toolitem name="GoNextPage" action="GoNextPage"/>
+ <separator expand="true"/>
<toolitem name="ViewZoom" action="ViewZoom"/>
<separator expand="true"/>
<toolitem name="StartPresentation" action="StartPresentation"/>
<toolitem name="LeaveFullscreen" action="LeaveFullscreen"/>
</toolbar>
+
+ <toolbar name="DefaultToolBar">
+ <toolitem action="FileOpenRecent"/>
+ <toolitem action="GoPreviousPage"/>
+ <toolitem action="PageSelector"/>
+ <toolitem action="GoNextPage"/>
+ <toolitem action="ViewZoom"/>
+ <separator expand="true"/>
+ <toolitem action="ViewFullscreen"/>
+ </toolbar>
+
</ui>
diff --git a/data/evince.desktop.in.in b/data/evince.desktop.in.in
index 91ab97f..84c6838 100644
--- a/data/evince.desktop.in.in
+++ b/data/evince.desktop.in.in
@@ -1,18 +1,12 @@
[Desktop Entry]
-_Name=Document Viewer
+Name=Evince
_GenericName=Document Viewer
_Comment=View multipage documents
-TryExec=evince
-Exec=evince %U
+Exec=evince
StartupNotify=true
Terminal=false
Type=Application
Icon=evince
-NoDisplay=true
-X-GNOME-DocPath=
-X-GNOME-Bugzilla-Bugzilla=GNOME
-X-GNOME-Bugzilla-Product=evince
-X-GNOME-Bugzilla-Component=BugBuddyBugs
-X-GNOME-Bugzilla-Version= VERSION@
-Categories=GNOME;GTK;Graphics;VectorGraphics;Viewer;
+X-Osso-Service=org.gnome.evince.ApplicationService
+X-Osso-Type=application/x-executable
MimeType= EVINCE_MIME_TYPES@
diff --git a/data/evince.service.in b/data/evince.service.in
deleted file mode 100644
index 0f4fb60..0000000
--- a/data/evince.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=org.gnome.Evince
-Exec=%bindir%/evince
diff --git a/data/gtkrc-hildon b/data/gtkrc-hildon
deleted file mode 100644
index 280ca5d..0000000
--- a/data/gtkrc-hildon
+++ /dev/null
@@ -1,27 +0,0 @@
-# Re-define the icons used in the toolbar
-# These icons a) look nicer, and b) are available in the required
-# sizes, so that the toolbar icons aren't blurry (cf. bug #584669).
-
-style "evince-icons" {
- stock["gtk-open"] = { { @"general_folder" } }
-
- stock["gtk-close"] = { { @"general_close" } }
- stock["close"] = { { @"general_close" } }
-
- stock["gtk-goto-top"] = { { @"pdf_viewer_first_page", LTR }, { @"pdf_viewer_last_page", RTL } }
- stock["gtk-goto-bottom"] = { { @"pdf_viewer_last_page", LTR }, { @"pdf_viewer_first_page", RTL } }
-
- stock["gtk-go-back"] = { { @"general_back", LTR }, { @"general_forward", RTL } }
- stock["gtk-go-forward"] = { { @"general_forward", LTR }, { @"general_back", RTL } }
-
- stock["gtk-go-up"] = { { @"general_back", LTR }, { @"general_forward", RTL } }
- stock["gtk-go-down"] = { { @"general_forward", LTR }, { @"general_back", RTL } }
-
- stock["gtk-undo"] = { { @"general_undo", LTR }, { @"general_redo", RTL } }
- stock["gtk-redo"] = { { @"general_redo", LTR }, { @"general_undo", RTL } }
-
- stock["gtk-fullscreen"] = { { @"general_fullsize" } }
- stock["gtk-leave-fullscreen"] = { { @"general_fullsize" } }
-}
-
-class "GtkWidget" style "evince-icons"
diff --git a/help/Makefile.am b/help/Makefile.am
index d51479c..7e47878 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -8,4 +8,4 @@ DOC_ENTITIES = legal.xml
DOC_INCLUDES =
DOC_FIGURES = figures/evince_start_window.png
-DOC_LINGUAS = bg ca cs de el en_GB es eu fi fr it ja nl oc pt_BR ru sr sv uk vi zh_CN
+DOC_LINGUAS = cs de en_GB es fi fr it nl pt_BR ru sv
diff --git a/libmisc/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c
index 28b6759..50f2ce7 100644
--- a/libmisc/ev-page-action-widget.c
+++ b/libmisc/ev-page-action-widget.c
@@ -270,6 +270,11 @@ ev_page_action_widget_update_model (EvPageActionWidget *proxy, GtkTreeModel *mod
GtkEntryCompletion *completion;
GtkCellRenderer *renderer;
+#if 0
+#ifdef PLATFORM_HILDON
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (proxy->entry), HILDON_GTK_INPUT_MODE_FULL);
+#endif
+#endif
proxy->model = model;
filter_model = get_filter_model_from_model (model);
diff --git a/libmisc/ev-page-action.c b/libmisc/ev-page-action.c
index f2a1536..f3e9568 100644
--- a/libmisc/ev-page-action.c
+++ b/libmisc/ev-page-action.c
@@ -28,6 +28,10 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#ifdef PLATFORM_HILDON
+#include <hildon/hildon.h>
+#endif
+
#include "ev-page-action.h"
#include "ev-page-action-widget.h"
@@ -168,7 +172,12 @@ create_tool_item (GtkAction *action)
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_set_spacing (GTK_BOX (hbox), 6);
+#ifdef PLATFORM_HILDON
+ proxy->entry = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
+ /* hildon_gtk_entry_set_input_mode (GTK_ENTRY (proxy->entry), HILDON_GTK_INPUT_MODE_NUMERIC); */
+#else
proxy->entry = gtk_entry_new ();
+#endif
obj = gtk_widget_get_accessible (proxy->entry);
atk_object_set_name (obj, "page-label-entry");
diff --git a/libview/ev-stock-icons.c b/libview/ev-stock-icons.c
index d450462..9deb10f 100644
--- a/libview/ev-stock-icons.c
+++ b/libview/ev-stock-icons.c
@@ -41,7 +41,11 @@ static const EvStockIcon stock_icons [] = {
{ EV_STOCK_VIEW_CONTINUOUS, "view-page-continuous" },
{ EV_STOCK_ROTATE_LEFT, "object-rotate-left"},
{ EV_STOCK_ROTATE_RIGHT, "object-rotate-right"},
+#ifndef PLATFORM_HILDON
{ EV_STOCK_RUN_PRESENTATION, "x-office-presentation"},
+#else
+ { EV_STOCK_RUN_PRESENTATION, "general_certificate"},
+#endif
{ EV_STOCK_VISIBLE, "eye"},
{ EV_STOCK_RESIZE_SE, "resize-se"},
{ EV_STOCK_RESIZE_SW, "resize-sw"},
diff --git a/libview/ev-stock-icons.h b/libview/ev-stock-icons.h
index 4cad90e..fb28f87 100644
--- a/libview/ev-stock-icons.h
+++ b/libview/ev-stock-icons.h
@@ -40,7 +40,11 @@ G_BEGIN_DECLS
#define EV_STOCK_VIEW_CONTINUOUS "view-page-continuous"
#define EV_STOCK_ROTATE_LEFT "object-rotate-left"
#define EV_STOCK_ROTATE_RIGHT "object-rotate-right"
+#ifndef PLATFORM_HILDON
#define EV_STOCK_RUN_PRESENTATION "x-office-presentation"
+#else
+#define EV_STOCK_RUN_PRESENTATION "general_certificate"
+#endif
#define EV_STOCK_VISIBLE "eye"
#define EV_STOCK_RESIZE_SE "resize-se"
#define EV_STOCK_RESIZE_SW "resize-sw"
diff --git a/libview/ev-view.c b/libview/ev-view.c
index e41e35f..70b7f5b 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -91,6 +91,14 @@ typedef enum {
#define SCROLL_TIME 150
+#ifdef PLATFORM_HILDON
+static guint SCROLL_BUTTON = 1;
+static guint SELECT_BUTTON = 2;
+#else
+static guint SCROLL_BUTTON = 2;
+static guint SELECT_BUTTON = 1;
+#endif
+
/*** Scrolling ***/
static void scroll_to_current_page (EvView *view,
GtkOrientation orientation);
@@ -323,6 +331,23 @@ static void ev_view_presentation_transition_stop (EvView
G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_LAYOUT)
+#ifdef PLATFORM_HILDON
+void
+ev_view_toggle_edit_mode (void)
+{
+ if (get_edit_mode ())
+ {
+ SCROLL_BUTTON = 2;
+ SELECT_BUTTON = 1;
+ }
+ else
+ {
+ SCROLL_BUTTON = 1;
+ SELECT_BUTTON = 2;
+ }
+}
+#endif
+
static void
scroll_to_current_page (EvView *view, GtkOrientation orientation)
{
@@ -2874,6 +2899,10 @@ ev_view_expose_event (GtkWidget *widget,
cr = gdk_cairo_create (view->layout.bin_window);
+#ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))), 0);
+#endif
+
for (i = view->start_page; i <= view->end_page; i++) {
GdkRectangle page_area;
GtkBorder border;
@@ -3077,8 +3106,8 @@ ev_view_button_press_event (GtkWidget *widget,
if (view->scroll_info.autoscrolling)
return TRUE;
- switch (event->button) {
- case 1: {
+ if (event->button == SELECT_BUTTON)
+ {
EvImage *image;
EvAnnotation *annot;
EvFormField *field;
@@ -3115,9 +3144,10 @@ ev_view_button_press_event (GtkWidget *widget,
if (EV_IS_SELECTION (view->document))
start_selection_for_event (view, event);
}
- }
return TRUE;
- case 2:
+ }
+ else if (event->button == SCROLL_BUTTON)
+ {
/* use root coordinates as reference point because
* scrolling changes window relative coordinates */
view->drag_info.start.x = event->x_root;
@@ -3128,7 +3158,9 @@ ev_view_button_press_event (GtkWidget *widget,
ev_view_set_cursor (view, EV_VIEW_CURSOR_DRAG);
return TRUE;
- case 3:
+ }
+ else if (event->button == 3)
+ {
view->scroll_info.start_y = event->y;
return ev_view_do_popup_menu (view, event->x, event->y);
}
@@ -3395,8 +3427,8 @@ ev_view_motion_notify_event (GtkWidget *widget,
}
}
- switch (view->pressed_button) {
- case 1:
+ if (view->pressed_button == SELECT_BUTTON)
+ {
/* For the Evince 0.4.x release, we limit selection to un-rotated
* documents only.
*/
@@ -3425,7 +3457,9 @@ ev_view_motion_notify_event (GtkWidget *widget,
view->selection_update_id = g_idle_add ((GSourceFunc)selection_update_idle_cb, view);
return TRUE;
- case 2:
+ }
+ else if (view->pressed_button == SCROLL_BUTTON)
+ {
if (!view->drag_info.in_drag) {
gboolean start;
int i;
@@ -3475,9 +3509,8 @@ ev_view_motion_notify_event (GtkWidget *widget,
return TRUE;
}
-
- break;
- default:
+ }
+ else {
ev_view_handle_cursor_over_xy (view, x, y);
}
@@ -3510,9 +3543,12 @@ ev_view_button_release_event (GtkWidget *widget,
link = ev_view_get_link_at_location (view, event->x, event->y);
}
+#ifdef PLATFORM_HILDON
+ gboolean was_in_drag = view->drag_info.in_drag;
+#endif
view->drag_info.in_drag = FALSE;
- if (view->pressed_button == 2) {
+ if (view->pressed_button == SCROLL_BUTTON) {
ev_view_handle_cursor_over_xy (view, event->x, event->y);
}
@@ -3538,7 +3574,7 @@ ev_view_button_release_event (GtkWidget *widget,
view->selection_info.in_drag = FALSE;
} else if (link) {
- if (event->button == 2) {
+ if (event->button == SCROLL_BUTTON) {
EvLinkAction *action;
EvLinkActionType type;
@@ -3564,6 +3600,39 @@ ev_view_button_release_event (GtkWidget *widget,
ev_view_previous_page (view);
return TRUE;
}
+#ifdef PLATFORM_HILDON
+ } if (view->fullscreen && (get_special_mode() == FALSE) && (!get_edit_mode())) {
+ if (event->button == SCROLL_BUTTON && !was_in_drag) {
+ gint gutter_size = 120;
+ gint w, h;
+ gint x = (gint) event->x;
+ gint y = (gint) event->y;
+ gdk_drawable_get_size(event->window, &w, &h);
+ /*g_printf ("click (%d,%d) - ", x, y);
+ g_printf ("size (%d,%d) - ", w, h);*/
+ if (x > gutter_size && x < w - gutter_size) {
+ if (y > (h - gutter_size)) {
+ /*g_print ("down\n");*/
+ ev_view_scroll (view, GTK_SCROLL_PAGE_FORWARD, FALSE);
+ return TRUE;
+ } else if (y < gutter_size) {
+ /*g_print ("up\n");*/
+ ev_view_scroll (view, GTK_SCROLL_PAGE_BACKWARD, FALSE);
+ return TRUE;
+ }
+ } else if (y > gutter_size && y < h - gutter_size) {
+ if (x > (w - gutter_size)) {
+ /*g_print ("next\n");*/
+ ev_view_next_page (view);
+ return TRUE;
+ } else if (x < gutter_size) {
+ /*g_print ("prev\n");*/
+ ev_view_previous_page (view);
+ return TRUE;
+ }
+ }
+ }
+#endif
}
return FALSE;
@@ -4004,6 +4073,9 @@ draw_loading_text (EvView *view,
gint width, height;
if (!view->loading_text) {
+ #ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))), 1);
+ #endif
const gchar *loading_text = _("Loading...");
PangoLayout *layout;
PangoFontDescription *font_desc;
@@ -4083,6 +4155,10 @@ draw_one_page (EvView *view,
real_page_area.height -= (border->top + border->bottom);
*page_ready = TRUE;
+#ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))), 0);
+#endif
+
if (!view->presentation) {
gint current_page;
diff --git a/libview/ev-view.h b/libview/ev-view.h
index 2ff3aef..7440754 100644
--- a/libview/ev-view.h
+++ b/libview/ev-view.h
@@ -136,6 +136,10 @@ gchar* ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest);
void ev_view_autoscroll_start (EvView *view);
void ev_view_autoscroll_stop (EvView *view);
+#ifdef PLATFORM_HILDON
+void ev_view_toggle_edit_mode (void);
+#endif
+
G_END_DECLS
#endif /* __EV_VIEW_H__ */
diff --git a/po/LINGUAS b/po/LINGUAS
index ebd41f8..2c53192 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -1,80 +1,17 @@
# please keep this list sorted alphabetically
-af
-ar
-as
-ast
-be
-be latin
-bg
-bn
-bn_IN
-br
-ca
-ca valencia
cs
-cy
da
de
-dz
-el
-en_CA
en_GB
es
-et
-eu
-fa
fi
fr
-ga
-gl
-gu
-he
-hi
-hu
-id
it
-ja
-ka
-kn
-ko
-ks
-ku
-lt
-lv
-mai
-mg
-mk
-ml
-mr
-nb
-nds
-ne
nl
-nn
-oc
-or
-pa
pl
-ps
pt
-pt_BR
-ro
ru
-rw
-si
-sk
-sl
-sq
-sr
-sr latin
sv
-ta
-te
-th
-tr
-uk
-vi
-wa
zh_CN
zh_HK
zh_TW
diff --git a/properties/ev-properties-view.c b/properties/ev-properties-view.c
index 9a9d13c..5e0f459 100644
--- a/properties/ev-properties-view.c
+++ b/properties/ev-properties-view.c
@@ -33,6 +33,10 @@
#include "ev-properties-view.h"
+#ifdef PLATFORM_HILDON
+#include "../shell/ev-utils.h"
+#endif
+
typedef enum {
TITLE_PROPERTY,
URI_PROPERTY,
@@ -382,13 +386,30 @@ ev_properties_view_set_info (EvPropertiesView *properties, const EvDocumentInfo
static void
ev_properties_view_init (EvPropertiesView *properties)
{
+#ifdef PLATFORM_HILDON
+ GtkWidget *swindow;
+#endif
+
+#ifdef PLATFORM_HILDON
+ swindow = hildon_pannable_area_new ();
+ g_object_set (G_OBJECT (swindow), "vovershoot-max", 0, NULL);
+#endif
+
properties->table = gtk_table_new (13, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (properties->table), 12);
gtk_table_set_row_spacings (GTK_TABLE (properties->table), 6);
gtk_container_set_border_width (GTK_CONTAINER (properties->table), 12);
+
+#ifdef PLATFORM_HILDON
+ gtk_box_pack_start (GTK_BOX (properties), swindow,
+ TRUE, TRUE, 0);
+ hildon_pannable_area_set_size_request_children (swindow);
+ hildon_pannable_area_add_with_viewport (swindow, properties->table);
+#else
gtk_box_pack_start (GTK_BOX (properties), properties->table,
TRUE, TRUE, 0);
- gtk_widget_show (properties->table);
+#endif
+ gtk_widget_show_all (GTK_WIDGET (properties));
}
void
diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c
index dcbe5bb..e9d5cfa 100644
--- a/shell/eggfindbar.c
+++ b/shell/eggfindbar.c
@@ -24,6 +24,10 @@ Boston, MA 02111-1307, USA.
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#ifdef PLATFORM_HILDON
+#include <hildon/hildon.h>
+#endif
+
#include "eggfindbar.h"
struct _EggFindBarPrivate
@@ -39,7 +43,9 @@ struct _EggFindBarPrivate
GtkWidget *find_entry;
GtkWidget *status_label;
+#ifndef PLATFORM_HILDON
gulong set_focus_handler;
+#endif
guint case_sensitive : 1;
};
@@ -271,6 +277,7 @@ entry_changed_callback (GtkEntry *entry,
g_free (text);
}
+#ifndef PLATFORM_HILDON
static void
set_focus_cb (GtkWidget *window,
GtkWidget *widget,
@@ -291,18 +298,19 @@ set_focus_cb (GtkWidget *window,
g_signal_emit (bar, find_bar_signals[CLOSE], 0);
}
}
+#endif
static void
egg_find_bar_init (EggFindBar *find_bar)
{
EggFindBarPrivate *priv;
+#ifndef PLATFORM_HILDON
GtkWidget *label;
+#endif
GtkWidget *alignment;
GtkWidget *box;
GtkToolItem *item;
-#ifndef PLATFORM_HILDON
GtkWidget *arrow;
-#endif
/* Data */
priv = EGG_FIND_BAR_GET_PRIVATE (find_bar);
@@ -310,11 +318,7 @@ egg_find_bar_init (EggFindBar *find_bar)
find_bar->priv = priv;
priv->search_string = NULL;
-#ifdef PLATFORM_HILDON
- gtk_toolbar_set_style (GTK_TOOLBAR (find_bar), GTK_TOOLBAR_ICONS);
-#else
gtk_toolbar_set_style (GTK_TOOLBAR (find_bar), GTK_TOOLBAR_BOTH_HORIZ);
-#endif
/* Find: |_____| */
item = gtk_tool_item_new ();
@@ -323,39 +327,49 @@ egg_find_bar_init (EggFindBar *find_bar)
alignment = gtk_alignment_new (0.0, 0.5, 1.0, 0.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 2, 2);
+#ifndef PLATFORM_HILDON
label = gtk_label_new_with_mnemonic (_("Find:"));
+#endif
- priv->find_entry = gtk_entry_new ();
+ priv->find_entry = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
gtk_entry_set_width_chars (GTK_ENTRY (priv->find_entry), 32);
gtk_entry_set_max_length (GTK_ENTRY (priv->find_entry), 512);
+#ifndef PLATFORM_HILDON
gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->find_entry);
+#endif
/* Prev */
+ arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE);
#ifdef PLATFORM_HILDON
- priv->previous_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
+ priv->previous_button = gtk_tool_button_new (arrow, NULL);
#else
- arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE);
priv->previous_button = gtk_tool_button_new (arrow, Q_("Find Pre_vious"));
#endif
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (priv->previous_button), TRUE);
+#ifndef PLATFORM_HILDON
gtk_tool_item_set_is_important (priv->previous_button, TRUE);
+#endif
gtk_widget_set_tooltip_text (GTK_WIDGET (priv->previous_button),
_("Find previous occurrence of the search string"));
/* Next */
+ arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
#ifdef PLATFORM_HILDON
- priv->next_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
+ priv->next_button = gtk_tool_button_new (arrow, NULL);
#else
- arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
priv->next_button = gtk_tool_button_new (arrow, Q_("Find Ne_xt"));
#endif
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (priv->next_button), TRUE);
+#ifndef PLATFORM_HILDON
gtk_tool_item_set_is_important (priv->next_button, TRUE);
+#endif
gtk_widget_set_tooltip_text (GTK_WIDGET (priv->next_button),
_("Find next occurrence of the search string"));
+#ifndef PLATFORM_HILDON
/* Separator*/
priv->status_separator = gtk_separator_tool_item_new();
+#endif
/* Case button */
priv->case_button = gtk_toggle_tool_button_new ();
@@ -389,7 +403,9 @@ egg_find_bar_init (EggFindBar *find_bar)
G_CALLBACK (case_sensitive_toggled_callback),
find_bar);
+#ifndef PLATFORM_HILDON
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
+#endif
gtk_box_pack_start (GTK_BOX (box), priv->find_entry, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (alignment), box);
gtk_container_add (GTK_CONTAINER (item), alignment);
@@ -397,7 +413,9 @@ egg_find_bar_init (EggFindBar *find_bar)
gtk_toolbar_insert (GTK_TOOLBAR (find_bar), priv->previous_button, -1);
gtk_toolbar_insert (GTK_TOOLBAR (find_bar), priv->next_button, -1);
gtk_toolbar_insert (GTK_TOOLBAR (find_bar), priv->case_button, -1);
+#ifndef PLATFORM_HILDON
gtk_toolbar_insert (GTK_TOOLBAR (find_bar), priv->status_separator, -1);
+#endif
gtk_container_add (GTK_CONTAINER (priv->status_item), priv->status_label);
gtk_toolbar_insert (GTK_TOOLBAR (find_bar), priv->status_item, -1);
@@ -468,11 +486,14 @@ egg_find_bar_get_property (GObject *object,
static void
egg_find_bar_show (GtkWidget *widget)
{
+#ifndef PLATFORM_HILDON
EggFindBar *bar = EGG_FIND_BAR (widget);
EggFindBarPrivate *priv = bar->priv;
+#endif
GTK_WIDGET_CLASS (egg_find_bar_parent_class)->show (widget);
+#ifndef PLATFORM_HILDON
if (priv->set_focus_handler == 0)
{
GtkWidget *toplevel;
@@ -483,11 +504,13 @@ egg_find_bar_show (GtkWidget *widget)
g_signal_connect (toplevel, "set-focus",
G_CALLBACK (set_focus_cb), bar);
}
+#endif
}
static void
egg_find_bar_hide (GtkWidget *widget)
{
+#ifndef PLATFORM_HILDON
EggFindBar *bar = EGG_FIND_BAR (widget);
EggFindBarPrivate *priv = bar->priv;
@@ -501,6 +524,7 @@ egg_find_bar_hide (GtkWidget *widget)
(toplevel, (void (*)) G_CALLBACK (set_focus_cb), bar);
priv->set_focus_handler = 0;
}
+#endif
GTK_WIDGET_CLASS (egg_find_bar_parent_class)->hide (widget);
}
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 951970f..dd0cf94 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -46,9 +46,11 @@
#include "ev-utils.h"
#include "ev-stock-icons.h"
+#ifndef PLATFORM_HILDON
#ifdef ENABLE_DBUS
#include "ev-media-player-keys.h"
#endif /* ENABLE_DBUS */
+#endif /* PLATFORM_HILDON */
#ifdef ENABLE_DBUS
#include <dbus/dbus-glib-bindings.h>
@@ -56,9 +58,10 @@
#endif
#ifdef PLATFORM_HILDON
+#include <hildon/hildon.h>
#include <libosso.h>
-#include <hildon/hildon-program.h>
-#endif /* PLATFORM_HILDON */
+osso_context_t *osso_context = NULL;
+#endif
static void ev_application_save_print_settings (EvApplication *application);
@@ -68,6 +71,9 @@ struct _EvApplication {
gchar *dot_dir;
gchar *data_dir;
gchar *accel_map_file;
+#ifndef PLATFORM_HILDON
+ gchar *toolbars_file;
+#endif
#ifdef ENABLE_DBUS
gchar *crashed_file;
@@ -76,10 +82,12 @@ struct _EvApplication {
#ifndef PLATFORM_HILDON
EggToolbarsModel *toolbars_model;
- gchar *toolbars_file;
-#endif
TotemScrsaver *scr_saver;
+#else
+ guint display_keepalive_timeout;
+ HildonProgram *hildon_program;
+#endif
#ifdef WITH_SMCLIENT
EggSMClient *smclient;
@@ -88,18 +96,15 @@ struct _EvApplication {
gchar *filechooser_open_uri;
gchar *filechooser_save_uri;
+#ifndef PLATFORM_HILDON
#ifdef ENABLE_DBUS
EvMediaPlayerKeys *keys;
#endif /* ENABLE_DBUS */
+#endif /* PLATFORM_HILDON */
GtkPrintSettings *print_settings;
GtkPageSetup *page_setup;
GKeyFile *print_settings_file;
-
-#ifdef PLATFORM_HILDON
- osso_context_t *osso_context;
- HildonProgram *program;
-#endif
};
struct _EvApplicationClass {
@@ -163,7 +168,9 @@ ev_application_register_service (EvApplication *application)
"/org/gnome/evince/Evince",
G_OBJECT (application));
+ #ifndef PLATFORM_HILDON
application->scr_saver = totem_scrsaver_new (connection);
+ #endif
ev_metadata_manager_init ();
@@ -171,71 +178,6 @@ ev_application_register_service (EvApplication *application)
}
#endif /* ENABLE_DBUS */
-#ifdef PLATFORM_HILDON
-
-static void
-osso_hw_event_cb (osso_hw_state_t *state,
- gpointer user_data)
-{
- EvApplication *ev_application = EV_APPLICATION (user_data);
-
- /* This callback can be called immediately upon registration.
- * So check if we're started up yet.
- */
- if (ev_application->program == NULL)
- return;
-
-#if GNOME_ENABLE_DEBUG
- if (state->shutdown_ind) {
- g_print ("Going to shut down\n");
- } else if (state->save_unsaved_data_ind) {
- g_print ("Should save unsaved data\n");
- } else if (state->memory_low_ind) {
- g_print ("Should try to free some memory\n");
- } else if (state->system_inactivity_ind) {
- g_print ("System inactive\n");
- }
-#endif /* GNOME_ENABLE_DEBUG */
-}
-
-static int
-osso_rpc_cb (const char *interface,
- const char *method,
- GArray *args,
- gpointer user_data,
- osso_rpc_t *ret)
-{
-// EvApplication *ev_application = EV_APPLICATION (user_data);
-
-#if GNOME_ENABLE_DEBUG
- g_print ("OSSO RPC iface %s method %s\n", interface, method);
-#endif /* GNOME_ENABLE_DEBUG */
-
- if (strcmp (method, "top_application") == 0) {
- /* FIXME: present the window */
- /* gtk_window_present (GTK_WINDOW (window)); */
- }
-
- ret->type = DBUS_TYPE_INVALID;
- return OSSO_OK;
-}
-
-static void
-sync_is_topmost_cb (HildonProgram *program,
- GParamSpec *pspec,
- EvApplication *application)
-{
- if (hildon_program_get_is_topmost (program)) {
- hildon_program_set_can_hibernate (program, FALSE);
- } else {
- /* FIXMEchpe: save state here */
-
- hildon_program_set_can_hibernate (program, TRUE);
- }
-}
-
-#endif /* PLATFORM_HILDON */
-
/**
* ev_application_get_instance:
*
@@ -719,13 +661,14 @@ ev_application_open_window (EvApplication *application,
application);
#endif
- if (!GTK_WIDGET_REALIZED (new_window))
+ if (!GTK_WIDGET_REALIZED (new_window)) {
gtk_widget_realize (new_window);
-
-#ifdef PLATFORM_HILDON
- hildon_program_add_window (EV_APP->program, HILDON_WINDOW (new_window));
-#endif
-
+ #ifdef PLATFORM_HILDON
+ steal_zoom_keys (new_window);
+ hildon_program_add_window (application->hildon_program, HILDON_WINDOW (new_window));
+ #endif
+ }
+
#ifdef GDK_WINDOWING_X11
if (timestamp <= 0)
timestamp = gdk_x11_get_server_time (GTK_WIDGET (new_window)->window);
@@ -858,8 +801,13 @@ ev_application_open_uri_at_dest (EvApplication *application,
application);
#endif
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (new_window)))
+ if (!GTK_WIDGET_REALIZED (GTK_WIDGET (new_window))) {
gtk_widget_realize (GTK_WIDGET (new_window));
+ #ifdef PLATFORM_HILDON
+ steal_zoom_keys (GTK_WIDGET (new_window));
+ hildon_program_add_window (application->hildon_program, HILDON_WINDOW (new_window));
+ #endif
+ }
#ifdef GDK_WINDOWING_X11
if (timestamp <= 0)
@@ -952,7 +900,7 @@ ev_application_shutdown (EvApplication *application)
application->toolbars_model = NULL;
application->toolbars_file = NULL;
}
-#endif /* !PLATFORM_HILDON */
+#endif
ev_application_save_print_settings (application);
@@ -971,12 +919,14 @@ ev_application_shutdown (EvApplication *application)
application->page_setup = NULL;
}
+#ifndef PLATFORM_HILDON
#ifdef ENABLE_DBUS
if (application->keys) {
g_object_unref (application->keys);
application->keys = NULL;
}
#endif /* ENABLE_DBUS */
+#endif
ev_metadata_manager_shutdown ();
@@ -993,16 +943,6 @@ ev_application_shutdown (EvApplication *application)
instance = NULL;
gtk_main_quit ();
-
-#ifdef PLATFORM_HILDON
- g_signal_handlers_disconnect_by_func (application->program,
- G_CALLBACK (sync_is_topmost_cb),
- application);
- application->program = NULL;
-
- osso_deinitialize (application->osso_context);
- application->osso_context = NULL;
-#endif /* PLATFORM_HILDON */
}
static void
@@ -1014,84 +954,17 @@ static void
ev_application_init (EvApplication *ev_application)
{
#ifndef PLATFORM_HILDON
- int i;
+ gint i;
+#endif
const gchar *home_dir;
- char *toolbar_path;
-#endif /* !PLATFORM_HILDON */
-
-#ifdef PLATFORM_HILDON
- /* FIXME chpe: or does this need to be allocated (if osso_hw_set_event_cb keeps a pointer) ? */
- osso_hw_state_t hw_events = {
- TRUE /* shutdown */,
- TRUE /* save unsaved data */,
- TRUE /* low memory */,
- FALSE /* system inactivity */,
- OSSO_DEVMODE_NORMAL /* device mode */
- /* FIXMEchpe: or is OSSO_DEVMODE_INVALID the value to use
- * when not interested in this signal? The docs don't tell.
- */
- };
- /* Init libosso */
- ev_application->osso_context = osso_initialize ("org.gnome.Evince" /* Same as in evince.service file */,
- VERSION, FALSE, NULL);
- if (ev_application->osso_context == NULL) {
- g_printerr ("Failed to initialise osso\n");
- exit (1);
- }
-
- if (osso_rpc_set_default_cb_f (ev_application->osso_context,
- osso_rpc_cb,
- ev_application) != OSSO_OK ||
- osso_hw_set_event_cb (ev_application->osso_context,
- &hw_events,
- osso_hw_event_cb,
- ev_application) != OSSO_OK) {
- g_printerr ("Failed to connect OSSO handlers\n");
- exit (1);
- }
-
- ev_application->program = HILDON_PROGRAM (hildon_program_get_instance ());
-
- g_signal_connect (ev_application->program, "notify::is-topmost",
- G_CALLBACK(sync_is_topmost_cb), ev_application);
-
- /* This is necessary since the setting is only installed
- * during class initialisation. See bug #585024.
- */
- /* For "gtk-menu-images" setting */
- g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM));
- /* For "gtk-button-images" setting */
- g_type_class_unref (g_type_class_ref (GTK_TYPE_BUTTON));
- /* For "gtk-toolbar-style" setting */
- g_type_class_unref (g_type_class_ref (GTK_TYPE_TOOLBAR));
-
- /* FIXMEchpe sort of strange that maemo doesn't all of this out-of-the-box... */
- g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
- "gtk-alternative-button-order", TRUE,
- "gtk-toolbar-style", GTK_TOOLBAR_ICONS,
- "gtk-menu-images", FALSE,
- "gtk-button-images", FALSE,
- "gtk-enable-mnemonics", FALSE,
-
- /* We want the default of FALSE for this property, but to work
- * around https://bugs.maemo.org/show_bug.cgi?id=2278 we have
- * to set this to TRUE.
- */
- "gtk-enable-accels", TRUE,
- NULL);
-#endif /* PLATFORM_HILDON */
-
#ifndef PLATFORM_HILDON
+ gchar *toolbar_path;
+#endif
ev_application->dot_dir = g_build_filename (g_get_home_dir (),
".gnome2",
"evince",
NULL);
-#else
- ev_application->dot_dir = g_build_filename (g_get_user_config_dir (),
- "evince",
- NULL);
-#endif
-
+
/* FIXME: why make this fatal? */
if (!ev_dir_ensure_exists (ev_application->dot_dir, 0700))
exit (1);
@@ -1110,7 +983,10 @@ ev_application_init (EvApplication *ev_application)
ev_application_init_session (ev_application);
-#ifndef PLATFORM_HILDON
+#ifdef PLATFORM_HILDON
+ ev_application->hildon_program = hildon_program_get_instance ();
+#endif
+
home_dir = g_get_home_dir ();
if (home_dir) {
ev_application->accel_map_file = g_build_filename (home_dir,
@@ -1120,7 +996,8 @@ ev_application_init (EvApplication *ev_application)
NULL);
gtk_accel_map_load (ev_application->accel_map_file);
}
-
+
+#ifndef PLATFORM_HILDON
ev_application->toolbars_model = egg_toolbars_model_new ();
ev_application->toolbars_file = g_build_filename
@@ -1156,12 +1033,13 @@ ev_application_init (EvApplication *ev_application)
egg_toolbars_model_set_flags (ev_application->toolbars_model, 0,
EGG_TB_MODEL_NOT_REMOVABLE);
+#endif
-#endif /* !PLATFORM_HILDON */
-
+#ifndef PLATFORM_HILDON
#ifdef ENABLE_DBUS
ev_application->keys = ev_media_player_keys_new ();
#endif /* ENABLE_DBUS */
+#endif
}
/**
@@ -1202,15 +1080,18 @@ ev_application_get_windows (EvApplication *application)
GObject *
ev_application_get_media_keys (EvApplication *application)
{
+#ifdef PLATFORM_HILDON
+ return NULL;
+#else
#ifdef ENABLE_DBUS
return G_OBJECT (application->keys);
#else
return NULL;
#endif /* ENABLE_DBUS */
+#endif
}
#ifndef PLATFORM_HILDON
-
EggToolbarsModel *
ev_application_get_toolbars_model (EvApplication *application)
{
@@ -1223,8 +1104,7 @@ ev_application_save_toolbars_model (EvApplication *application)
egg_toolbars_model_save_toolbars (application->toolbars_model,
application->toolbars_file, "1.0");
}
-
-#endif /* !PLATFORM_HILDON */
+#endif
void
ev_application_set_filechooser_uri (EvApplication *application,
@@ -1255,18 +1135,37 @@ ev_application_get_filechooser_uri (EvApplication *application,
return NULL;
}
+#ifdef PLATFORM_HILDON
+static gboolean keep_backlight_alive (gconstpointer user_data G_GNUC_UNUSED)
+{
+ g_return_val_if_fail (osso_context, FALSE);
+
+ osso_display_state_on (osso_context);
+ return (osso_display_blanking_pause (osso_context) == OSSO_OK);
+}
+#endif
+
void
ev_application_screensaver_enable (EvApplication *application)
{
+#ifndef PLATFORM_HILDON
if (application->scr_saver)
totem_scrsaver_enable (application->scr_saver);
+#else
+ g_source_remove (application->display_keepalive_timeout);
+#endif
}
void
ev_application_screensaver_disable (EvApplication *application)
{
+#ifndef PLATFORM_HILDON
if (application->scr_saver)
- totem_scrsaver_disable (application->scr_saver);
+ totem_scrsaver_disable (application->scr_saver);
+#else
+ keep_backlight_alive (NULL);
+ application->display_keepalive_timeout = g_timeout_add_seconds (50, (GSourceFunc) keep_backlight_alive, NULL);
+#endif
}
static GKeyFile *
diff --git a/shell/ev-application.h b/shell/ev-application.h
index 7e836a9..df0dd13 100644
--- a/shell/ev-application.h
+++ b/shell/ev-application.h
@@ -84,7 +84,6 @@ GObject *ev_application_get_media_keys (EvApplication *application);
EggToolbarsModel *ev_application_get_toolbars_model (EvApplication *application);
void ev_application_save_toolbars_model (EvApplication *application);
#endif
-
void ev_application_set_filechooser_uri (EvApplication *application,
GtkFileChooserAction action,
const gchar *uri);
diff --git a/shell/ev-open-recent-action.c b/shell/ev-open-recent-action.c
index 17a1745..448bee3 100644
--- a/shell/ev-open-recent-action.c
+++ b/shell/ev-open-recent-action.c
@@ -56,6 +56,9 @@ ev_open_recent_action_create_tool_item (GtkAction *action)
GtkRecentFilter *filter;
toolbar_recent_menu = gtk_recent_chooser_menu_new_for_manager (gtk_recent_manager_get_default ());
+#ifdef PLATFORM_HILDON
+ gtk_widget_set_name (toolbar_recent_menu, "hildon-context-sensitive-menu");
+#endif
gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (toolbar_recent_menu), FALSE);
gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (toolbar_recent_menu), GTK_RECENT_SORT_MRU);
gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (toolbar_recent_menu), 5);
diff --git a/shell/ev-password-view.c b/shell/ev-password-view.c
index a71e423..f7f8e7c 100644
--- a/shell/ev-password-view.c
+++ b/shell/ev-password-view.c
@@ -109,7 +109,9 @@ ev_password_view_init (EvPasswordView *password_view)
GtkWidget *align;
GtkWidget *vbox;
GtkWidget *hbox;
+#ifndef PLATFORM_HILDON
GtkWidget *image;
+#endif
GtkWidget *button;
GtkWidget *label;
gchar *markup;
@@ -134,9 +136,11 @@ ev_password_view_init (EvPasswordView *password_view)
NULL);
gtk_box_pack_start (GTK_BOX (vbox), password_view->priv->label, FALSE, FALSE, 0);
+#ifndef PLATFORM_HILDON
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
+#endif
label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
@@ -147,12 +151,14 @@ ev_password_view_init (EvPasswordView *password_view)
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ hbox = gtk_vbox_new (TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
- button = gtk_button_new_with_mnemonic (_("_Unlock Document"));
+ button = hildon_gtk_button_new (HILDON_SIZE_THUMB_HEIGHT);
+ gtk_button_set_label (GTK_BUTTON (button), _("_Unlock Document"));
+ gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
g_signal_connect (button, "clicked", G_CALLBACK (ev_password_view_clicked_cb), password_view);
- gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show_all (align);
gtk_widget_pop_composite_child ();
@@ -194,7 +200,11 @@ ev_password_dialog_got_response (GtkDialog *dialog,
EvPasswordView *password_view)
{
gtk_widget_set_sensitive (GTK_WIDGET (password_view), TRUE);
-
+
+#ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (password_view->priv->parent_window, 0);
+#endif
+
if (response_id == GTK_RESPONSE_OK) {
g_free (password_view->priv->password);
password_view->priv->password =
@@ -242,7 +252,10 @@ ev_password_view_ask_password (EvPasswordView *password_view)
{
GtkDialog *dialog;
GtkWidget *entry_container;
- GtkWidget *hbox, *main_vbox, *vbox, *icon;
+ GtkWidget *hbox, *main_vbox, *vbox;
+#ifndef PLATFORM_HILDON
+ GtkWidget *icon;
+#endif
GtkWidget *table;
GtkWidget *label;
gchar *format, *markup, *file_name;
@@ -253,21 +266,32 @@ ev_password_view_ask_password (EvPasswordView *password_view)
/* Set the dialog up with HIG properties */
gtk_dialog_set_has_separator (dialog, FALSE);
+#ifndef PLATFORM_HILDON
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
+#endif
gtk_window_set_title (GTK_WINDOW (dialog), _("Enter password"));
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+#ifndef PLATFORM_HILDON
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_DIALOG_AUTHENTICATION);
+#endif
gtk_window_set_transient_for (GTK_WINDOW (dialog), password_view->priv->parent_window);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_dialog_add_buttons (dialog,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+#ifndef PLATFORM_HILDON
_("_Unlock Document"), GTK_RESPONSE_OK,
+#endif
NULL);
+
+#ifdef PLATFORM_HILDON
+ GtkWidget *button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Unlock Document"), GTK_RESPONSE_OK);
+ hildon_gtk_widget_set_theme_size (button, HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
+#endif
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
GTK_RESPONSE_OK, FALSE);
@@ -278,16 +302,20 @@ ev_password_view_ask_password (EvPasswordView *password_view)
/* Build contents */
hbox = gtk_hbox_new (FALSE, 12);
+#ifndef PLATFORM_HILDON
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+#endif
gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
+#ifndef PLATFORM_HILDON
icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0);
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
gtk_widget_show (icon);
+#endif
main_vbox = gtk_vbox_new (FALSE, 18);
gtk_box_pack_start (GTK_BOX (hbox), main_vbox, TRUE, TRUE, 0);
@@ -332,7 +360,12 @@ ev_password_view_ask_password (EvPasswordView *password_view)
label = gtk_label_new_with_mnemonic (_("_Password:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#ifdef PLATFORM_HILDON
+ password_view->priv->password_entry = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
+#else
password_view->priv->password_entry = gtk_entry_new ();
+#endif
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (password_view->priv->password_entry), HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
gtk_entry_set_visibility (GTK_ENTRY (password_view->priv->password_entry), FALSE);
g_signal_connect (password_view->priv->password_entry, "changed",
G_CALLBACK (ev_password_dialog_entry_changed_cb),
diff --git a/shell/ev-properties-dialog.c b/shell/ev-properties-dialog.c
index 6c802b3..0aac9d8 100644
--- a/shell/ev-properties-dialog.c
+++ b/shell/ev-properties-dialog.c
@@ -26,9 +26,7 @@
#include <gtk/gtk.h>
#ifdef PLATFORM_HILDON
-#include <hildon/hildon-gtk.h>
-#include <hildon/hildon-pannable-area.h>
-#include <hildon/hildon-stackable-window.h>
+#include <hildon/hildon.h>
#endif
#include "ev-document-fonts.h"
@@ -38,31 +36,23 @@
#include "ev-properties-view.h"
struct _EvPropertiesDialog {
-#ifndef PLATFORM_HILDON
GtkDialog base_instance;
-#else
- HildonStackableWindow base_instance;
-#endif
EvDocument *document;
GtkWidget *notebook;
+#ifdef PLATFORM_HILDON
+ GtkWidget *button_hbox;
+ GtkWidget *page_toggle_buttons[2];
+#endif
GtkWidget *general_page;
GtkWidget *fonts_page;
};
struct _EvPropertiesDialogClass {
-#ifndef PLATFORM_HILDON
GtkDialogClass base_class;
-#else
- HildonStackableWindowClass base_class;
-#endif
};
-#ifndef PLATFORM_HILDON
G_DEFINE_TYPE (EvPropertiesDialog, ev_properties_dialog, GTK_TYPE_DIALOG)
-#else
-G_DEFINE_TYPE (EvPropertiesDialog, ev_properties_dialog, HILDON_TYPE_STACKABLE_WINDOW)
-#endif
static void
ev_properties_dialog_class_init (EvPropertiesDialogClass *properties_class)
@@ -74,36 +64,51 @@ ev_properties_dialog_init (EvPropertiesDialog *properties)
{
gtk_window_set_title (GTK_WINDOW (properties), _("Properties"));
gtk_window_set_destroy_with_parent (GTK_WINDOW (properties), TRUE);
-
+ gtk_dialog_set_has_separator (GTK_DIALOG (properties), FALSE);
#ifndef PLATFORM_HILDON
- gtk_dialog_set_has_separator (GTK_DIALOG (properties), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (properties), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (properties)->vbox), 2);
-
+#endif
gtk_dialog_add_button (GTK_DIALOG (properties), GTK_STOCK_CLOSE,
GTK_RESPONSE_CANCEL);
gtk_dialog_set_default_response (GTK_DIALOG (properties),
GTK_RESPONSE_CANCEL);
-#else
-
-#endif /* !PLATFORM_HILDON */
properties->notebook = gtk_notebook_new ();
-
-#ifndef PLATFORM_HILDON
+#ifdef PLATFORM_HILDON
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (properties->notebook), FALSE);
+ properties->button_hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (properties)->vbox),
+ properties->button_hbox, FALSE, FALSE, 0);
+ gtk_widget_show (properties->button_hbox);
+#else
gtk_container_set_border_width (GTK_CONTAINER (properties->notebook), 5);
+#endif
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (properties)->vbox),
properties->notebook, TRUE, TRUE, 0);
-#else
- gtk_container_add (GTK_CONTAINER (properties), properties->notebook);
-#endif /* !PLATFORM_HILDON */
-
gtk_widget_show (properties->notebook);
g_signal_connect (properties, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
}
+#ifdef PLATFORM_HILDON
+static void
+on_button_toggled (GtkToggleButton *button G_GNUC_UNUSED, EvPropertiesDialog *properties)
+{
+ g_return_if_fail (properties);
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (properties->page_toggle_buttons[0])))
+ {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (properties->notebook), 0);
+ }
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (properties->page_toggle_buttons[1])))
+ {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (properties->notebook), 1);
+ }
+}
+#endif
+
void
ev_properties_dialog_set_document (EvPropertiesDialog *properties,
const gchar *uri,
@@ -117,44 +122,49 @@ ev_properties_dialog_set_document (EvPropertiesDialog *properties,
info = ev_page_cache_get_info (ev_page_cache_get (document));
if (properties->general_page == NULL) {
+ #ifdef PLATFORM_HILDON
+ properties->page_toggle_buttons[0] = hildon_gtk_radio_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, NULL);
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (properties->page_toggle_buttons[0]), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (properties->page_toggle_buttons[0]), TRUE);
+ g_signal_connect (G_OBJECT (properties->page_toggle_buttons[0]), "toggled", G_CALLBACK (on_button_toggled), properties);
+ #endif
label = gtk_label_new (_("General"));
properties->general_page = ev_properties_view_new (uri);
-
-#ifndef PLATFORM_HILDON
gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
properties->general_page, label);
+ #ifdef PLATFORM_HILDON
+ gtk_button_set_label (GTK_BUTTON (properties->page_toggle_buttons[0]), gtk_notebook_get_tab_label_text (GTK_NOTEBOOK (properties->notebook), properties->general_page));
+ gtk_box_pack_start (GTK_BOX (properties->button_hbox), properties->page_toggle_buttons[0], TRUE, TRUE, 0);
+ gtk_widget_show (properties->page_toggle_buttons[0]);
+ #endif
gtk_widget_show (properties->general_page);
-#else
- {
- GtkWidget *viewport, *pannable;
-
- viewport = gtk_viewport_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (viewport), properties->general_page);
- gtk_widget_show (properties->general_page);
-
- pannable = hildon_pannable_area_new ();
- gtk_container_add (GTK_CONTAINER (pannable), viewport);
- gtk_widget_show (viewport);
-
- gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
- pannable, label);
- gtk_widget_show (pannable);
- }
-#endif /* !PLATFORM_HILDON */
}
ev_properties_view_set_info (EV_PROPERTIES_VIEW (properties->general_page), info);
if (EV_IS_DOCUMENT_FONTS (document)) {
if (properties->fonts_page == NULL) {
+ #ifdef PLATFORM_HILDON
+ properties->page_toggle_buttons[1] = hildon_gtk_radio_button_new_from_widget (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, GTK_RADIO_BUTTON (properties->page_toggle_buttons[0]));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (properties->page_toggle_buttons[1]), FALSE);
+ g_signal_connect (G_OBJECT (properties->page_toggle_buttons[1]), "toggled", G_CALLBACK (on_button_toggled), properties);
+ #endif
label = gtk_label_new (_("Fonts"));
properties->fonts_page = ev_properties_fonts_new ();
gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
properties->fonts_page, label);
+ #ifdef PLATFORM_HILDON
+ gtk_button_set_label (GTK_BUTTON (properties->page_toggle_buttons[1]), gtk_notebook_get_tab_label_text (GTK_NOTEBOOK (properties->notebook), properties->fonts_page));
+ gtk_box_pack_start (GTK_BOX (properties->button_hbox), properties->page_toggle_buttons[1], TRUE, TRUE, 0);
+ gtk_widget_show (properties->page_toggle_buttons[1]);
+ #endif
gtk_widget_show (properties->fonts_page);
}
ev_properties_fonts_set_document
(EV_PROPERTIES_FONTS (properties->fonts_page), document);
+ #ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (GTK_WINDOW (properties), 1);
+ #endif
}
}
diff --git a/shell/ev-properties-fonts.c b/shell/ev-properties-fonts.c
index beaf88c..651d083 100644
--- a/shell/ev-properties-fonts.c
+++ b/shell/ev-properties-fonts.c
@@ -26,8 +26,7 @@
#include <gtk/gtk.h>
#ifdef PLATFORM_HILDON
-#include <hildon/hildon-gtk.h>
-#include <hildon/hildon-pannable-area.h>
+#include <hildon/hildon.h>
#endif
#include "ev-document-fonts.h"
@@ -116,22 +115,18 @@ ev_properties_fonts_init (EvPropertiesFonts *properties)
gtk_container_set_border_width (GTK_CONTAINER (properties), 12);
gtk_box_set_spacing (GTK_BOX (properties), 6);
-
-#if 1 // #ifndef PLATFORM_HILDON
+
+#ifdef PLATFORM_HILDON
+ swindow = hildon_pannable_area_new ();
+#else
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
GTK_SHADOW_IN);
-
+#endif
properties->fonts_treeview = gtk_tree_view_new ();
-#else
- swindow = hildon_pannable_area_new ();
-
- properties->fonts_treeview = hildon_gtk_tree_view_new (HILDON_SIZE_AUTO);
-#endif /* !PLATFORM_HILDON */
-
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (properties->fonts_treeview),
FALSE);
column = gtk_tree_view_column_new ();
@@ -150,11 +145,9 @@ ev_properties_fonts_init (EvPropertiesFonts *properties)
NULL, NULL);
gtk_container_add (GTK_CONTAINER (swindow), properties->fonts_treeview);
- gtk_widget_show (properties->fonts_treeview);
gtk_box_pack_start (GTK_BOX (properties), swindow,
TRUE, TRUE, 0);
- gtk_widget_show (swindow);
properties->fonts_progress_label = gtk_label_new (NULL);
g_object_set (G_OBJECT (properties->fonts_progress_label),
@@ -163,7 +156,7 @@ ev_properties_fonts_init (EvPropertiesFonts *properties)
gtk_box_pack_start (GTK_BOX (properties),
properties->fonts_progress_label,
FALSE, FALSE, 0);
- gtk_widget_show (properties->fonts_progress_label);
+ gtk_widget_show_all (GTK_WIDGET (properties));
}
static void
@@ -178,6 +171,9 @@ update_progress_label (GtkWidget *label, double progress)
gtk_widget_show (label);
} else {
gtk_widget_hide (label);
+ #ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (GTK_WINDOW (gtk_widget_get_toplevel (label)), 0);
+ #endif
}
}
diff --git a/shell/ev-utils.c b/shell/ev-utils.c
index 8cda889..180baf6 100644
--- a/shell/ev-utils.c
+++ b/shell/ev-utils.c
@@ -27,6 +27,11 @@
#include <math.h>
#include <glib/gi18n.h>
+#ifdef PLATFORM_HILDON
+#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
+#endif
+
typedef struct
{
int size;
@@ -399,3 +404,52 @@ get_gdk_pixbuf_format_by_extension (gchar *uri)
g_slist_free (pixbuf_formats);
return NULL;
}
+
+#ifdef PLATFORM_HILDON
+/* Taken from Hildon Application Manager; Copyright Nokia Corporation. GPL V.2 */
+/* Hack for HildonPannableArea to use its deprecated policy: HILDON_SIZE_REQUEST_CHILDREN */
+
+static void
+pannable_area_size_request (GtkWidget *widget, GtkRequisition *requisition,
+ gpointer user_data)
+{
+ GtkRequisition child_req;
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (child && GTK_IS_VIEWPORT (child))
+ child = gtk_bin_get_child (GTK_BIN (child));
+
+ if (child)
+ {
+ gtk_widget_size_request (child, &child_req);
+ requisition->height = MIN (350, child_req.height);
+ }
+}
+
+void
+hildon_pannable_area_set_size_request_children (GObject *area)
+{
+ g_signal_connect (area, "size-request", G_CALLBACK (pannable_area_size_request), NULL);
+}
+#endif
+
+#ifdef PLATFORM_HILDON
+void steal_zoom_keys (GtkWidget *window)
+{
+
+ const gulong value = 1;
+
+ g_return_if_fail (GTK_WIDGET_REALIZED (window));
+ gdk_property_change (window->window, gdk_atom_intern_static_string ("_HILDON_ZOOM_KEY_ATOM"), gdk_x11_xatom_to_atom (XA_INTEGER), 32, GDK_PROP_MODE_REPLACE, (guchar *) &value, 1);
+#if 0 /* Well done to the Autobuilder team for making it use an OLD SDK version. Idiots. */
+ hildon_gtk_window_enable_zoom_keys (GTK_WINDOW (window), TRUE);
+#endif
+}
+
+inline G_CONST_RETURN gchar* dgettext_localised_or_english (const gchar* domainname, const gchar* msgid, const gchar *fallback_string)
+{
+ G_CONST_RETURN gchar *retval = dgettext (domainname, msgid);
+
+ return G_UNLIKELY (g_str_equal (retval, msgid)) ? fallback_string : retval;
+}
+#endif
diff --git a/shell/ev-utils.h b/shell/ev-utils.h
index f7c58a7..17b8ec8 100644
--- a/shell/ev-utils.h
+++ b/shell/ev-utils.h
@@ -44,6 +44,19 @@ gdouble get_screen_dpi (GtkWindow * window);
void file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser);
GdkPixbufFormat* get_gdk_pixbuf_format_by_extension (gchar *uri);
+#ifdef PLATFORM_HILDON
+/* Taken from Hildon Application Manager; Copyright Nokia Corporation. GPL V.2 */
+/* Hack for HildonPannableArea to use its deprecated policy: HILDON_SIZE_REQUEST_CHILDREN */
+
+void hildon_pannable_area_set_size_request_children (GObject *area);
+#endif
+
+#ifdef PLATFORM_HILDON
+void steal_zoom_keys (GtkWidget *window);
+
+inline G_CONST_RETURN gchar* dgettext_localised_or_english (const gchar* domainname, const gchar* msgid, const gchar *fallback_string);
+#endif
+
G_END_DECLS
#endif /* __EV_VIEW_H__ */
diff --git a/shell/ev-window.c b/shell/ev-window.c
index bf1a2ac..2404d47 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -39,10 +39,21 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
+#ifdef PLATFORM_HILDON
+#include <hildon-mime.h>
+#include <hildon/hildon-file-chooser-dialog.h>
+#endif
+
#ifdef WITH_GCONF
#include <gconf/gconf-client.h>
#endif
+#ifndef PLATFORM_HILDON
+#include "egg-editable-toolbar.h"
+#include "egg-toolbar-editor.h"
+#include "egg-toolbars-model.h"
+#endif
+
#include "eggfindbar.h"
#include "ephy-zoom-action.h"
@@ -94,16 +105,6 @@
#include <poppler.h>
#endif
-#ifdef PLATFORM_HILDON
-#include <hildon/hildon-file-chooser-dialog.h>
-#endif
-
-#ifndef PLATFORM_HILDON
-#include "egg-editable-toolbar.h"
-#include "egg-toolbar-editor.h"
-#include "egg-toolbars-model.h"
-#endif
-
typedef enum {
PAGE_MODE_DOCUMENT,
PAGE_MODE_PASSWORD
@@ -131,6 +132,9 @@ struct _EvWindowPrivate {
GtkWidget *main_box;
GtkWidget *menubar;
+#ifdef PLATFORM_HILDON
+ GtkWidget *app_menu;
+#endif
GtkWidget *toolbar;
GtkWidget *hpaned;
GtkWidget *view_box;
@@ -215,6 +219,10 @@ struct _EvWindowPrivate {
gboolean close_after_print;
};
+#ifdef PLATFORM_HILDON
+static gboolean special_mode = FALSE, edit_mode = FALSE;
+#endif
+
#define EV_WINDOW_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_WINDOW, EvWindowPrivate))
@@ -309,15 +317,17 @@ static void find_bar_search_changed_cb (EggFindBar *find_
EvWindow *ev_window);
static void ev_window_load_file_remote (EvWindow *ev_window,
GFile *source_file);
+#ifndef PLATFORM_HILDON
static void ev_window_media_player_key_pressed (EvWindow *window,
const gchar *key,
gpointer user_data);
+#endif
static void ev_window_save_print_page_setup (EvWindow *window);
-#ifndef PLATFORM_HILDON
-G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
+#ifdef PLATFORM_HILDON
+G_DEFINE_TYPE (EvWindow, ev_window, HILDON_TYPE_WINDOW) /* No point in deriving from HildonStackableWindow */
#else
-G_DEFINE_TYPE (EvWindow, ev_window, HILDON_TYPE_WINDOW)
+G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
#endif
static void
@@ -327,7 +337,11 @@ ev_window_set_action_sensitive (EvWindow *ev_window,
{
GtkAction *action = gtk_action_group_get_action (ev_window->priv->action_group,
name);
+#ifdef PLATFORM_HILDON
+ gtk_action_set_visible (action, sensitive);
+#else
gtk_action_set_sensitive (action, sensitive);
+#endif
}
@@ -526,22 +540,24 @@ ev_window_set_view_accels_sensitivity (EvWindow *window, gboolean sensitive)
static void
set_widget_visibility (GtkWidget *widget, gboolean visible)
{
- if (!widget)
- return;
-
+ if (widget) {
g_assert (GTK_IS_WIDGET (widget));
if (visible)
gtk_widget_show (widget);
else
gtk_widget_hide (widget);
+ }
}
static void
update_chrome_visibility (EvWindow *window)
{
EvWindowPrivate *priv = window->priv;
- gboolean menubar, toolbar, findbar, fullscreen_toolbar, sidebar;
+ gboolean menubar, toolbar, findbar, sidebar;
+#ifndef PLATFORM_HILDON
+ gboolean fullscreen_toolbar;
+#endif
gboolean fullscreen_mode, presentation, fullscreen;
presentation = ev_view_get_presentation (EV_VIEW (priv->view));
@@ -551,8 +567,10 @@ update_chrome_visibility (EvWindow *window)
menubar = (priv->chrome & EV_CHROME_MENUBAR) != 0 && !fullscreen_mode;
toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 ||
(priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && !fullscreen_mode;
+#ifndef PLATFORM_HILDON
fullscreen_toolbar = ((priv->chrome & EV_CHROME_FULLSCREEN_TOOLBAR) != 0 ||
(priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && fullscreen;
+#endif
findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && !presentation;
@@ -2093,8 +2111,13 @@ ev_window_cmd_file_open (GtkAction *action, EvWindow *window)
GtkWidget *chooser;
const gchar *default_uri;
gchar *parent_uri = NULL;
+ gboolean select_multiple = TRUE;
-#ifndef PLATFORM_HILDON
+#ifdef PLATFORM_HILDON
+ chooser = hildon_file_chooser_dialog_new (GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_OPEN);
+ gtk_window_set_title (GTK_WINDOW (chooser), _("Open Document"));
+ select_multiple = FALSE;
+#else
chooser = gtk_file_chooser_dialog_new (_("Open Document"),
GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -2102,23 +2125,10 @@ ev_window_cmd_file_open (GtkAction *action, EvWindow *window)
GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
-
- gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), TRUE);
-
- gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
- gtk_dialog_set_alternative_button_order (GTK_DIALOG (chooser),
- GTK_RESPONSE_OK,
- GTK_RESPONSE_CANCEL,
- -1);
-
-#else
-
- chooser = hildon_file_chooser_dialog_new (GTK_WINDOW (window),
- GTK_FILE_CHOOSER_ACTION_OPEN);
- gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), FALSE);
-#endif /* !PLATFORM_HILDON */
+#endif
ev_document_factory_add_filters (chooser, NULL);
+ gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), select_multiple);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), FALSE);
default_uri = ev_application_get_filechooser_uri (EV_APP, GTK_FILE_CHOOSER_ACTION_OPEN);
@@ -2661,25 +2671,24 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
GFile *file;
const gchar *default_uri;
-#ifndef PLATFORM_HILDON
+#ifdef PLATFORM_HILDON
+ fc = hildon_file_chooser_dialog_new (GTK_WINDOW (ev_window), GTK_FILE_CHOOSER_ACTION_SAVE);
+ gtk_window_set_title (GTK_WINDOW (fc), _("Save a Copy"));
+#else
fc = gtk_file_chooser_dialog_new (
_("Save a Copy"),
GTK_WINDOW (ev_window), GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
NULL);
+#endif
+
+ ev_document_factory_add_filters (fc, ev_window->priv->document);
gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
-#else
-
- fc = hildon_file_chooser_dialog_new (GTK_WINDOW (ev_window),
- GTK_FILE_CHOOSER_ACTION_OPEN);
-#endif /* !PLATFORM_HILDON */
-
- ev_document_factory_add_filters (fc, ev_window->priv->document);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE);
@@ -3333,6 +3342,12 @@ ev_window_cmd_edit_find (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
+ if (GTK_WIDGET_VISIBLE (ev_window->priv->find_bar))
+ {
+ g_signal_emit_by_name (ev_window->priv->find_bar, "close", 0);
+ return;
+ }
+
if (ev_window->priv->document == NULL || !EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
g_error ("Find action should be insensitive since document doesn't support find");
return;
@@ -3397,10 +3412,14 @@ ev_window_update_fullscreen_action (EvWindow *window)
}
#ifndef PLATFORM_HILDON
-
static void
fullscreen_toolbar_setup_item_properties (GtkUIManager *ui_manager)
{
+#ifdef PLATFORM_HILDON
+ const gboolean enable = FALSE;
+#else
+ const gboolean enable = TRUE;
+#endif
GtkWidget *item;
item = gtk_ui_manager_get_widget (ui_manager, "/FullscreenToolbar/GoPreviousPage");
@@ -3410,10 +3429,10 @@ fullscreen_toolbar_setup_item_properties (GtkUIManager *ui_manager)
g_object_set (item, "is-important", FALSE, NULL);
item = gtk_ui_manager_get_widget (ui_manager, "/FullscreenToolbar/StartPresentation");
- g_object_set (item, "is-important", TRUE, NULL);
+ g_object_set (item, "is-important", enable, NULL);
item = gtk_ui_manager_get_widget (ui_manager, "/FullscreenToolbar/LeaveFullscreen");
- g_object_set (item, "is-important", TRUE, NULL);
+ g_object_set (item, "is-important", enable, NULL);
}
static void
@@ -3436,8 +3455,7 @@ fullscreen_toolbar_remove_shadow (GtkWidget *toolbar)
gtk_widget_set_name (toolbar, "fullscreen-toolbar");
}
-
-#endif /* PLATFORM_HILDON */
+#endif
static void
ev_window_run_fullscreen (EvWindow *window)
@@ -3447,7 +3465,7 @@ ev_window_run_fullscreen (EvWindow *window)
if (ev_view_get_fullscreen (view))
return;
-
+
#ifndef PLATFORM_HILDON
if (!window->priv->fullscreen_toolbar) {
window->priv->fullscreen_toolbar =
@@ -3459,13 +3477,17 @@ ev_window_run_fullscreen (EvWindow *window)
fullscreen_toolbar_remove_shadow (window->priv->fullscreen_toolbar);
fullscreen_toolbar_setup_item_properties (window->priv->ui_manager);
+#ifndef PLATFORM_HILDON
gtk_box_pack_start (GTK_BOX (window->priv->main_box),
window->priv->fullscreen_toolbar,
FALSE, FALSE, 0);
+#else
+ hildon_window_add_toolbar (HILDON_WINDOW (window), GTK_TOOLBAR (window->priv->fullscreen_toolbar));
+#endif
gtk_box_reorder_child (GTK_BOX (window->priv->main_box),
window->priv->fullscreen_toolbar, 1);
}
-#endif /* !PLATFORM_HILDON */
+#endif
if (ev_view_get_presentation (view)) {
ev_window_stop_presentation (window, FALSE);
@@ -3482,9 +3504,11 @@ ev_window_run_fullscreen (EvWindow *window)
/* If the user doesn't have the main toolbar he/she won't probably want
* the toolbar in fullscreen mode. See bug #483048
*/
+#ifndef PLATFORM_HILDON
update_chrome_flag (window, EV_CHROME_FULLSCREEN_TOOLBAR,
(window->priv->chrome & EV_CHROME_TOOLBAR) != 0);
update_chrome_visibility (window);
+#endif
if (fullscreen_window)
gtk_window_fullscreen (GTK_WINDOW (window));
@@ -3509,8 +3533,10 @@ ev_window_stop_fullscreen (EvWindow *window,
ev_view_set_fullscreen (view, FALSE);
ev_window_update_fullscreen_action (window);
+#ifndef PLATFORM_HILDON
update_chrome_flag (window, EV_CHROME_FULLSCREEN_TOOLBAR, FALSE);
update_chrome_visibility (window);
+#endif
if (unfullscreen_window)
gtk_window_unfullscreen (GTK_WINDOW (window));
@@ -3723,6 +3749,11 @@ ev_window_setup_gtk_settings (EvWindow *window)
}
g_free (menubar_accel_accel);
+
+#ifdef PLATFORM_HILDON
+ gtk_settings_set_long_property(settings, "gtk-menu-images", 0, GETTEXT_PACKAGE);
+ gtk_settings_set_long_property(settings, "gtk-enable-mnemonics", 0, GETTEXT_PACKAGE);
+#endif
}
static void
@@ -3822,7 +3853,6 @@ ev_window_cmd_edit_rotate_right (GtkAction *action, EvWindow *ev_window)
}
#ifndef PLATFORM_HILDON
-
static void
ev_window_cmd_edit_toolbar_cb (GtkDialog *dialog, gint response, gpointer data)
{
@@ -3866,8 +3896,7 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window)
ev_window);
gtk_widget_show_all (dialog);
}
-
-#endif /* !PLATFORM_HILDON */
+#endif
static void
ev_window_cmd_view_zoom_in (GtkAction *action, EvWindow *ev_window)
@@ -3961,6 +3990,7 @@ ev_window_cmd_view_autoscroll (GtkAction *action, EvWindow *ev_window)
ev_view_autoscroll_start (EV_VIEW (ev_window->priv->view));
}
+#ifndef PLATFORM_HILDON
static void
ev_window_cmd_help_contents (GtkAction *action, EvWindow *ev_window)
{
@@ -3976,6 +4006,7 @@ ev_window_cmd_help_contents (GtkAction *action, EvWindow *ev_window)
g_error_free (error);
}
}
+#endif
static void
ev_window_cmd_leave_fullscreen (GtkAction *action, EvWindow *window)
@@ -3989,6 +4020,7 @@ ev_window_cmd_start_presentation (GtkAction *action, EvWindow *window)
ev_window_run_presentation (window);
}
+#ifndef PLATFORM_HILDON
static void
ev_window_cmd_escape (GtkAction *action, EvWindow *window)
{
@@ -4018,11 +4050,11 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
} else {
gtk_widget_grab_focus (window->priv->view);
}
-
if (fullscreen && presentation)
g_warning ("Both fullscreen and presentation set somehow");
}
}
+#endif
static void
save_sizing_mode (EvWindow *window)
@@ -4210,6 +4242,13 @@ build_comments_string (void)
#endif
}
+#ifdef PLATFORM_HILDON
+static void on_about_dialog_link_activated (const GtkAboutDialog *about G_GNUC_UNUSED, const gchar *link_, gconstpointer data G_GNUC_UNUSED)
+{
+ hildon_uri_open (link_, hildon_uri_get_default_action (link_, NULL), NULL);
+}
+#endif
+
static void
ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
{
@@ -4222,6 +4261,9 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
"Carlos Garcia Campos <carlosgc gnome org>",
"Wouter Bolsterlee <wbolster gnome org>",
"Christian Persch <chpe" "\100" "gnome.org>",
+ "Unofficial Maemo port:",
+ " Faheem Pervez <trippin1 gmail com>",
+ " Ed Bartosh <bartosh gmail com>",
NULL
};
@@ -4261,6 +4303,10 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
_(license[2]), "\n", NULL);
comments = build_comments_string ();
+#ifdef PLATFORM_HILDON
+ gtk_about_dialog_set_url_hook ((GtkAboutDialogActivateLinkFunc) on_about_dialog_link_activated, NULL, NULL);
+#endif
+
gtk_show_about_dialog (
GTK_WINDOW (ev_window),
"name", _("Evince"),
@@ -4494,12 +4540,18 @@ ev_window_update_find_status_message (EvWindow *ev_window)
"%d found on this page",
n_results),
n_results);
+ #ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (GTK_WINDOW (ev_window), 0);
+ #endif
} else {
gdouble percent;
percent = ev_job_find_get_progress (EV_JOB_FIND (ev_window->priv->find_job));
message = g_strdup_printf (_("%3d%% remaining to search"),
(gint) ((1.0 - percent) * 100));
+ #ifdef PLATFORM_HILDON
+ hildon_gtk_window_set_progress_indicator (GTK_WINDOW (ev_window), 1);
+ #endif
}
egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar), message);
@@ -4724,6 +4776,7 @@ ev_window_dispose (GObject *object)
{
EvWindow *window = EV_WINDOW (object);
EvWindowPrivate *priv = window->priv;
+#ifndef PLATFORM_HILDON
GObject *mpkeys = ev_application_get_media_keys (EV_APP);
if (mpkeys) {
@@ -4731,7 +4784,8 @@ ev_window_dispose (GObject *object)
ev_window_media_player_key_pressed,
window);
}
-
+#endif
+
if (priv->setup_document_idle > 0) {
g_source_remove (priv->setup_document_idle);
priv->setup_document_idle = 0;
@@ -4980,14 +5034,6 @@ ev_window_class_init (EvWindowClass *ev_window_class)
g_type_class_add_private (g_object_class, sizeof (EvWindowPrivate));
}
-#ifndef PLATFORM_HILDON
-#define ACTION_TOOLTIP(string) (string)
-#define ACTION_ACCEL(nonHildonString, hildonString) (nonHildonString)
-#else
-#define ACTION_TOOLTIP(string) (NULL)
-#define ACTION_ACCEL(nonHildonString, hildonString) (hildonString)
-#endif /* !PLATFORM_HILDON */
-
/* Normal items */
static const GtkActionEntry entries[] = {
{ "File", NULL, N_("_File") },
@@ -4997,33 +5043,37 @@ static const GtkActionEntry entries[] = {
{ "Help", NULL, N_("_Help") },
/* File menu */
- { "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), NULL,
- ACTION_TOOLTIP (N_("Open an existing document")),
+ { "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
+ N_("Open an existing document"),
G_CALLBACK (ev_window_cmd_file_open) },
{ "FileOpenCopy", NULL, N_("Op_en a Copy"), "<control>N",
- ACTION_TOOLTIP (N_("Open a copy of the current document in a new window")),
+ N_("Open a copy of the current document in a new window"),
G_CALLBACK (ev_window_cmd_file_open_copy) },
{ "FileSaveAs", GTK_STOCK_SAVE_AS, N_("_Save a Copy..."), "<control>S",
- ACTION_TOOLTIP (N_("Save a copy of the current document")),
+ N_("Save a copy of the current document"),
G_CALLBACK (ev_window_cmd_save_as) },
{ "FilePageSetup", GTK_STOCK_PAGE_SETUP, N_("Page Set_up..."), NULL,
- ACTION_TOOLTIP (N_("Setup the page settings for printing")),
+ N_("Setup the page settings for printing"),
G_CALLBACK (ev_window_cmd_file_print_setup) },
{ "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
- ACTION_TOOLTIP (N_("Print this document")),
+ N_("Print this document"),
G_CALLBACK (ev_window_cmd_file_print) },
+#ifndef PLATFORM_HILDON
{ "FileProperties", GTK_STOCK_PROPERTIES, N_("P_roperties"), "<alt>Return", NULL,
+#else
+ { "FileProperties", GTK_STOCK_PROPERTIES, N_("P_roperties"), "<shift>KP_Enter", NULL,
+#endif
G_CALLBACK (ev_window_cmd_file_properties) },
{ "FileCloseWindow", GTK_STOCK_CLOSE, NULL, "<control>W", NULL,
G_CALLBACK (ev_window_cmd_file_close_window) },
/* Edit menu */
- { "EditCopy", GTK_STOCK_COPY, NULL, NULL, NULL,
+ { "EditCopy", GTK_STOCK_COPY, NULL, "<control>C", NULL,
G_CALLBACK (ev_window_cmd_edit_copy) },
{ "EditSelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "<control>A", NULL,
G_CALLBACK (ev_window_cmd_edit_select_all) },
{ "EditFind", GTK_STOCK_FIND, N_("_Find..."), "<control>F",
- ACTION_TOOLTIP (N_("Find a word or phrase in the document")),
+ N_("Find a word or phrase in the document"),
G_CALLBACK (ev_window_cmd_edit_find) },
{ "EditFindNext", NULL, N_("Find Ne_xt"), "<control>G", NULL,
G_CALLBACK (ev_window_cmd_edit_find_next) },
@@ -5039,73 +5089,99 @@ static const GtkActionEntry entries[] = {
G_CALLBACK (ev_window_cmd_edit_rotate_right) },
/* View menu */
- { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL,
- ACTION_ACCEL ("<control>plus", "F7" /* HILDON_HARDKEY_INCREASE */),
- ACTION_TOOLTIP (N_("Enlarge the document")),
+ { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus",
+ N_("Enlarge the document"),
G_CALLBACK (ev_window_cmd_view_zoom_in) },
- { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL,
- ACTION_ACCEL ("<control>minus", "F8" /* HILDON_HARDKEY_DECREASE */),
- ACTION_TOOLTIP (N_("Shrink the document")),
+ { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus",
+ N_("Shrink the document"),
G_CALLBACK (ev_window_cmd_view_zoom_out) },
{ "ViewReload", GTK_STOCK_REFRESH, N_("_Reload"), "<control>R",
- ACTION_TOOLTIP (N_("Reload the document")),
+ N_("Reload the document"),
G_CALLBACK (ev_window_cmd_view_reload) },
{ "ViewAutoscroll", GTK_STOCK_MEDIA_PLAY, N_("Auto_scroll"), NULL, NULL,
G_CALLBACK (ev_window_cmd_view_autoscroll) },
/* Go menu */
+#ifndef PLATFORM_HILDON
{ "GoPreviousPage", GTK_STOCK_GO_UP, N_("_Previous Page"), "<control>Page_Up",
- ACTION_TOOLTIP (N_("Go to the previous page")),
+#else
+ { "GoPreviousPage", "keyboard_move_up", N_("_Previous Page"), "<control>Page_Up",
+#endif
+ N_("Go to the previous page"),
G_CALLBACK (ev_window_cmd_go_previous_page) },
+#ifndef PLATFORM_HILDON
{ "GoNextPage", GTK_STOCK_GO_DOWN, N_("_Next Page"), "<control>Page_Down",
- ACTION_TOOLTIP (N_("Go to the next page")),
+#else
+ { "GoNextPage", "keyboard_move_down", N_("_Next Page"), "<control>Page_Down",
+#endif
+ N_("Go to the next page"),
G_CALLBACK (ev_window_cmd_go_next_page) },
{ "GoFirstPage", GTK_STOCK_GOTO_TOP, N_("_First Page"), "<control>Home",
- ACTION_TOOLTIP (N_("Go to the first page")),
+ N_("Go to the first page"),
G_CALLBACK (ev_window_cmd_go_first_page) },
{ "GoLastPage", GTK_STOCK_GOTO_BOTTOM, N_("_Last Page"), "<control>End",
- ACTION_TOOLTIP (N_("Go to the last page")),
+ N_("Go to the last page"),
G_CALLBACK (ev_window_cmd_go_last_page) },
+#ifndef PLATFORM_HILDON
/* Help menu */
{ "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", NULL,
G_CALLBACK (ev_window_cmd_help_contents) },
+#endif
{ "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL,
G_CALLBACK (ev_window_cmd_help_about) },
/* Toolbar-only */
+#ifndef PLATFORM_HILDON
{ "LeaveFullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_("Leave Fullscreen"), NULL,
- ACTION_TOOLTIP (N_("Leave fullscreen mode")),
+#else
+ { "LeaveFullscreen", "imageviewer_resize", N_("Leave Fullscreen"), NULL,
+#endif
+ N_("Leave fullscreen mode"),
G_CALLBACK (ev_window_cmd_leave_fullscreen) },
- { "StartPresentation", EV_STOCK_RUN_PRESENTATION, N_("Start Presentation"), NULL,
- ACTION_TOOLTIP (N_("Start a presentation")),
+ { "StartPresentation", EV_STOCK_RUN_PRESENTATION, N_("Start Presentation"), "<control>j",
+ N_("Start a presentation"),
G_CALLBACK (ev_window_cmd_start_presentation) },
/* Accellerators */
- { "Escape", NULL, "", "Escape", NULL,
- G_CALLBACK (ev_window_cmd_escape) },
+#ifndef PLATFORM_HILDON
+ { "Escape", NULL, "", "BackSpace", "",
+ G_CALLBACK (ev_window_cmd_escape) },
+#endif
{ "Slash", GTK_STOCK_FIND, NULL, "slash", NULL,
G_CALLBACK (ev_window_cmd_edit_find) },
{ "F3", NULL, "", "F3", NULL,
G_CALLBACK (ev_window_cmd_edit_find_next) },
+#ifdef PLATFORM_HILDON
+ { "PageDown", NULL, "", "<control>Down", NULL,
+#else
{ "PageDown", NULL, "", "Page_Down", NULL,
+#endif
G_CALLBACK (ev_window_cmd_scroll_forward) },
+#ifdef PLATFORM_HILDON
+ { "PageUp", NULL, "", "<control>Up", NULL,
+#else
{ "PageUp", NULL, "", "Page_Up", NULL,
+#endif
G_CALLBACK (ev_window_cmd_scroll_backward) },
{ "Space", NULL, "", "space", NULL,
G_CALLBACK (ev_window_cmd_scroll_forward) },
{ "ShiftSpace", NULL, "", "<shift>space", NULL,
G_CALLBACK (ev_window_cmd_scroll_backward) },
+#ifndef PLATFORM_HILDON
{ "BackSpace", NULL, "", "BackSpace", NULL,
G_CALLBACK (ev_window_cmd_scroll_backward) },
{ "ShiftBackSpace", NULL, "", "<shift>BackSpace", NULL,
G_CALLBACK (ev_window_cmd_scroll_forward) },
+#endif
{ "Return", NULL, "", "Return", NULL,
G_CALLBACK (ev_window_cmd_scroll_forward) },
+#ifndef PLATFORM_HILDON
{ "ShiftReturn", NULL, "", "<shift>Return", NULL,
G_CALLBACK (ev_window_cmd_scroll_backward) },
+#endif
{ "Plus", GTK_STOCK_ZOOM_IN, NULL, "plus", NULL,
G_CALLBACK (ev_window_cmd_view_zoom_in) },
{ "CtrlEqual", GTK_STOCK_ZOOM_IN, NULL, "<control>equal", NULL,
@@ -5136,30 +5212,36 @@ static const GtkActionEntry entries[] = {
static const GtkToggleActionEntry toggle_entries[] = {
/* View Menu */
{ "ViewToolbar", NULL, N_("_Toolbar"), NULL,
- ACTION_TOOLTIP (N_("Show or hide the toolbar")),
+ N_("Show or hide the toolbar"),
G_CALLBACK (ev_window_view_toolbar_cb), TRUE },
+#ifdef PLATFORM_HILDON
+ { "ViewSidebar", GTK_STOCK_INDEX, N_("Side _Pane"), "<control>Z",
+#else
{ "ViewSidebar", GTK_STOCK_INDEX, N_("Side _Pane"), "F9",
- ACTION_TOOLTIP (N_("Show or hide the side pane")),
+#endif
+ N_("Show or hide the side pane"),
G_CALLBACK (ev_window_view_sidebar_cb), TRUE },
{ "ViewContinuous", EV_STOCK_VIEW_CONTINUOUS, N_("_Continuous"), NULL,
- ACTION_TOOLTIP (N_("Show the entire document")),
+ N_("Show the entire document"),
G_CALLBACK (ev_window_cmd_continuous), TRUE },
{ "ViewDual", EV_STOCK_VIEW_DUAL, N_("_Dual"), NULL,
- ACTION_TOOLTIP (N_("Show two pages at once")),
+ N_("Show two pages at once"),
G_CALLBACK (ev_window_cmd_dual), FALSE },
- { "ViewFullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"),
- ACTION_ACCEL ("F11", "F6" /* HILDON_HARDKEY_FULLSCREEN */),
- ACTION_TOOLTIP (N_("Expand the window to fill the screen")),
+#ifndef PLATFORM_HILDON
+ { "ViewFullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
+#else
+ { "ViewFullscreen", "general_fullsize", N_("_Fullscreen"), "<control>KP_Enter",
+#endif
+ N_("Expand the window to fill the screen"),
G_CALLBACK (ev_window_cmd_view_fullscreen) },
- { "ViewPresentation", EV_STOCK_RUN_PRESENTATION, N_("Pre_sentation"),
- ACTION_ACCEL ("F5", NULL),
- ACTION_TOOLTIP (N_("Run document as a presentation")),
+ { "ViewPresentation", EV_STOCK_RUN_PRESENTATION, N_("Pre_sentation"), "F5",
+ N_("Run document as a presentation"),
G_CALLBACK (ev_window_cmd_view_presentation) },
{ "ViewBestFit", EV_STOCK_ZOOM_PAGE, N_("_Best Fit"), NULL,
- ACTION_TOOLTIP (N_("Make the current document fill the window")),
+ N_("Make the current document fill the window"),
G_CALLBACK (ev_window_cmd_view_best_fit) },
{ "ViewPageWidth", EV_STOCK_ZOOM_WIDTH, N_("Fit Page _Width"), NULL,
- ACTION_TOOLTIP (N_("Make the current document fill the window width")),
+ N_("Make the current document fill the window width"),
G_CALLBACK (ev_window_cmd_view_page_width) },
};
@@ -5262,7 +5344,11 @@ register_custom_actions (EvWindow *window, GtkActionGroup *group)
"name", "FileOpenRecent",
"label", _("_Open..."),
"tooltip", _("Open an existing document"),
+#ifdef PLATFORM_HILDON
+ "icon-name", "filemanager_document_folder",
+#else
"stock_id", GTK_STOCK_OPEN,
+#endif
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (ev_window_cmd_file_open), window);
@@ -5344,12 +5430,14 @@ sidebar_widget_model_set (EvSidebarLinks *ev_sidebar_links,
static gboolean
view_actions_focus_in_cb (GtkWidget *widget, GdkEventFocus *event, EvWindow *window)
{
+#ifndef PLATFORM_HILDON
#ifdef ENABLE_DBUS
GObject *keys;
keys = ev_application_get_media_keys (EV_APP);
ev_media_player_keys_focused (EV_MEDIA_PLAYER_KEYS (keys));
#endif /* ENABLE_DBUS */
+#endif
update_chrome_flag (window, EV_CHROME_RAISE_TOOLBAR, FALSE);
ev_window_set_action_sensitive (window, "ViewToolbar", TRUE);
@@ -5763,7 +5851,10 @@ ev_view_popup_cmd_save_image_as (GtkAction *action, EvWindow *window)
if (!window->priv->image)
return;
-#ifndef PLATFORM_HILDON
+#ifdef PLATFORM_HILDON
+ fc = hildon_file_chooser_dialog_new (GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_SAVE);
+ gtk_window_set_title (GTK_WINDOW (fc), _("Save Image"));
+#else
fc = gtk_file_chooser_dialog_new (_("Save Image"),
GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_SAVE,
@@ -5771,6 +5862,7 @@ ev_view_popup_cmd_save_image_as (GtkAction *action, EvWindow *window)
GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
NULL);
+#endif
gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc),
@@ -5778,12 +5870,6 @@ ev_view_popup_cmd_save_image_as (GtkAction *action, EvWindow *window)
GTK_RESPONSE_CANCEL,
-1);
-#else
-
- fc = hildon_file_chooser_dialog_new (GTK_WINDOW (window),
- GTK_FILE_CHOOSER_ACTION_SAVE);
-#endif /* !PLATFORM_HILDON */
-
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE);
@@ -5932,6 +6018,10 @@ ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, EvWindow *window)
if (g_list_length (window->priv->attach_list) == 1)
attachment = (EvAttachment *) window->priv->attach_list->data;
+#ifdef PLATFORM_HILDON
+ fc = hildon_file_chooser_dialog_new (GTK_WINDOW (window), attachment ? GTK_FILE_CHOOSER_ACTION_SAVE : GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ gtk_window_set_title (GTK_WINDOW (fc), _("Save Attachment"));
+#else
fc = gtk_file_chooser_dialog_new (
_("Save Attachment"),
GTK_WINDOW (window),
@@ -5940,6 +6030,7 @@ ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, EvWindow *window)
GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
NULL);
+#endif
gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc),
@@ -5961,6 +6052,7 @@ ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, EvWindow *window)
gtk_widget_show (fc);
}
+#ifndef PLATFORM_HILDON
static void
ev_window_media_player_key_pressed (EvWindow *window,
const gchar *key,
@@ -5989,24 +6081,109 @@ ev_window_media_player_key_pressed (EvWindow *window,
ev_window_cmd_go_first_page (NULL, window);
}
}
+#endif
+
+#ifdef PLATFORM_HILDON
+gboolean get_special_mode(void)
+{
+ return special_mode;
+}
+
+gboolean get_edit_mode(void)
+{
+ return edit_mode;
+}
+
+static gboolean ev_app_key_press_event (EvWindow *ev_window,
+ GdkEventKey *event, gconstpointer user_data G_GNUC_UNUSED) {
+
+ GtkAction *action;
+ GtkWidget *widget;
+
+ switch (event->keyval)
+ {
+ case HILDON_HARDKEY_INCREASE:
+ if (special_mode) {
+ action = gtk_action_group_get_action(ev_window->priv->action_group, "GoNextPage");
+ ev_window_cmd_go_next_page(action, ev_window);
+ } else {
+ action = gtk_action_group_get_action(ev_window->priv->action_group, "ViewZoomIn");
+ ev_window_cmd_view_zoom_in(action, ev_window);
+ }
+ return TRUE;
+ case HILDON_HARDKEY_DECREASE:
+ if (special_mode) {
+ action = gtk_action_group_get_action(ev_window->priv->action_group, "GoPreviousPage");
+ ev_window_cmd_go_previous_page(action, ev_window);
+ } else {
+ action = gtk_action_group_get_action(ev_window->priv->action_group, "ViewZoomOut");
+ ev_window_cmd_view_zoom_out(action, ev_window);
+ }
+ return TRUE;
+ case GDK_space:
+ if (event->state & GDK_CONTROL_MASK)
+ {
+ special_mode = !special_mode;
+ if (!ev_view_get_presentation (EV_VIEW (ev_window->priv->view)))
+ hildon_banner_show_information(GTK_WIDGET(ev_window), NULL, special_mode ? "special mode on" : "special mode off");
+ return TRUE;
+ }
+ case GDK_KP_Enter:
+ if (event->state & GDK_MOD5_MASK && !ev_view_get_presentation (EV_VIEW (ev_window->priv->view)))
+ {
+ hildon_app_menu_popup (HILDON_APP_MENU (ev_window->priv->app_menu), GTK_WINDOW (ev_window));
+ return TRUE;
+ }
+ case GDK_BackSpace:
+ widget = gtk_window_get_focus (GTK_WINDOW (ev_window));
+ gboolean presentation = FALSE;
+
+ if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR))
+ return FALSE;
+
+ g_object_get (ev_window->priv->view, "presentation", &presentation, NULL);
+ if (presentation) {
+ ev_window_stop_presentation (ev_window, TRUE);
+ gtk_widget_grab_focus (ev_window->priv->view);
+ }
+
+ return presentation;
+ case GDK_comma:
+ if (event->state & GDK_CONTROL_MASK)
+ {
+ edit_mode = !edit_mode;
+ if (!ev_view_get_presentation (EV_VIEW (ev_window->priv->view)))
+ hildon_banner_show_information(GTK_WIDGET(ev_window), NULL, edit_mode ? "edit mode on" : "edit mode off");
+ ev_view_toggle_edit_mode ();
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+#endif
static void
ev_window_init (EvWindow *ev_window)
{
- EvWindowPrivate *priv;
GtkActionGroup *action_group;
GtkAccelGroup *accel_group;
GError *error = NULL;
GtkWidget *sidebar_widget;
+#ifndef PLATFORM_HILDON
GObject *mpkeys;
+#endif
gchar *ui_path;
g_signal_connect (ev_window, "configure_event",
G_CALLBACK (window_configure_event_cb), NULL);
g_signal_connect (ev_window, "window_state_event",
G_CALLBACK (window_state_event_cb), NULL);
+#ifdef PLATFORM_HILDON
+ g_signal_connect (ev_window, "key-press-event", G_CALLBACK(ev_app_key_press_event), NULL);
+#endif
- priv = ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window);
+ ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window);
ev_window->priv->page_mode = PAGE_MODE_DOCUMENT;
ev_window->priv->title = ev_window_title_new (ev_window);
@@ -6055,13 +6232,9 @@ ev_window_init (EvWindow *ev_window)
action_group, 0);
ui_path = g_build_filename (ev_application_get_data_dir (EV_APP),
-#ifndef PLATFORM_HILDON
- "evince-ui.xml",
-#else
- "evince-hildon-ui.xml",
-#endif
- NULL);
- if (!gtk_ui_manager_add_ui_from_file (priv->ui_manager, ui_path, &error))
+ "evince-ui.xml", NULL);
+ if (!gtk_ui_manager_add_ui_from_file (
+ ev_window->priv->ui_manager, ui_path, &error))
{
g_warning ("building menus failed: %s", error->message);
g_error_free (error);
@@ -6076,10 +6249,10 @@ ev_window_init (EvWindow *ev_window)
G_CALLBACK (ev_window_setup_recent),
ev_window);
-#ifndef PLATFORM_HILDON
ev_window->priv->menubar =
gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
"/MainMenu");
+#ifndef PLATFORM_HILDON
gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box),
ev_window->priv->menubar,
FALSE, FALSE, 0);
@@ -6096,15 +6269,38 @@ ev_window_init (EvWindow *ev_window)
gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box),
ev_window->priv->toolbar,
FALSE, FALSE, 0);
- gtk_widget_show (ev_window->priv->toolbar);
+#else
+ guint i;
+ const gchar *menu_items[] =
+ {
+ "FileOpen",
+ "FileSaveAs",
+ "FileProperties",
+ "EditRotateLeft",
+ "EditRotateRight",
+ "ViewSidebar",
+ "ViewContinuous",
+ "ViewDual",
+ "HelpAbout"
+ };
+
+ ev_window->priv->app_menu = hildon_app_menu_new ();
+
+ for (i = 0; i < G_N_ELEMENTS (menu_items); ++i)
+ {
+ GtkWidget *button = g_str_has_prefix (menu_items[i], "View") ? gtk_toggle_button_new () : gtk_button_new (); /* HildonAppMenu takes care of styling it and resizing it when we add it to the menu */
+ gtk_action_connect_proxy (gtk_action_group_get_action (ev_window->priv->action_group, menu_items[i]), button);
+ hildon_app_menu_append (HILDON_APP_MENU (ev_window->priv->app_menu), GTK_BUTTON (button));
+ }
+
+ hildon_window_set_app_menu (HILDON_WINDOW (ev_window), HILDON_APP_MENU (ev_window->priv->app_menu));
+ gtk_widget_show_all (ev_window->priv->app_menu);
-#else /* PLATFORM_HILDON */
- hildon_window_set_menu (HILDON_WINDOW (ev_window),
- GTK_MENU (gtk_ui_manager_get_widget (priv->ui_manager, "/MainMenu")));
- priv->toolbar = gtk_ui_manager_get_widget (priv->ui_manager, "/DefaultToolBar");
- hildon_window_add_toolbar (HILDON_WINDOW (ev_window), GTK_TOOLBAR (priv->toolbar));
+ ev_window->priv->toolbar = gtk_ui_manager_get_widget (ev_window->priv->ui_manager, "/DefaultToolBar");
+ hildon_window_add_toolbar (HILDON_WINDOW (ev_window), GTK_TOOLBAR (ev_window->priv->toolbar));
#endif
-
+ gtk_widget_show_all (ev_window->priv->toolbar);
+
/* Add the main area */
ev_window->priv->hpaned = gtk_hpaned_new ();
g_signal_connect (ev_window->priv->hpaned,
@@ -6216,9 +6412,13 @@ ev_window_init (EvWindow *ev_window)
/* Find Bar */
ev_window->priv->find_bar = egg_find_bar_new ();
+#ifdef PLATFORM_HILDON
+ hildon_window_add_toolbar (HILDON_WINDOW (ev_window), GTK_TOOLBAR (ev_window->priv->find_bar));
+#else
gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
ev_window->priv->find_bar,
FALSE, TRUE, 0);
+#endif
/* We own a ref on these widgets, as we can swap them in and out */
g_object_ref (ev_window->priv->view);
@@ -6301,6 +6501,7 @@ ev_window_init (EvWindow *ev_window)
"/AttachmentPopup");
ev_window->priv->attach_list = NULL;
+#ifndef PLATFORM_HILDON
/* Media player keys */
mpkeys = ev_application_get_media_keys (EV_APP);
if (mpkeys) {
@@ -6308,6 +6509,7 @@ ev_window_init (EvWindow *ev_window)
G_CALLBACK (ev_window_media_player_key_pressed),
ev_window);
}
+#endif
/* Give focus to the document view */
gtk_widget_grab_focus (ev_window->priv->view);
diff --git a/shell/ev-window.h b/shell/ev-window.h
index 1dd0a05..172f085 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -27,7 +27,7 @@
#include <gtk/gtk.h>
#ifdef PLATFORM_HILDON
-#include <hildon/hildon-window.h>
+#include <hildon/hildon.h>
#endif
#include "ev-link.h"
@@ -65,22 +65,27 @@ typedef struct _EvWindowPrivate EvWindowPrivate;
struct _EvWindow {
-#ifndef PLATFORM_HILDON
- GtkWindow base_instance;
-#else
+#ifdef PLATFORM_HILDON
HildonWindow base_instance;
+#else
+ GtkWindow base_instance;
#endif
EvWindowPrivate *priv;
};
struct _EvWindowClass {
-#ifndef PLATFORM_HILDON
- GtkWindowClass base_class;
-#else
+#ifdef PLATFORM_HILDON
HildonWindowClass base_class;
+#else
+ GtkWindowClass base_class;
#endif
};
+#ifdef PLATFORM_HILDON
+ gboolean get_special_mode(void);
+ gboolean get_edit_mode(void);
+#endif
+
GType ev_window_get_type (void);
GtkWidget *ev_window_new (void);
const char *ev_window_get_uri (EvWindow *ev_window);
diff --git a/shell/main.c b/shell/main.c
index af246aa..7a7b978 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -19,7 +19,6 @@
#include "config.h"
-#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -27,6 +26,11 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#ifdef PLATFORM_HILDON
+#include <hildon/hildon.h>
+#include <libosso.h>
+#endif
+
#ifdef ENABLE_DBUS
#include <gdk/gdkx.h>
#include <dbus/dbus-glib-bindings.h>
@@ -56,9 +60,8 @@
#include <windows.h>
#endif
-// FIXME!
#ifdef PLATFORM_HILDON
-#undef ENABLE_DBUS
+extern osso_context_t *osso_context;
#endif
static gchar *ev_page_label;
@@ -69,6 +72,7 @@ static gboolean presentation_mode = FALSE;
static gboolean unlink_temp_file = FALSE;
static gchar *print_settings;
static const char **file_arguments = NULL;
+static gboolean dbus_activated = FALSE;
static gboolean
option_version_cb (const gchar *option_name,
@@ -396,13 +400,52 @@ load_files_remote (const char **files,
}
#endif /* ENABLE_DBUS */
+#ifdef PLATFORM_HILDON
+static gint dbus_handler (const gchar *interface G_GNUC_UNUSED, const gchar *method, const GArray *arguments, gconstpointer data G_GNUC_UNUSED, osso_rpc_t *retval)
+{
+ osso_return_t ret = OSSO_ERROR; /* Let's err on the side of caution */
+ gboolean success = FALSE;
+
+ g_return_val_if_fail(method != NULL, ret);
+ g_return_val_if_fail(retval != NULL, ret);
+
+ if (g_str_equal (method, "mime_open")) /* || g_str_equal (method, "load_url")) */
+ {
+ guint i, i2 = 0;
+ gchar **files = g_new0 (gchar *, arguments->len + 1);
+ dbus_activated = TRUE;
+
+ for (i = 0; i < arguments->len; i++)
+ {
+ osso_rpc_t *arg = &g_array_index (arguments, osso_rpc_t, i);
+ if (arg && arg->type == DBUS_TYPE_STRING && arg->value.s)
+ {
+ files[i] = g_strdup (arg->value.s);
+
+ success = TRUE;
+ ret = OSSO_OK;
+ ++i2;
+ }
+ }
+
+ files[i2+1] = NULL;
+
+ load_files_remote ((const gchar **) files, NULL);
+ g_strfreev (files);
+ }
+
+ retval->type = DBUS_TYPE_BOOLEAN;
+ retval->value.b = success;
+ return ret;
+}
+#endif
+
int
main (int argc, char *argv[])
{
GOptionContext *context;
GHashTable *args;
GError *error = NULL;
- const char *home_dir;
#ifdef G_OS_WIN32
@@ -429,6 +472,10 @@ main (int argc, char *argv[])
}
#endif
+ /* Init glib threads asap */
+ if (!g_thread_supported ())
+ g_thread_init (NULL);
+
#ifdef ENABLE_NLS
/* Initialize the i18n stuff */
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -436,9 +483,6 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
#endif
- /* Init glib threads asap */
- g_thread_init (NULL);
-
context = g_option_context_new (N_("GNOME Document Viewer"));
g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE);
@@ -449,20 +493,6 @@ main (int argc, char *argv[])
g_option_context_add_group (context, gtk_get_option_group (TRUE));
-#ifdef PLATFORM_HILDON
- {
- char *rc_file;
-
- /* Note: we have to use gtk_rc_add_default_file() before calling gtk_init() (via
- * g_option_context_parse()) rather than parsing the file directly afterward, in
- * order to get priority over the theme.
- */
- rc_file = g_build_filename (DATADIR, "gtkrc-hildon", NULL);
- gtk_rc_add_default_file (rc_file);
- g_free (rc_file);
- }
-#endif /* PLATFORM_HILDON */
-
if (!g_option_context_parse (context, &argc, &argv, &error)) {
g_printerr ("Cannot parse arguments: %s", error->message);
g_error_free (error);
@@ -497,6 +527,14 @@ main (int argc, char *argv[])
ev_stock_icons_init ();
+#ifdef PLATFORM_HILDON
+ hildon_init ();
+
+ osso_context = osso_initialize ("org.gnome.evince.ApplicationService", VERSION, TRUE, NULL);
+ g_assert (osso_context);
+ osso_rpc_set_cb_f (osso_context, "org.gnome.evince.ApplicationService", "/org/gnome/evince/ApplicationService", "org.gnome.evince.ApplicationService", (osso_rpc_cb_f *) dbus_handler, NULL); /* Experimental! This is rather fucked up code of mine */
+#endif
+
#if defined(WITH_SMCLIENT) && defined(GDK_WINDOWING_X11)
egg_set_desktop_file (GNOMEDATADIR "/applications/evince.desktop");
#else
@@ -505,21 +543,27 @@ main (int argc, char *argv[])
gtk_window_set_default_icon_name ("evince");
#endif /* WITH_SMCLIENT && GDK_WINDOWING_X11 */
+if (!dbus_activated)
+{
ev_application_load_session (EV_APP, file_arguments);
load_files (file_arguments, args);
+}
g_hash_table_destroy (args);
/* Change directory so we don't prevent unmounting in case the initial cwd
* is on an external device (see bug #575436)
*/
- home_dir = g_get_home_dir ();
- if (home_dir != NULL &&
- g_chdir (home_dir) < 0)
- g_warning ("Failed to chdir to '%s': %s\n", home_dir, g_strerror (errno));
+ g_chdir (g_get_home_dir ());
gtk_main ();
ev_shutdown ();
+
+#ifdef PLATFORM_HILDON
+ if (osso_context)
+ osso_deinitialize (osso_context);
+#endif
+
ev_stock_icons_shutdown ();
return 0;
--
1.7.1
>From 3781b5495df91cc77682bea1d73a0723815aab72 Mon Sep 17 00:00:00 2001
From: David Fries <david fries net>
Date: Sat, 21 Aug 2010 13:33:10 -0500
Subject: [PATCH 2/5] avoid the fall through in the switch statement (can't be good)
---
shell/ev-window.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 2404d47..83b502c 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6128,12 +6128,14 @@ static gboolean ev_app_key_press_event (EvWindow *ev_window,
hildon_banner_show_information(GTK_WIDGET(ev_window), NULL, special_mode ? "special mode on" : "special mode off");
return TRUE;
}
+ return FALSE;
case GDK_KP_Enter:
if (event->state & GDK_MOD5_MASK && !ev_view_get_presentation (EV_VIEW (ev_window->priv->view)))
{
hildon_app_menu_popup (HILDON_APP_MENU (ev_window->priv->app_menu), GTK_WINDOW (ev_window));
return TRUE;
}
+ return FALSE;
case GDK_BackSpace:
widget = gtk_window_get_focus (GTK_WINDOW (ev_window));
gboolean presentation = FALSE;
--
1.7.1
>From 4ba634098b37d1346addb81b5f160ecc3bd62b5b Mon Sep 17 00:00:00 2001
From: David Fries <david fries net>
Date: Sat, 21 Aug 2010 13:45:52 -0500
Subject: [PATCH 3/5] Get shift space to work.
---
shell/ev-window.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 83b502c..ce8d1b4 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6128,6 +6128,12 @@ static gboolean ev_app_key_press_event (EvWindow *ev_window,
hildon_banner_show_information(GTK_WIDGET(ev_window), NULL, special_mode ? "special mode on" : "special mode off");
return TRUE;
}
+ /* The <shift>space hot key isn't working, do it here. */
+ if (event->state & GDK_SHIFT_MASK)
+ {
+ ev_window_cmd_scroll_backward( NULL, ev_window);
+ return TRUE;
+ }
return FALSE;
case GDK_KP_Enter:
if (event->state & GDK_MOD5_MASK && !ev_view_get_presentation (EV_VIEW (ev_window->priv->view)))
--
1.7.1
>From 84dc02eb2e53ef97cb738ab39b1a0f8dc7050cf1 Mon Sep 17 00:00:00 2001
From: David Fries <david fries net>
Date: Sat, 21 Aug 2010 13:52:09 -0500
Subject: [PATCH 4/5] Backspace out of full screen.
For N900 Maemo the bottom right button goes to full screen not
presentation mode, and the backspace was only checking for presentation
mode. Extend it to disable full screen as well.
---
shell/ev-window.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/shell/ev-window.c b/shell/ev-window.c
index ce8d1b4..fc9adb1 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6145,6 +6145,7 @@ static gboolean ev_app_key_press_event (EvWindow *ev_window,
case GDK_BackSpace:
widget = gtk_window_get_focus (GTK_WINDOW (ev_window));
gboolean presentation = FALSE;
+ gboolean fullscreen = FALSE;
if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR))
return FALSE;
@@ -6154,8 +6155,14 @@ static gboolean ev_app_key_press_event (EvWindow *ev_window,
ev_window_stop_presentation (ev_window, TRUE);
gtk_widget_grab_focus (ev_window->priv->view);
}
+ g_object_get (ev_window->priv->view, "fullscreen", &fullscreen, NULL);
+ if (fullscreen) {
+ ev_window_stop_fullscreen (ev_window, TRUE);
+ gtk_widget_grab_focus (ev_window->priv->view);
+ }
+
- return presentation;
+ return presentation || fullscreen;
case GDK_comma:
if (event->state & GDK_CONTROL_MASK)
{
--
1.7.1
>From d3887c3d45f8cec1116f3cd8cf4b18b4d9f184db Mon Sep 17 00:00:00 2001
From: David Fries <david fries net>
Date: Sat, 21 Aug 2010 15:47:15 -0500
Subject: [PATCH 5/5] Add a New (window) item to the main menu.
This allows for creating a new window (to then select a new document
to view). All of the Maemo Note, terminal, and web browser have the
new menu item at the first position, so I put it there.
I created this before I realize that selecting an item in the
recently open popup would also create a new window. Of course if the
one you are after isn't in that list it's a multistep process of
opening the new document, then selecting the old document from the
recently used items list, which also swaps window positions.
I was finished, so here's the patch anyway.
---
shell/ev-window.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/shell/ev-window.c b/shell/ev-window.c
index fc9adb1..73d6f9b 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -2106,6 +2106,12 @@ file_open_dialog_response_cb (GtkWidget *chooser,
}
static void
+ev_window_cmd_new_window (GtkAction *action, EvWindow *window)
+{
+ ev_application_open_window (EV_APP, NULL, GDK_CURRENT_TIME, NULL);
+}
+
+static void
ev_window_cmd_file_open (GtkAction *action, EvWindow *window)
{
GtkWidget *chooser;
@@ -5043,6 +5049,9 @@ static const GtkActionEntry entries[] = {
{ "Help", NULL, N_("_Help") },
/* File menu */
+ { "NewWindow", NULL, N_("_New..."), NULL,
+ N_("Create a new window"),
+ G_CALLBACK (ev_window_cmd_new_window) },
{ "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
N_("Open an existing document"),
G_CALLBACK (ev_window_cmd_file_open) },
@@ -6288,6 +6297,7 @@ ev_window_init (EvWindow *ev_window)
guint i;
const gchar *menu_items[] =
{
+ "NewWindow",
"FileOpen",
"FileSaveAs",
"FileProperties",
--
1.7.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]