From 4592bb6927a5a7017403fbcaa4937aa10c263227 Mon Sep 17 00:00:00 2001 From: Mario Sanchez Prada Date: Fri, 9 Apr 2010 19:37:09 +0200 Subject: Change sensitiveness for history buttons when clearing the history Connect to the 'cleared' signal and change the sensitivity flags Bug #539716 Signed-off-by: Xan Lopez --- src/ephy-action-helper.h | 5 +++++ src/ephy-navigation-history-action.c | 15 +++++++++++++++ src/ephy-toolbar.c | 5 ----- 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ephy-action-helper.h b/src/ephy-action-helper.h index 331d0fc1b..71c0bbcfa 100644 --- a/src/ephy-action-helper.h +++ b/src/ephy-action-helper.h @@ -28,6 +28,11 @@ G_BEGIN_DECLS +enum +{ + SENS_FLAG = 1 << 0 +}; + void ephy_action_change_sensitivity_flags (GtkAction *action, guint flags, gboolean set); diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c index 90345b2e6..c82f04c34 100644 --- a/src/ephy-navigation-history-action.c +++ b/src/ephy-navigation-history-action.c @@ -23,6 +23,7 @@ #include "config.h" #include "ephy-navigation-history-action.h" +#include "ephy-action-helper.h" #include "ephy-debug.h" #include "ephy-embed-container.h" #include "ephy-embed-shell.h" @@ -133,6 +134,13 @@ deselect_menu_item_cb (GtkWidget *menuitem, gtk_statusbar_pop (GTK_STATUSBAR (statusbar), statusbar_cid); } +static void +ephy_history_cleared_cb (EphyHistory *history, + EphyNavigationHistoryAction *action) +{ + ephy_action_change_sensitivity_flags (GTK_ACTION (action), SENS_FLAG, TRUE); +} + static GList* webkit_construct_history_list (WebKitWebView *web_view, WebKitHistoryType hist_type) { @@ -283,6 +291,10 @@ ephy_navigation_history_action_init (EphyNavigationHistoryAction *action) history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); action->priv->history = EPHY_HISTORY (g_object_ref (history)); + + g_signal_connect (action->priv->history, + "cleared", G_CALLBACK (ephy_history_cleared_cb), + action); } static void @@ -290,6 +302,9 @@ ephy_navigation_history_action_finalize (GObject *object) { EphyNavigationHistoryAction *action = EPHY_NAVIGATION_HISTORY_ACTION (object); + g_signal_handlers_disconnect_by_func (action->priv->history, + ephy_history_cleared_cb, + action); g_object_unref (action->priv->history); action->priv->history = NULL; diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c index c82b93276..c3f0ed7f0 100644 --- a/src/ephy-toolbar.c +++ b/src/ephy-toolbar.c @@ -63,11 +63,6 @@ enum LAST_ACTION }; -enum -{ - SENS_FLAG = 1 << 0 -}; - #define EPHY_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBAR, EphyToolbarPrivate)) struct _EphyToolbarPrivate -- cgit v1.2.3