Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-navigation-action.c
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2007-05-09 15:02:09 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2007-05-09 15:02:09 (GMT)
commit33bf66b8f4e2d719c847af1c177c71b5173b49aa (patch)
tree1399e2680d54cb494e145028b28afb1dde2af501 /shell/ev-navigation-action.c
parenta6368109ee6bbc2fa76ddc4ee50acf02ea755693 (diff)
Make navigation action unsensitive instead of showing menu with
2007-05-09 Nickolay V. Shmyrev <nshmyrev@yandex.ru> * shell/ev-history.c: (ev_history_class_init), (ev_history_add_link): * shell/ev-history.h: * shell/ev-navigation-action.c: (ev_navigation_action_history_changed), (ev_navigation_action_set_history), (build_menu), (ev_navigation_action_finalize): * shell/ev-window.c: (ev_window_setup_action_sensitivity): Make navigation action unsensitive instead of showing menu with unsensitive word. svn path=/trunk/; revision=2443
Diffstat (limited to 'shell/ev-navigation-action.c')
-rw-r--r--shell/ev-navigation-action.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/shell/ev-navigation-action.c b/shell/ev-navigation-action.c
index dd4e38e..9da89f9 100644
--- a/shell/ev-navigation-action.c
+++ b/shell/ev-navigation-action.c
@@ -54,6 +54,17 @@ G_DEFINE_TYPE (EvNavigationAction, ev_navigation_action, GTK_TYPE_ACTION)
#define EV_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_NAVIGATION_ACTION, EvNavigationActionPrivate))
+static void
+ev_navigation_action_history_changed (EvHistory *history,
+ gpointer data)
+{
+ EvNavigationAction *action = EV_NAVIGATION_ACTION (data);
+
+ gtk_action_set_sensitive (action, ev_history_get_n_links (history) > 0);
+
+ return;
+}
+
void
ev_navigation_action_set_history (EvNavigationAction *action,
EvHistory *history)
@@ -62,6 +73,10 @@ ev_navigation_action_set_history (EvNavigationAction *action,
g_object_add_weak_pointer (G_OBJECT (action->priv->history),
(gpointer) &action->priv->history);
+
+ g_signal_connect_object (history, "changed",
+ ev_navigation_action_history_changed,
+ action, 0);
}
static void
@@ -111,18 +126,6 @@ new_history_menu_item (EvNavigationAction *action,
}
static GtkWidget *
-new_empty_history_menu_item (EvNavigationAction *action)
-{
- GtkWidget *item;
-
- item = gtk_image_menu_item_new_with_label (_("Empty"));
- gtk_widget_set_sensitive (item, FALSE);
- gtk_widget_show (item);
-
- return item;
-}
-
-static GtkWidget *
build_menu (EvNavigationAction *action)
{
GtkMenuShell *menu;
@@ -133,9 +136,7 @@ build_menu (EvNavigationAction *action)
menu = GTK_MENU_SHELL (gtk_menu_new ());
- if (history == NULL || ev_history_get_n_links (history) <= 0) {
- item = new_empty_history_menu_item (action);
- gtk_menu_shell_append (menu, item);
+ if (history == NULL) {
return GTK_WIDGET (menu);
}
@@ -218,8 +219,9 @@ ev_navigation_action_finalize (GObject *object)
EvNavigationAction *action = EV_NAVIGATION_ACTION (object);
if (action->priv->history) {
- g_object_add_weak_pointer (G_OBJECT (action->priv->history),
- (gpointer) &action->priv->history);
+ g_object_remove_weak_pointer (G_OBJECT (action->priv->history),
+ (gpointer) &action->priv->history);
+ action->priv->history = NULL;
}
G_OBJECT_CLASS (ev_navigation_action_parent_class)->finalize (object);