diff options
-rw-r--r-- | lib/widgets/ephy-hosts-view.c | 32 | ||||
-rw-r--r-- | lib/widgets/ephy-hosts-view.h | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/lib/widgets/ephy-hosts-view.c b/lib/widgets/ephy-hosts-view.c index 7ed6b44da..b6c6e756a 100644 --- a/lib/widgets/ephy-hosts-view.c +++ b/lib/widgets/ephy-hosts-view.c @@ -53,3 +53,35 @@ ephy_hosts_view_new (void) return g_object_new (EPHY_TYPE_HOSTS_VIEW, NULL); } +gboolean +ephy_hosts_view_select_host (EphyHostsView *view, + EphyHistoryHost *host) +{ + GtkTreeModel *model; + GtkTreeIter iter; + gint id; + gboolean found = FALSE; + + g_return_val_if_fail (EPHY_IS_HOSTS_VIEW (view), FALSE); + g_return_val_if_fail (host != NULL, FALSE); + + model = gtk_tree_view_get_model (GTK_TREE_VIEW (view)); + + gtk_tree_model_get_iter_first (model, &iter); + do { + gtk_tree_model_get (model, &iter, + EPHY_HOSTS_STORE_COLUMN_ID, &id, + -1); + if (id == host->id) { + found = TRUE; + break; + } + } while (gtk_tree_model_iter_next (model, &iter)); + + if (found) { + gtk_tree_selection_select_iter ( + gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), &iter); + } + + return found; +} diff --git a/lib/widgets/ephy-hosts-view.h b/lib/widgets/ephy-hosts-view.h index 393ad4e8b..15abb5956 100644 --- a/lib/widgets/ephy-hosts-view.h +++ b/lib/widgets/ephy-hosts-view.h @@ -22,6 +22,7 @@ #ifndef _EPHY_HOSTS_VIEW_H #define _EPHY_HOSTS_VIEW_H +#include "ephy-history-types.h" #include "ephy-history-view.h" #include <gtk/gtk.h> @@ -51,6 +52,7 @@ struct _EphyHostsViewClass GType ephy_hosts_view_get_type (void) G_GNUC_CONST; GtkWidget *ephy_hosts_view_new (void); +gboolean ephy_hosts_view_select_host (EphyHostsView *view, EphyHistoryHost *host); G_END_DECLS |