[anjuta/git-shell] git: Add selection handling to the Remotes pane
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/git-shell] git: Add selection handling to the Remotes pane
- Date: Tue, 6 Jul 2010 02:05:16 +0000 (UTC)
commit 700b3d9277da0367938e8e07cb1f4b1493c7054d
Author: James Liggett <jrliggett cox net>
Date: Sat Jun 26 15:51:43 2010 -0700
git: Add selection handling to the Remotes pane
plugins/git/git-remotes-pane.c | 42 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/plugins/git/git-remotes-pane.c b/plugins/git/git-remotes-pane.c
index 639fa60..20b2389 100644
--- a/plugins/git/git-remotes-pane.c
+++ b/plugins/git/git-remotes-pane.c
@@ -26,6 +26,18 @@ struct _GitRemotesPanePriv
G_DEFINE_TYPE (GitRemotesPane, git_remotes_pane, GIT_TYPE_PANE);
+static gboolean
+on_remote_selected (GtkTreeSelection *selection, GtkTreeModel *model,
+ GtkTreePath *path, GtkTreeIter *iter,
+ gboolean path_currently_selected,
+ AnjutaDockPane *pane)
+{
+ if (!path_currently_selected)
+ anjuta_dock_pane_notify_single_selection_changed (pane);
+
+ return TRUE;
+}
+
static void
git_remotes_pane_init (GitRemotesPane *self)
{
@@ -33,6 +45,8 @@ git_remotes_pane_init (GitRemotesPane *self)
"remotes_list_model",
NULL};
GError *error = NULL;
+ GtkTreeView *remotes_view;
+ GtkTreeSelection *selection;
self->priv = g_new0 (GitRemotesPanePriv, 1);
self->priv->builder = gtk_builder_new ();
@@ -44,6 +58,15 @@ git_remotes_pane_init (GitRemotesPane *self)
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
}
+
+ remotes_view = GTK_TREE_VIEW (gtk_builder_get_object (self->priv->builder,
+ "remotes_view"));
+ selection = gtk_tree_view_get_selection (remotes_view);
+
+
+ gtk_tree_selection_set_select_function (selection,
+ (GtkTreeSelectionFunc) on_remote_selected,
+ self, NULL);
}
static void
@@ -130,5 +153,22 @@ git_remotes_pane_new (Git *plugin)
gchar *
git_remotes_pane_get_selected_remote (GitRemotesPane *self)
{
- return NULL;
+ GtkTreeView *remotes_view;
+ GtkTreeSelection *selection;
+ GtkTreeModel *remotes_list_model;
+ gchar *remote;
+ GtkTreeIter iter;
+
+ remotes_view = GTK_TREE_VIEW (gtk_builder_get_object (self->priv->builder,
+ "remotes_view"));
+ selection = gtk_tree_view_get_selection (remotes_view);
+ remote = NULL;
+
+ if (gtk_tree_selection_get_selected (selection, &remotes_list_model,
+ &iter))
+ {
+ gtk_tree_model_get (remotes_list_model, &iter, 0, &remote, -1);
+ }
+
+ return remote;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]