+++ /dev/null
-/* this file is part of evince, a gnome document viewer
- *
- * Copyright (C) 2004 Red Hat, Inc.
- *
- * Author:
- * Jonathan Blandford <jrb@alum.mit.edu>
- *
- * Evince is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Evince is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gtk/gtk.h>
-
-#include "ev-statusbar.h"
-
-struct _EvStatusbarPrivate {
- GtkWidget *bar;
- GtkWidget *progress;
-
- guint help_message_cid;
- guint view_message_cid;
- guint progress_message_cid;
-
- guint pulse_timeout_id;
- guint progress_timeout_id;
-};
-
-G_DEFINE_TYPE (EvStatusbar, ev_statusbar, GTK_TYPE_HBOX)
-
-#define EV_STATUSBAR_GET_PRIVATE(object) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_STATUSBAR, EvStatusbarPrivate))
-
-static void
-ev_statusbar_destroy (GtkObject *object)
-{
- EvStatusbar *ev_statusbar = EV_STATUSBAR (object);
-
- ev_statusbar_set_progress (ev_statusbar, FALSE);
-
- (* GTK_OBJECT_CLASS (ev_statusbar_parent_class)->destroy) (object);
-}
-
-static void
-ev_statusbar_class_init (EvStatusbarClass *ev_statusbar_class)
-{
- GObjectClass *g_object_class;
- GtkWidgetClass *widget_class;
- GtkObjectClass *gtk_object_klass;
-
- g_object_class = G_OBJECT_CLASS (ev_statusbar_class);
- widget_class = GTK_WIDGET_CLASS (ev_statusbar_class);
- gtk_object_klass = GTK_OBJECT_CLASS (ev_statusbar_class);
-
- g_type_class_add_private (g_object_class, sizeof (EvStatusbarPrivate));
-
- gtk_object_klass->destroy = ev_statusbar_destroy;
-}
-
-static void
-ev_statusbar_init (EvStatusbar *ev_statusbar)
-{
- ev_statusbar->priv = EV_STATUSBAR_GET_PRIVATE (ev_statusbar);
-
- ev_statusbar->priv->progress = gtk_progress_bar_new ();
- gtk_box_pack_start (GTK_BOX (ev_statusbar), ev_statusbar->priv->progress, FALSE, FALSE, 3);
- ev_statusbar->priv->bar = gtk_statusbar_new ();
- gtk_box_pack_start (GTK_BOX (ev_statusbar), ev_statusbar->priv->bar, TRUE, TRUE, 0);
-
- ev_statusbar->priv->help_message_cid = gtk_statusbar_get_context_id
- (GTK_STATUSBAR (ev_statusbar->priv->bar), "help_message");
- ev_statusbar->priv->view_message_cid = gtk_statusbar_get_context_id
- (GTK_STATUSBAR (ev_statusbar->priv->bar), "view_message");
- ev_statusbar->priv->progress_message_cid = gtk_statusbar_get_context_id
- (GTK_STATUSBAR (ev_statusbar->priv->bar), "progress_message");
-
- gtk_widget_show (GTK_WIDGET (ev_statusbar->priv->bar));
- gtk_widget_show (GTK_WIDGET (ev_statusbar));
-
- ev_statusbar->priv->progress_timeout_id = 0;
- ev_statusbar->priv->pulse_timeout_id = 0;
-}
-
-/* Public functions */
-
-GtkWidget *
-ev_statusbar_new (void)
-{
- GtkWidget *ev_statusbar;
-
- ev_statusbar = g_object_new (EV_TYPE_STATUSBAR, NULL);
-
- return ev_statusbar;
-}
-
-static guint
-ev_statusbar_get_context_id (EvStatusbar *statusbar, EvStatusbarContext context)
-{
- switch (context) {
- case EV_CONTEXT_HELP:
- return statusbar->priv->help_message_cid;
- case EV_CONTEXT_VIEW:
- return statusbar->priv->view_message_cid;
- case EV_CONTEXT_PROGRESS:
- return statusbar->priv->progress_message_cid;
- }
- return -1;
-}
-
-void
-ev_statusbar_push (EvStatusbar *ev_statusbar,
- EvStatusbarContext context,
- const gchar *message)
-{
- gtk_statusbar_push (GTK_STATUSBAR (ev_statusbar->priv->bar),
- ev_statusbar_get_context_id (ev_statusbar, context),
- message);
- return;
-}
-
-void
-ev_statusbar_pop (EvStatusbar *ev_statusbar,
- EvStatusbarContext context)
-{
- gtk_statusbar_pop (GTK_STATUSBAR (ev_statusbar->priv->bar),
- ev_statusbar_get_context_id (ev_statusbar, context));
- return;
-}
-
-void
-ev_statusbar_set_maximized (EvStatusbar *ev_statusbar,
- gboolean maximized)
-{
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (ev_statusbar->priv->bar),
- maximized);
- return;
-}
-
-static gboolean
-ev_statusbar_pulse (gpointer data)
-{
- EvStatusbar *ev_statusbar = EV_STATUSBAR (data);
-
- gtk_progress_bar_pulse (GTK_PROGRESS_BAR (ev_statusbar->priv->progress));
-
- return TRUE;
-}
-
-static gboolean
-ev_statusbar_show_progress (gpointer data)
-{
- EvStatusbar *ev_statusbar = EV_STATUSBAR (data);
-
- gtk_widget_show (ev_statusbar->priv->progress);
- ev_statusbar->priv->pulse_timeout_id = g_timeout_add (300, ev_statusbar_pulse, ev_statusbar);
- ev_statusbar->priv->progress_timeout_id = 0;
-
- return FALSE;
-}
-
-void
-ev_statusbar_set_progress (EvStatusbar *ev_statusbar,
- gboolean active)
-{
- if (active){
- if (ev_statusbar->priv->progress_timeout_id == 0
- && ev_statusbar->priv->pulse_timeout_id == 0)
- ev_statusbar->priv->progress_timeout_id =
- g_timeout_add (500, ev_statusbar_show_progress, ev_statusbar);
- } else {
- if (ev_statusbar->priv->pulse_timeout_id) {
- g_source_remove (ev_statusbar->priv->pulse_timeout_id);
- gtk_widget_hide (ev_statusbar->priv->progress);
- }
-
- if (ev_statusbar->priv->progress_timeout_id)
- g_source_remove (ev_statusbar->priv->progress_timeout_id);
-
- ev_statusbar->priv->progress_timeout_id = 0;
- ev_statusbar->priv->pulse_timeout_id = 0;
-
- }
-}
-
-
-
+++ /dev/null
-/* ev-statusbar.h
- * this file is part of evince, a gnome document viewer
- *
- * Copyright (C) 2004 Red Hat, Inc.
- *
- * Author:
- * Jonathan Blandford <jrb@alum.mit.edu>
- *
- * Evince is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Evince is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EV_STATUSBAR_H__
-#define __EV_STATUSBAR_H__
-
-#include <gtk/gtkvbox.h>
-#include "ev-document.h"
-
-G_BEGIN_DECLS
-
-typedef struct _EvStatusbar EvStatusbar;
-typedef struct _EvStatusbarClass EvStatusbarClass;
-typedef struct _EvStatusbarPrivate EvStatusbarPrivate;
-
-#define EV_TYPE_STATUSBAR (ev_statusbar_get_type())
-#define EV_STATUSBAR(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_STATUSBAR, EvStatusbar))
-#define EV_STATUSBAR_CLASS(klass) (G_TYPE_CHACK_CLASS_CAST((klass), EV_TYPE_STATUSBAR, EvStatusbarClass))
-#define EV_IS_STATUSBAR(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_STATUSBAR))
-#define EV_IS_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_STATUSBAR))
-#define EV_STATUSBAR_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_STATUSBAR, EvStatusbarClass))
-
-struct _EvStatusbar {
- GtkHBox base_instance;
-
- EvStatusbarPrivate *priv;
-};
-
-struct _EvStatusbarClass {
- GtkHBoxClass base_class;
-};
-
-GType ev_statusbar_get_type (void);
-GtkWidget *ev_statusbar_new (void);
-
-typedef enum {
- EV_CONTEXT_HELP,
- EV_CONTEXT_VIEW,
- EV_CONTEXT_PROGRESS,
-} EvStatusbarContext;
-
-void ev_statusbar_push (EvStatusbar *ev_statusbar,
- EvStatusbarContext context,
- const gchar *message);
-void ev_statusbar_pop (EvStatusbar *ev_statusbar,
- EvStatusbarContext context);
-void ev_statusbar_set_maximized (EvStatusbar *ev_statusbar,
- gboolean maximized);
-void ev_statusbar_set_progress (EvStatusbar *ev_statusbar,
- gboolean active);
-
-G_END_DECLS
-
-#endif /* __EV_STATUSBAR_H__ */
-
-
#include "ev-document-types.h"
#include "ev-job-queue.h"
#include "ev-jobs.h"
-#include "ev-statusbar.h"
#include "ev-sidebar-page.h"
#include "eggfindbar.h"
#include "egg-recent-view-uimanager.h"
EV_CHROME_MENUBAR = 1 << 0,
EV_CHROME_TOOLBAR = 1 << 1,
EV_CHROME_FINDBAR = 1 << 2,
- EV_CHROME_STATUSBAR = 1 << 3,
- EV_CHROME_RAISE_TOOLBAR = 1 << 4,
- EV_CHROME_NORMAL = EV_CHROME_MENUBAR | EV_CHROME_TOOLBAR | EV_CHROME_STATUSBAR
+ EV_CHROME_RAISE_TOOLBAR = 1 << 3,
+ EV_CHROME_NORMAL = EV_CHROME_MENUBAR | EV_CHROME_TOOLBAR
} EvChrome;
struct _EvWindowPrivate {
GtkWidget *view;
GtkWidget *page_view;
GtkWidget *password_view;
- GtkWidget *statusbar;
GtkWidget *sidebar_thumbs;
GtkWidget *sidebar_links;
#define ZOOM_CONTROL_ACTION "ViewZoom"
#define GCONF_CHROME_TOOLBAR "/apps/evince/show_toolbar"
-#define GCONF_CHROME_STATUSBAR "/apps/evince/show_statusbar"
#define GCONF_LOCKDOWN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk"
#define GCONF_LOCKDOWN_PRINT "/desktop/gnome/lockdown/disable_printing"
update_chrome_visibility (EvWindow *window)
{
EvWindowPrivate *priv = window->priv;
- gboolean menubar, toolbar, findbar, statusbar, fullscreen_toolbar;
+ gboolean menubar, toolbar, findbar, fullscreen_toolbar;
gboolean fullscreen_mode, presentation, fullscreen;
presentation = ev_view_get_presentation (EV_VIEW (priv->view));
(priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && !fullscreen_mode;
fullscreen_toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 ||
(priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0);
- statusbar = (priv->chrome & EV_CHROME_STATUSBAR) != 0 && !fullscreen_mode;
findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
set_widget_visibility (priv->menubar, menubar);
set_action_sensitive (window, "EditToolbar", toolbar);
set_widget_visibility (priv->find_bar, findbar);
- set_widget_visibility (priv->statusbar, statusbar);
if (priv->fullscreen_popup != NULL) {
if (fullscreen)
ev_job_queue_add_job (ev_window->priv->load_job, EV_JOB_PRIORITY_HIGH);
- ev_statusbar_push (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_PROGRESS,
- _("Loading document. Please wait"));
-
- ev_statusbar_set_progress (EV_STATUSBAR (ev_window->priv->statusbar),
- TRUE);
-
gtk_widget_destroy (password_dialog);
g_object_unref (document);
g_assert (document != ev_window->priv->document);
g_assert (job->uri);
- ev_statusbar_pop (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_PROGRESS);
-
- ev_statusbar_set_progress (EV_STATUSBAR (ev_window->priv->statusbar),
- FALSE);
-
if (ev_window->priv->password_document) {
g_object_unref (ev_window->priv->password_document);
ev_window->priv->password_document = NULL;
if (job->error != NULL) {
- ev_statusbar_pop (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_PROGRESS);
- ev_statusbar_set_progress (EV_STATUSBAR (ev_window->priv->statusbar),
- FALSE);
-
unable_to_load (ev_window, job->error->message);
ev_window_clear_jobs (ev_window);
} else {
G_CALLBACK (ev_window_xfer_job_cb),
ev_window);
ev_job_queue_add_job (ev_window->priv->xfer_job, EV_JOB_PRIORITY_HIGH);
-
- ev_statusbar_push (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_PROGRESS,
- _("Loading document. Please wait"));
- ev_statusbar_set_progress (EV_STATUSBAR (ev_window->priv->statusbar),
- TRUE);
}
static void
}
}
-static gboolean
-ev_window_state_event (GtkWidget *widget, GdkEventWindowState *event)
-{
- EvWindow *window = EV_WINDOW (widget);
-
- if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
- gboolean maximized;
-
- maximized = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) == 0;
-
- ev_statusbar_set_maximized (EV_STATUSBAR (window->priv->statusbar),
- maximized);
- }
-
- return FALSE;
-}
-
static gboolean
ev_window_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
{
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
-static void
-ev_window_view_statusbar_cb (GtkAction *action, EvWindow *ev_window)
-{
- update_chrome_flag (ev_window, EV_CHROME_STATUSBAR,
- GCONF_CHROME_STATUSBAR,
- gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
-}
-
static void
ev_window_view_sidebar_cb (GtkAction *action, EvWindow *ev_window)
{
}
}
-static void
-menu_item_select_cb (GtkMenuItem *proxy, EvWindow *ev_window)
-{
- GtkAction *action;
- char *message;
-
- action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
- g_return_if_fail (action != NULL);
-
- g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
- if (message) {
- ev_statusbar_push (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_VIEW, message);
- g_free (message);
- }
-}
-
-static void
-menu_item_deselect_cb (GtkMenuItem *proxy, EvWindow *ev_window)
-{
- ev_statusbar_pop (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_VIEW);
-}
-
-static void
-connect_proxy_cb (GtkUIManager *ui_manager, GtkAction *action,
- GtkWidget *proxy, EvWindow *ev_window)
-{
- if (GTK_IS_MENU_ITEM (proxy)) {
- g_signal_connect (proxy, "select",
- G_CALLBACK (menu_item_select_cb), ev_window);
- g_signal_connect (proxy, "deselect",
- G_CALLBACK (menu_item_deselect_cb),
- ev_window);
- }
-}
-
-static void
-disconnect_proxy_cb (GtkUIManager *ui_manager, GtkAction *action,
- GtkWidget *proxy, EvWindow *ev_window)
-{
- if (GTK_IS_MENU_ITEM (proxy)) {
- g_signal_handlers_disconnect_by_func
- (proxy, G_CALLBACK (menu_item_select_cb), ev_window);
- g_signal_handlers_disconnect_by_func
- (proxy, G_CALLBACK (menu_item_deselect_cb), ev_window);
- }
-}
-
-static void
-view_status_changed_cb (EvView *view,
- GParamSpec *pspec,
- EvWindow *ev_window)
-{
- const char *message;
-
- ev_statusbar_pop (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_HELP);
-
- message = ev_view_get_status (view);
- if (message) {
- ev_statusbar_push (EV_STATUSBAR (ev_window->priv->statusbar),
- EV_CONTEXT_HELP, message);
- }
-}
-
static void
view_find_status_changed_cb (EvView *view,
GParamSpec *pspec,
g_object_class->dispose = ev_window_dispose;
g_object_class->finalize = ev_window_finalize;
- widget_class->window_state_event = ev_window_state_event;
widget_class->focus_in_event = ev_window_focus_in_event;
widget_class->focus_out_event = ev_window_focus_out_event;
{ "ViewToolbar", NULL, N_("_Toolbar"), "<shift><control>T",
N_("Show or hide the toolbar"),
G_CALLBACK (ev_window_view_toolbar_cb), TRUE },
- { "ViewStatusbar", NULL, N_("_Statusbar"), NULL,
- N_("Show or hide the statusbar"),
- G_CALLBACK (ev_window_view_statusbar_cb), TRUE },
{ "ViewSidebar", NULL, N_("Side _Pane"), "F9",
N_("Show or hide the side pane"),
G_CALLBACK (ev_window_view_sidebar_cb), TRUE },
(priv->chrome & EV_CHROME_TOOLBAR) != 0);
g_signal_handlers_unblock_by_func
(action, G_CALLBACK (ev_window_view_toolbar_cb), window);
-
- action= gtk_action_group_get_action (action_group, "ViewStatusbar");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_view_statusbar_cb), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- (priv->chrome & EV_CHROME_STATUSBAR) != 0);
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_view_statusbar_cb), window);
}
static EvChrome
gconf_value_free (value);
}
- value = gconf_client_get (client, GCONF_CHROME_STATUSBAR, NULL);
- if (value != NULL) {
- if (value->type == GCONF_VALUE_BOOL && !gconf_value_get_bool (value)) {
- chrome &= ~EV_CHROME_STATUSBAR;
- }
- gconf_value_free (value);
- }
-
g_object_unref (client);
return chrome;
ev_window_set_view_accels_sensitivity (ev_window, FALSE);
- g_signal_connect (ev_window->priv->ui_manager, "connect_proxy",
- G_CALLBACK (connect_proxy_cb), ev_window);
- g_signal_connect (ev_window->priv->ui_manager, "disconnect_proxy",
- G_CALLBACK (disconnect_proxy_cb), ev_window);
-
if (!gtk_ui_manager_add_ui_from_file (ev_window->priv->ui_manager,
DATADIR"/evince-ui.xml",
&error)) {
"notify::find-status",
G_CALLBACK (view_find_status_changed_cb),
ev_window);
- g_signal_connect (ev_window->priv->view,
- "notify::status",
- G_CALLBACK (view_status_changed_cb),
- ev_window);
g_signal_connect (ev_window->priv->view,
"notify::sizing-mode",
G_CALLBACK (ev_window_sizing_mode_changed_cb),
G_CALLBACK (ev_window_rotation_changed_cb),
ev_window);
- ev_window->priv->statusbar = ev_statusbar_new ();
- gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
- ev_window->priv->statusbar,
- FALSE, TRUE, 0);
-
ev_window->priv->find_bar = egg_find_bar_new ();
gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
ev_window->priv->find_bar,