[anjuta] git: Simplify the Create Branch pane
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] git: Simplify the Create Branch pane
- Date: Fri, 28 Jan 2011 08:12:50 +0000 (UTC)
commit 053dc361c3cad58c9822b25e3ddad91717fc47b3
Author: James Liggett <jrliggett cox net>
Date: Fri Jan 28 00:01:28 2011 -0800
git: Simplify the Create Branch pane
The radio buttons for revisions aren't really needed anymore; just the drop
entry alone should be enough.
plugins/git/anjuta-git.ui | 66 ++++-----------------------------
plugins/git/git-create-branch-pane.c | 51 ++++----------------------
plugins/git/git-create-branch-pane.h | 1 +
3 files changed, 17 insertions(+), 101 deletions(-)
---
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index 87fbc16..665de62 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
<!-- interface-requires anjuta 0.0 -->
+ <requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkVBox" id="add_pane">
<property name="visible">True</property>
@@ -1081,64 +1081,14 @@
<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>
- <signal name="toggled" handler="on_repository_head_radio_toggled" swapped="no"/>
- </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="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">repository_head_radio</property>
- <signal name="toggled" handler="on_revision_radio_toggled" swapped="no"/>
- </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="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â??</property>
+ <property name="invisible_char_set">True</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-branch-pane.c b/plugins/git/git-create-branch-pane.c
index 959587b..9cbd860 100644
--- a/plugins/git/git-create-branch-pane.c
+++ b/plugins/git/git-create-branch-pane.c
@@ -31,24 +31,20 @@ on_ok_button_clicked (GtkButton *button, GitCreateBranchPane *self)
{
Git *plugin;
GtkEntry *name_entry;
- GtkToggleButton *revision_radio;
- GtkEntry *revision_entry;
+ AnjutaEntry *revision_entry;
GtkToggleButton *checkout_check;
gchar *name;
- gchar *revision;
+ const gchar *revision;
GitBranchCreateCommand *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"));
checkout_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
"checkout_check"));
name = gtk_editable_get_chars (GTK_EDITABLE (name_entry), 0, -1);
- revision = NULL;
if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell),
GTK_WIDGET (name_entry), name,
@@ -59,22 +55,11 @@ on_ok_button_clicked (GtkButton *button, GitCreateBranchPane *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;
- }
- }
+ revision = anjuta_entry_get_text (revision_entry);
+ if (g_utf8_strlen (revision, -1) == 0)
+ revision = NULL;
+
create_command = git_branch_create_command_new (plugin->project_root_directory,
name,
revision,
@@ -93,24 +78,11 @@ on_ok_button_clicked (GtkButton *button, GitCreateBranchPane *self)
g_free (name);
- g_free (revision);
git_pane_remove_from_dock (GIT_PANE (self));
}
static void
-on_revision_radio_toggled (GtkToggleButton *button, GitCreateBranchPane *self)
-{
- GtkWidget *revision_entry;
-
- revision_entry = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
- "revision_entry"));
-
- gtk_widget_set_sensitive (revision_entry,
- gtk_toggle_button_get_active (button));
-}
-
-static void
git_create_branch_pane_init (GitCreateBranchPane *self)
{
gchar *objects[] = {"create_branch_pane",
@@ -118,7 +90,6 @@ git_create_branch_pane_init (GitCreateBranchPane *self)
GError *error = NULL;
GtkWidget *ok_button;
GtkWidget *cancel_button;
- GtkWidget *revision_radio;
self->priv = g_new0 (GitCreateBranchPanePriv, 1);
self->priv->builder = gtk_builder_new ();
@@ -135,8 +106,6 @@ git_create_branch_pane_init (GitCreateBranchPane *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"));
g_signal_connect (G_OBJECT (ok_button), "clicked",
G_CALLBACK (on_ok_button_clicked),
@@ -145,10 +114,6 @@ git_create_branch_pane_init (GitCreateBranchPane *self)
g_signal_connect_swapped (G_OBJECT (cancel_button), "clicked",
G_CALLBACK (git_pane_remove_from_dock),
self);
-
- g_signal_connect (G_OBJECT (revision_radio), "toggled",
- G_CALLBACK (on_revision_radio_toggled),
- self);
}
static void
diff --git a/plugins/git/git-create-branch-pane.h b/plugins/git/git-create-branch-pane.h
index 1e08e3f..bfa0626 100644
--- a/plugins/git/git-create-branch-pane.h
+++ b/plugins/git/git-create-branch-pane.h
@@ -21,6 +21,7 @@
#define _GIT_CREATE_BRANCH_PANE_H_
#include <glib-object.h>
+#include <libanjuta/anjuta-entry.h>
#include "git-pane.h"
#include "plugin.h"
#include "git-branch-create-command.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]