aboutsummaryrefslogtreecommitdiffstats
path: root/src/ppview-toolbar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ppview-toolbar.c')
-rwxr-xr-xsrc/ppview-toolbar.c68
1 files changed, 39 insertions, 29 deletions
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index fea06c2d7..78b3b33d9 100755
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -33,11 +33,6 @@
#include <gtk/gtkentry.h>
#include <gtk/gtkmenu.h>
-#define PPV_GOTO_FIRST_PATH "/commands/PPVGotoFirst"
-#define PPV_GOTO_LAST_PATH "/commands/PPVGotoLast"
-#define PPV_GO_BACK_PATH "/commands/PPVGoBack"
-#define PPV_GO_FORWARD_PATH "/commands/PPVGoForward"
-
static void ppview_toolbar_class_init (PPViewToolbarClass *klass);
static void ppview_toolbar_init (PPViewToolbar *t);
static void ppview_toolbar_finalize (GObject *object);
@@ -64,6 +59,7 @@ static GObjectClass *parent_class = NULL;
struct PPViewToolbarPrivate
{
EphyWindow *window;
+ EmbedChromeMask original_mask;
EggMenuMerge *ui_merge;
EggActionGroup *action_group;
guint ui_id;
@@ -208,6 +204,31 @@ ppview_toolbar_get_property (GObject *object,
}
static void
+toolbar_update_sensitivity (PPViewToolbar *t)
+{
+ int pages, c_page;
+ EphyWindow *window = t->priv->window;
+ EphyEmbed *embed;
+ EggAction *action;
+ EggActionGroup *action_group = t->priv->action_group;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ ephy_embed_print_preview_num_pages (embed, &pages);
+ c_page = t->priv->current_page;
+
+ action = egg_action_group_get_action (action_group, "PPVGoBack");
+ g_object_set (action, "sensitive", c_page > 1, NULL);
+ action = egg_action_group_get_action (action_group, "PPVGotoFirst");
+ g_object_set (action, "sensitive", c_page > 1, NULL);
+ action = egg_action_group_get_action (action_group, "PPVGoForward");
+ g_object_set (action, "sensitive", c_page < pages, NULL);
+ action = egg_action_group_get_action (action_group, "PPVGotoLast");
+ g_object_set (action, "sensitive", c_page < pages, NULL);
+}
+
+static void
ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window)
{
g_return_if_fail (t->priv->window == NULL);
@@ -215,12 +236,16 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window)
t->priv->window = window;
t->priv->ui_merge = EGG_MENU_MERGE (t->priv->window->ui_merge);
+ t->priv->original_mask = ephy_window_get_chrome (window);
+
t->priv->action_group = egg_action_group_new ("PPViewActions");
egg_action_group_add_actions (t->priv->action_group, entries, n_entries);
egg_menu_merge_insert_action_group (t->priv->ui_merge,
t->priv->action_group, 0);
t->priv->ui_id = egg_menu_merge_add_ui_from_string
(t->priv->ui_merge, ui_info, -1, NULL);
+
+ toolbar_update_sensitivity (t);
}
static void
@@ -273,30 +298,6 @@ ppview_toolbar_new (EphyWindow *window)
}
static void
-toolbar_update_sensitivity (PPViewToolbar *t)
-{
- int pages, c_page;
- EphyWindow *window = t->priv->window;
- EphyEmbed *embed;
-
- embed = ephy_window_get_active_embed (window);
- g_return_if_fail (embed != NULL);
-
- ephy_embed_print_preview_num_pages (embed, &pages);
- c_page = t->priv->current_page;
-/*
- ephy_bonobo_set_sensitive (t->priv->ui_component,
- PPV_GO_BACK_PATH, c_page > 1);
- ephy_bonobo_set_sensitive (t->priv->ui_component,
- PPV_GOTO_FIRST_PATH, c_page > 1);
- ephy_bonobo_set_sensitive (t->priv->ui_component,
- PPV_GO_FORWARD_PATH, c_page < pages);
- ephy_bonobo_set_sensitive (t->priv->ui_component,
- PPV_GOTO_LAST_PATH, c_page < pages);
- */
-}
-
-static void
toolbar_cmd_ppv_goto_first (EggMenuMerge *merge,
PPViewToolbar *t)
{
@@ -375,5 +376,14 @@ static void
toolbar_cmd_ppv_close (EggMenuMerge *merge,
PPViewToolbar *t)
{
+ EphyWindow *window = t->priv->window;
+ EphyEmbed *embed;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
+
+ ephy_window_set_chrome (t->priv->window, t->priv->original_mask);
+
+ ephy_embed_print_preview_close (embed);
}