From 7cc9e4a8e9d7a9ae063005e27bca383687b3084e Mon Sep 17 00:00:00 2001 From: Claudio Saavedra Date: Wed, 7 Mar 2012 18:53:19 +0200 Subject: ephy-host-store: add a clear() method This adds always a default item "All sites" which, when selected, will show all urls in all hosts. https://bugzilla.gnome.org/show_bug.cgi?id=671575 --- lib/widgets/ephy-hosts-store.c | 13 +++++++++++++ lib/widgets/ephy-hosts-store.h | 1 + src/ephy-history-window.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/widgets/ephy-hosts-store.c b/lib/widgets/ephy-hosts-store.c index ed76072e6..99fff4833 100644 --- a/lib/widgets/ephy-hosts-store.c +++ b/lib/widgets/ephy-hosts-store.c @@ -20,8 +20,11 @@ */ #include "config.h" + #include "ephy-hosts-store.h" +#include + G_DEFINE_TYPE (EphyHostsStore, ephy_hosts_store, GTK_TYPE_LIST_STORE) static void @@ -99,3 +102,13 @@ ephy_hosts_store_get_host_from_path (EphyHostsStore *store, -1); return host; } + +void +ephy_hosts_store_clear (EphyHostsStore *store) +{ + gtk_list_store_clear (GTK_LIST_STORE (store)); + gtk_list_store_insert_with_values (GTK_LIST_STORE (store), NULL, 0, + EPHY_HOSTS_STORE_COLUMN_ID, 0, + EPHY_HOSTS_STORE_COLUMN_TITLE, _("All sites"), + -1); +} diff --git a/lib/widgets/ephy-hosts-store.h b/lib/widgets/ephy-hosts-store.h index 5b61902f3..40502e8a0 100644 --- a/lib/widgets/ephy-hosts-store.h +++ b/lib/widgets/ephy-hosts-store.h @@ -63,6 +63,7 @@ void ephy_hosts_store_add_hosts (EphyHostsStore *store, G void ephy_hosts_store_add_host (EphyHostsStore *store, EphyHistoryHost *host); void ephy_hosts_store_add_visits (EphyHostsStore *store, GList *visits); EphyHistoryHost* ephy_hosts_store_get_host_from_path (EphyHostsStore *store, GtkTreePath *path); +void ephy_hosts_store_clear (EphyHostsStore *store); G_END_DECLS diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 90f18b1f1..b4036228f 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -1037,7 +1037,7 @@ on_get_hosts_cb (gpointer service, hosts = (GList *) result_data; selected_host = get_selected_host (window); - gtk_list_store_clear (GTK_LIST_STORE (window->priv->hosts_store)); + ephy_hosts_store_clear (EPHY_HOSTS_STORE (window->priv->hosts_store)); ephy_hosts_store_add_hosts (window->priv->hosts_store, hosts); if (selected_host) { ephy_hosts_view_select_host (EPHY_HOSTS_VIEW (window->priv->hosts_view), -- cgit v1.2.3