diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-03-07 22:44:51 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-03-08 00:14:10 +0800 |
commit | 5596d5fb76a9d39ad3ea78e613ad9058a5ed948c (patch) | |
tree | 557c7efbde63f32aab16be8be77fcb9614518921 | |
parent | 5d2779a4aa7e8fd9736a9d828bdabe9554b9e008 (diff) | |
download | gsoc2013-epiphany-5596d5fb76a9d39ad3ea78e613ad9058a5ed948c.tar gsoc2013-epiphany-5596d5fb76a9d39ad3ea78e613ad9058a5ed948c.tar.gz gsoc2013-epiphany-5596d5fb76a9d39ad3ea78e613ad9058a5ed948c.tar.bz2 gsoc2013-epiphany-5596d5fb76a9d39ad3ea78e613ad9058a5ed948c.tar.lz gsoc2013-epiphany-5596d5fb76a9d39ad3ea78e613ad9058a5ed948c.tar.xz gsoc2013-epiphany-5596d5fb76a9d39ad3ea78e613ad9058a5ed948c.tar.zst gsoc2013-epiphany-5596d5fb76a9d39ad3ea78e613ad9058a5ed948c.zip |
ephy-hosts-view: add a method to select a given host
https://bugzilla.gnome.org/show_bug.cgi?id=671559
-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 |