[anjuta] git: Simplify the Create Tag pane



commit 8ed4344227949a82bdfb5d797ab981b17713a211
Author: James Liggett <jrliggett cox net>
Date:   Sat Jan 29 16:04:33 2011 -0800

    git: Simplify the Create Tag pane

 plugins/git/anjuta-git.ui         |   60 ++++---------------------------------
 plugins/git/git-create-tag-pane.c |   39 ++++-------------------
 plugins/git/git-create-tag-pane.h |    1 +
 3 files changed, 14 insertions(+), 86 deletions(-)
---
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index 665de62..b42bc53 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -1251,61 +1251,13 @@
                 <property name="can_focus">False</property>
                 <property name="left_padding">12</property>
                 <child>
-                  <object class="GtkVBox" id="vbox2">
+                  <object class="AnjutaDropEntry" id="revision_entry">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkRadioButton" id="repository_head_radio">
-                        <property name="label" translatable="yes">Repository head</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkRadioButton" id="revision_radio">
-                        <property name="label" translatable="yes">Revision:</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="draw_indicator">True</property>
-                        <property name="group">repository_head_radio</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkAlignment" id="alignment3">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="left_padding">12</property>
-                        <child>
-                          <object class="AnjutaDropEntry" id="revision_entry">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">True</property>
-                            <property name="invisible_char">â??</property>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">â?¢</property>
+                    <property name="text" translatable="yes">Repository head; Drop or type a different revision here</property>
+                    <property name="secondary_icon_stock">gtk-clear</property>
+                    <property name="help_text">Repository head; Drop or type a different revision here</property>
                   </object>
                 </child>
               </object>
diff --git a/plugins/git/git-create-tag-pane.c b/plugins/git/git-create-tag-pane.c
index 3b8c944..780e65e 100644
--- a/plugins/git/git-create-tag-pane.c
+++ b/plugins/git/git-create-tag-pane.c
@@ -31,24 +31,21 @@ on_ok_button_clicked (GtkButton *button, GitCreateTagPane *self)
 {
 	Git *plugin;
 	GtkEntry *name_entry;
-	GtkToggleButton *revision_radio;
-	GtkEntry *revision_entry;
+	AnjutaEntry *revision_entry;
 	GtkToggleButton *force_check;
 	GtkToggleButton *sign_check;
 	GtkToggleButton *annotate_check;
 	AnjutaColumnTextView *log_view;
 	gchar *name;
-	gchar *revision;
+	const gchar *revision;
 	gchar *log;
 	GitTagCreateCommand *create_command;
 
 	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
 	name_entry = GTK_ENTRY (gtk_builder_get_object (self->priv->builder,
 	                                                "name_entry"));
-	revision_radio = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
-	                                                            "revision_radio"));
-	revision_entry = GTK_ENTRY (gtk_builder_get_object (self->priv->builder,
-	                                                    "revision_entry"));
+	revision_entry = ANJUTA_ENTRY (gtk_builder_get_object (self->priv->builder,
+	                                                       "revision_entry"));
 	force_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
 	                                                         "force_check"));
 	sign_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
@@ -58,7 +55,7 @@ on_ok_button_clicked (GtkButton *button, GitCreateTagPane *self)
 	log_view = ANJUTA_COLUMN_TEXT_VIEW (gtk_builder_get_object (self->priv->builder,
 	                                                            "log_view"));
 	name = gtk_editable_get_chars (GTK_EDITABLE (name_entry), 0, -1);
-	revision = NULL;
+	revision = anjuta_entry_get_text (revision_entry);
 	log = NULL;
 
 	if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell),
@@ -70,21 +67,8 @@ on_ok_button_clicked (GtkButton *button, GitCreateTagPane *self)
 		return;
 	}
 
-	if (gtk_toggle_button_get_active (revision_radio))
-	{
-		revision = gtk_editable_get_chars (GTK_EDITABLE (revision_entry), 0, 
-		                                   -1);
-
-		if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell),
-		                           GTK_WIDGET (revision_entry), revision,
-		                           _("Please enter a revision.")))
-		{
-			g_free (name);
-			g_free (revision);
-
-			return;
-		}
-	}
+	if (g_utf8_strlen (revision, -1) == 0)
+		revision = NULL;
 
 	if (gtk_toggle_button_get_active (annotate_check))
 	{
@@ -95,7 +79,6 @@ on_ok_button_clicked (GtkButton *button, GitCreateTagPane *self)
 		                           _("Please enter a log message.")))
 		{
 			g_free (name);
-			g_free (revision);
 			g_free (log);
 
 			return;
@@ -122,7 +105,6 @@ on_ok_button_clicked (GtkButton *button, GitCreateTagPane *self)
 
 
 	g_free (name);
-	g_free (revision);
 	g_free (log);
 
 	git_pane_remove_from_dock (GIT_PANE (self));
@@ -143,7 +125,6 @@ git_create_tag_pane_init (GitCreateTagPane *self)
 	GError *error = NULL;
 	GtkWidget *ok_button;
 	GtkWidget *cancel_button;
-	GtkWidget *revision_radio;
 	GtkWidget *revision_entry;
 	GtkWidget *annotate_check;
 	GtkWidget *log_view;
@@ -164,8 +145,6 @@ git_create_tag_pane_init (GitCreateTagPane *self)
 	                                                "ok_button"));
 	cancel_button = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, 
 	                                                    "cancel_button"));
-	revision_radio = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
-	                                                     "revision_radio"));
 	revision_entry = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
 	                                                     "revision_entry"));
 	annotate_check = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
@@ -181,10 +160,6 @@ git_create_tag_pane_init (GitCreateTagPane *self)
 	                          G_CALLBACK (git_pane_remove_from_dock),
 	                          self);
 
-	g_signal_connect (G_OBJECT (revision_radio), "toggled",
-	                  G_CALLBACK (set_widget_sensitive),
-	                  revision_entry);
-
 	g_signal_connect (G_OBJECT (annotate_check), "toggled",
 	                  G_CALLBACK (set_widget_sensitive),
 	                  log_view);
diff --git a/plugins/git/git-create-tag-pane.h b/plugins/git/git-create-tag-pane.h
index 8404ee9..2f5c609 100644
--- a/plugins/git/git-create-tag-pane.h
+++ b/plugins/git/git-create-tag-pane.h
@@ -21,6 +21,7 @@
 #define _GIT_CREATE_TAG_PANE_H_
 
 #include <glib-object.h>
+#include <libanjuta/anjuta-entry.h>
 #include <libanjuta/anjuta-column-text-view.h>
 #include "git-pane.h"
 #include "plugin.h"



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