[Xfce4-commits] <midori:master> History panel buttons sensitive with selection
Christian Dywan
noreply at xfce.org
Sun Apr 17 22:56:02 CEST 2011
Updating branch refs/heads/master
to 5d372c116dd32bcc76fa07d8758ba84304f50128 (commit)
from 7c08b7cce58a52f6a133d6a197638d41045829fa (commit)
commit 5d372c116dd32bcc76fa07d8758ba84304f50128
Author: Tomasz Szatkowski <szatkus at gmail.com>
Date: Sun Apr 17 22:56:30 2011 +0200
History panel buttons sensitive with selection
Fixes: https://bugs.launchpad.net/midori/+bug/711482
panels/midori-bookmarks.c | 1 -
panels/midori-history.c | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c
index 40e13fc..adfe2cf 100644
--- a/panels/midori-bookmarks.c
+++ b/panels/midori-bookmarks.c
@@ -434,7 +434,6 @@ midori_bookmarks_delete_clicked_cb (GtkWidget* toolitem,
midori_bookmarks_remove_item_cb, bookmarks);
g_object_unref (item);
}
- midori_bookmarks_toolbar_update (bookmarks);
}
static GtkWidget*
diff --git a/panels/midori-history.c b/panels/midori-history.c
index f8f432b..d575e6e 100644
--- a/panels/midori-history.c
+++ b/panels/midori-history.c
@@ -155,6 +155,16 @@ midori_history_format_date (KatzeItem *item)
}
static void
+midori_history_toolbar_update (MidoriHistory *history)
+{
+ gboolean selected;
+
+ selected = katze_tree_view_get_selected_iter (
+ GTK_TREE_VIEW (history->treeview), NULL, NULL);
+ gtk_widget_set_sensitive (GTK_WIDGET (history->delete), selected);
+}
+
+static void
midori_history_remove_item_from_db (MidoriHistory* history,
KatzeItem* item)
{
@@ -370,6 +380,7 @@ midori_history_get_toolbar (MidoriViewable* viewable)
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
history->clear = GTK_WIDGET (toolitem);
+ midori_history_toolbar_update (history);
g_signal_connect (history->bookmark, "destroy",
G_CALLBACK (gtk_widget_destroyed), &history->bookmark);
g_signal_connect (history->delete, "destroy",
@@ -903,6 +914,12 @@ midori_history_filter_entry_clear_cb (GtkEntry* entry,
gtk_entry_set_text (entry, "");
}
+static void
+midori_history_selection_changed_cb (GtkTreeView* treeview,
+ MidoriHistory* history)
+{
+ midori_history_toolbar_update (history);
+}
static void
midori_history_init (MidoriHistory* history)
@@ -914,6 +931,7 @@ midori_history_init (MidoriHistory* history)
GtkTreeViewColumn* column;
GtkCellRenderer* renderer_pixbuf;
GtkCellRenderer* renderer_text;
+ GtkTreeSelection* selection;
/* Create the filter entry */
entry = gtk_icon_entry_new ();
@@ -968,6 +986,10 @@ midori_history_init (MidoriHistory* history)
"signal::popup-menu",
midori_history_popup_menu_cb, history,
NULL);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
+ g_signal_connect_after (selection, "changed",
+ G_CALLBACK (midori_history_selection_changed_cb),
+ history);
gtk_widget_show (treeview);
gtk_box_pack_start (GTK_BOX (history), treeview, TRUE, TRUE, 0);
history->treeview = treeview;
More information about the Xfce4-commits
mailing list