aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Sanchez Prada <msanchez@igalia.com>2010-04-10 01:37:09 +0800
committerXan Lopez <xan@gnome.org>2010-04-20 21:11:07 +0800
commit4592bb6927a5a7017403fbcaa4937aa10c263227 (patch)
tree4f5497e71b82f8fc64fa0e8913df427004853386
parentede59b054c4af72cc41108db8aedafbcae1996de (diff)
downloadgsoc2013-epiphany-4592bb6927a5a7017403fbcaa4937aa10c263227.tar.gz
gsoc2013-epiphany-4592bb6927a5a7017403fbcaa4937aa10c263227.tar.zst
gsoc2013-epiphany-4592bb6927a5a7017403fbcaa4937aa10c263227.zip
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 <xan@gnome.org>
-rw-r--r--src/ephy-action-helper.h5
-rw-r--r--src/ephy-navigation-history-action.c15
-rw-r--r--src/ephy-toolbar.c5
3 files changed, 20 insertions, 5 deletions
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