[anjuta/git-shell] git: Make GitRepositorySelector focusable



commit de0a7d32d2e508933e440b3b09330bd88bada4a3
Author: James Liggett <jrliggett cox net>
Date:   Tue Jul 6 20:57:59 2010 -0700

    git: Make GitRepositorySelector focusable
    
    The widget just gives the focus to the URL entry, swithing the page if needed.

 plugins/git/git-repository-selector.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/plugins/git/git-repository-selector.c b/plugins/git/git-repository-selector.c
index d7240bc..dae6f2a 100644
--- a/plugins/git/git-repository-selector.c
+++ b/plugins/git/git-repository-selector.c
@@ -123,6 +123,9 @@ git_repository_selector_init (GitRepositorySelector *self)
 	/* Set the selected repository label to a resonable default. */
 	git_repository_selector_set_remote (self, NULL);
 
+	/* Allow focusing */
+	gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
+
 	gtk_widget_show_all (GTK_WIDGET (self));
 }
 
@@ -140,11 +143,28 @@ git_repository_selector_finalize (GObject *object)
 }
 
 static void
+git_repository_selector_grab_focus (GtkWidget *widget)
+{
+	GitRepositorySelector *self;
+
+	self = GIT_REPOSITORY_SELECTOR (widget);
+
+	GTK_WIDGET_CLASS (git_repository_selector_parent_class)->grab_focus (widget);
+
+	/* Only the URL entry can grab focus */
+	gtk_notebook_set_page (GTK_NOTEBOOK (self->priv->notebook), 
+	                       GIT_REPOSITORY_SELECTOR_URL);
+	gtk_widget_grab_focus (self->priv->url_entry);
+}
+
+static void
 git_repository_selector_class_init (GitRepositorySelectorClass *klass)
 {
-	GObjectClass* object_class = G_OBJECT_CLASS (klass);;
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
 	object_class->finalize = git_repository_selector_finalize;
+	widget_class->grab_focus = git_repository_selector_grab_focus;
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]