[anjuta] git: add force option to push dialog



commit 62a5fef9c9317f819b428c4cc11b01fca0b74ff8
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Sat Sep 26 00:04:52 2009 +0200

    git: add force option to push dialog
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596381

 plugins/git/anjuta-git.ui      |   13 +++++++++++++
 plugins/git/git-push-command.c |    8 +++++++-
 plugins/git/git-push-command.h |    3 ++-
 plugins/git/git-push-dialog.c  |    6 +++++-
 4 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index 4e00036..a1dd510 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -4991,6 +4991,7 @@
                     <child>
                       <object class="GtkVBox" id="vbox29">
                         <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkCheckButton" id="push_all_check">
                             <property name="label" translatable="yes">Push all branches and tags</property>
@@ -5004,6 +5005,18 @@
                             <property name="position">0</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="push_force_check">
+                            <property name="label" translatable="yes">Force</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
                       </object>
                     </child>
                   </object>
diff --git a/plugins/git/git-push-command.c b/plugins/git/git-push-command.c
index b9b3196..f7894e5 100644
--- a/plugins/git/git-push-command.c
+++ b/plugins/git/git-push-command.c
@@ -30,6 +30,7 @@ struct _GitPushCommandPriv
 	GList *refs;
 	gboolean push_all;
 	gboolean push_tags;
+	gboolean force;
 };
 
 G_DEFINE_TYPE (GitPushCommand, git_push_command, GIT_TYPE_COMMAND);
@@ -68,6 +69,9 @@ git_push_command_run (AnjutaCommand *command)
 	
 	if (self->priv->push_tags)
 		git_command_add_arg (GIT_COMMAND (command), "--tags");
+
+	if (self->priv->force)
+		git_command_add_arg (GIT_COMMAND (command), "--force");
 	
 	git_command_add_arg (GIT_COMMAND (command), self->priv->url);
 
@@ -95,7 +99,8 @@ git_push_command_new (const gchar *working_directory,
 					  const gchar *url,
 					  GList *refs,
 					  gboolean push_all, 
-                      gboolean push_tags)
+                      gboolean push_tags,
+                      gboolean force)
 {
 	GitPushCommand *self;
 	
@@ -108,6 +113,7 @@ git_push_command_new (const gchar *working_directory,
 	self->priv->refs = git_command_copy_string_list (refs);
 	self->priv->push_all = push_all;
 	self->priv->push_tags = push_tags;
+	self->priv->force = force;
 	
 	return self;
 }
diff --git a/plugins/git/git-push-command.h b/plugins/git/git-push-command.h
index ee4a80e..fc7d613 100644
--- a/plugins/git/git-push-command.h
+++ b/plugins/git/git-push-command.h
@@ -58,7 +58,8 @@ GitPushCommand *git_push_command_new (const gchar *working_directory,
 									  const gchar *url,
 									  GList *refs,
 									  gboolean push_all, 
-                                      gboolean push_tags);
+                                      gboolean push_tags,
+                                      gboolean force);
 
 G_END_DECLS
 
diff --git a/plugins/git/git-push-dialog.c b/plugins/git/git-push-dialog.c
index 98d4abb..0625584 100644
--- a/plugins/git/git-push-dialog.c
+++ b/plugins/git/git-push-dialog.c
@@ -99,6 +99,7 @@ on_push_dialog_response (GtkDialog *dialog, gint response_id,
 	GtkWidget *push_url_entry;
 	GtkWidget *push_all_check;
 	GtkWidget *push_tags_check;
+	GtkWidget *push_force_check;
 	GtkTreeModel *remote_list_model;
 	GtkTreeModel *branch_list_model;
 	GtkTreeModel *tag_list_model;
@@ -129,6 +130,8 @@ on_push_dialog_response (GtkDialog *dialog, gint response_id,
 		                                                     "push_all_check"));
 		push_tags_check = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
 		                                                      "push_tags_check"));
+		push_force_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
+		                                                       "push_force_check"));
 		remote_list_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
 		                                                    		"remote_list_model"));
 		branch_list_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
@@ -189,7 +192,8 @@ on_push_dialog_response (GtkDialog *dialog, gint response_id,
 		                                     url,
 											 selected_refs,
 		                                     push_all_tags,
-		                                     push_all_refs);
+		                                     push_all_refs,
+		                                     gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (push_force_check)));
 		progress_data = git_progress_data_new (data->plugin, _("Git: Pushingâ?¦"));
 
 		g_free (url);



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