[anjuta] git: Add support for pushing out individual tags
- From: James Liggett <jrliggett src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta] git: Add support for pushing out individual tags
- Date: Thu, 9 Jul 2009 04:05:18 +0000 (UTC)
commit 611d42935656af956ab3bb87b516a9ba4e7deeb5
Author: James Liggett <jrliggett cox net>
Date: Wed Jul 8 21:04:11 2009 -0700
git: Add support for pushing out individual tags
plugins/git/anjuta-git.ui | 96 +++++++++++++++++++++++++----
plugins/git/git-delete-tag-dialog.c | 4 +-
plugins/git/git-push-dialog.c | 116 ++++++++++++++++++++++++++++++++--
plugins/git/git-push-dialog.h | 1 +
plugins/git/git-ui-utils.c | 21 ++++++
plugins/git/git-ui-utils.h | 2 +
6 files changed, 219 insertions(+), 21 deletions(-)
---
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index d60ecb2..cbccd30 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -4436,27 +4436,56 @@
</packing>
</child>
<child>
- <object class="GtkFrame" id="frame46">
+ <object class="GtkFrame" id="frame52">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
- <object class="GtkAlignment" id="alignment46">
+ <object class="GtkAlignment" id="alignment52">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox29">
+ <object class="GtkVBox" id="vbox8">
<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 refs</property>
+ <object class="GtkScrolledWindow" id="push_tags_scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="draw_indicator">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="push_tags_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">tag_list_model</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn7">
+ <property name="title">column</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="push_tags_view_selected_renderer"/>
+ <attributes>
+ <attribute name="active">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn8">
+ <property name="title">column</property>
+ <child>
+ <object class="GtkCellRendererText" id="push_tags_view_name_renderer"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="position">0</property>
@@ -4464,7 +4493,7 @@
</child>
<child>
<object class="GtkCheckButton" id="push_tags_check">
- <property name="label" translatable="yes">Push tags</property>
+ <property name="label" translatable="yes">Push all tags</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -4479,6 +4508,49 @@
</object>
</child>
<child type="label">
+ <object class="GtkLabel" id="label63">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Tags</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame46">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment46">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox29">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkCheckButton" id="push_all_check">
+ <property name="label" translatable="yes">Push all branches and tags</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
<object class="GtkLabel" id="label57">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -4491,7 +4563,7 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
diff --git a/plugins/git/git-delete-tag-dialog.c b/plugins/git/git-delete-tag-dialog.c
index 917b921..c8895aa 100644
--- a/plugins/git/git-delete-tag-dialog.c
+++ b/plugins/git/git-delete-tag-dialog.c
@@ -65,7 +65,7 @@ on_list_tag_command_data_arrived (AnjutaCommand *command,
static void
on_delete_tag_dialog_response (GtkDialog *dialog, gint response_id,
- GitUIData *data)
+ GitUIData *data)
{
GtkWidget *delete_tag_view;
GtkWidget *require_merged_check;
@@ -144,7 +144,7 @@ delete_tag_dialog (Git *plugin)
list_command = git_tag_list_command_new (plugin->project_root_directory);
g_signal_connect (G_OBJECT (list_command), "data-arrived",
- G_CALLBACK (on_list_tag_command_data_arrived),
+ G_CALLBACK (on_git_list_tag_command_data_arrived),
tag_list_model);
g_signal_connect (G_OBJECT (list_command), "command-finished",
diff --git a/plugins/git/git-push-dialog.c b/plugins/git/git-push-dialog.c
index 29951f8..8af5546 100644
--- a/plugins/git/git-push-dialog.c
+++ b/plugins/git/git-push-dialog.c
@@ -40,6 +40,53 @@ on_push_command_finished (AnjutaCommand *command, guint return_code,
g_object_unref (command);
}
+static void
+on_push_tags_check_toggled (GtkToggleButton *toggle_button,
+ GitUIData *data)
+{
+ GtkWidget *push_tags_scrolled_window;
+ GtkWidget *push_all_check;
+ gboolean active;
+
+ push_tags_scrolled_window = GTK_WIDGET (gtk_builder_get_object (data->bxml,
+ "push_tags_scrolled_window"));
+ push_all_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
+ "push_all_check"));
+ active = gtk_toggle_button_get_active (toggle_button);
+
+ /* Leave the widget insensitive if the push all refs check is ticked. */
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (push_all_check)))
+ gtk_widget_set_sensitive (push_tags_scrolled_window, !active);
+}
+
+static void
+on_push_all_check_toggled (GtkToggleButton *toggle_button,
+ GitUIData *data)
+{
+ GtkWidget *push_branches_scrolled_window;
+ GtkWidget *push_tags_scrolled_window;
+ GtkWidget *push_tags_check;
+ gboolean active;
+
+ push_branches_scrolled_window = GTK_WIDGET (gtk_builder_get_object (data->bxml,
+ "push_branches_scrolled_window"));
+ push_tags_scrolled_window = GTK_WIDGET (gtk_builder_get_object (data->bxml,
+ "push_tags_scrolled_window"));
+ push_tags_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
+ "push_tags_check"));
+
+ active = gtk_toggle_button_get_active (toggle_button);
+
+ if (active)
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (push_tags_check),
+ FALSE);
+ }
+
+ gtk_widget_set_sensitive (push_branches_scrolled_window, !active);
+ gtk_widget_set_sensitive (push_tags_scrolled_window, !active);
+ gtk_widget_set_sensitive (push_tags_check, !active);
+}
static void
on_push_dialog_response (GtkDialog *dialog, gint response_id,
@@ -50,7 +97,10 @@ on_push_dialog_response (GtkDialog *dialog, gint response_id,
GtkWidget *push_all_check;
GtkWidget *push_tags_check;
GtkTreeModel *branch_list_model;
+ GtkTreeModel *tag_list_model;
gchar *url;
+ gboolean push_all_tags;
+ gboolean push_all_refs;
GList *selected_refs;
GitPushCommand *push_command;
GitProgressData *progress_data;
@@ -67,6 +117,8 @@ on_push_dialog_response (GtkDialog *dialog, gint response_id,
"push_tags_check"));
branch_list_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
"branch_list_model"));
+ tag_list_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
+ "tag_list_model"));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (push_origin_check)))
url = g_strdup ("origin");
@@ -82,17 +134,30 @@ on_push_dialog_response (GtkDialog *dialog, gint response_id,
return;
}
+ push_all_tags = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (push_all_check));
+ push_all_refs = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (push_tags_check));
+
selected_refs = NULL;
- gtk_tree_model_foreach (branch_list_model,
- (GtkTreeModelForeachFunc) git_get_selected_refs,
- &selected_refs);
+ if (!push_all_refs)
+ {
+ gtk_tree_model_foreach (branch_list_model,
+ (GtkTreeModelForeachFunc) git_get_selected_refs,
+ &selected_refs);
+
+ if (!push_all_tags)
+ {
+ gtk_tree_model_foreach (tag_list_model,
+ (GtkTreeModelForeachFunc) git_get_selected_refs,
+ &selected_refs);
+ }
+ }
push_command = git_push_command_new (data->plugin->project_root_directory,
url,
selected_refs,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (push_all_check)),
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (push_tags_check)));
+ push_all_tags,
+ push_all_refs);
progress_data = git_progress_data_new (data->plugin, _("Git: Pushing..."));
g_free (url);
@@ -128,14 +193,20 @@ static void
push_dialog (Git *plugin)
{
GtkBuilder *bxml;
- gchar *objects[] = {"push_dialog", "branch_list_model", NULL};
+ gchar *objects[] = {"push_dialog", "branch_list_model", "tag_list_model",
+ NULL};
GError *error;
GtkWidget *dialog;
GtkWidget *push_origin_check;
GtkWidget *push_url_entry;
+ GtkWidget *push_tags_check;
+ GtkWidget *push_all_check;
GtkListStore *branch_list_model;
+ GtkListStore *tag_list_model;
GtkCellRenderer *push_branches_view_selected_renderer;
+ GtkCellRenderer *push_tags_view_selected_renderer;
GitBranchListCommand *branch_list_command;
+ GitTagListCommand *tag_list_command;
GitUIData *data;
bxml = gtk_builder_new ();
@@ -153,23 +224,42 @@ push_dialog (Git *plugin)
"push_origin_check"));
push_url_entry = GTK_WIDGET (gtk_builder_get_object (bxml,
"push_url_entry"));
+ push_all_check = GTK_WIDGET (gtk_builder_get_object (bxml,
+ "push_all_check"));
+ push_tags_check = GTK_WIDGET (gtk_builder_get_object (bxml,
+ "push_tags_check"));
branch_list_model = GTK_LIST_STORE (gtk_builder_get_object (bxml,
"branch_list_model"));
+ tag_list_model = GTK_LIST_STORE (gtk_builder_get_object (bxml,
+ "tag_list_model"));
+
push_branches_view_selected_renderer = GTK_CELL_RENDERER (gtk_builder_get_object (bxml,
"push_branches_view_selected_renderer"));
+ push_tags_view_selected_renderer = GTK_CELL_RENDERER (gtk_builder_get_object (bxml,
+ "push_tags_view_selected_renderer"));
branch_list_command = git_branch_list_command_new (plugin->project_root_directory,
GIT_BRANCH_TYPE_LOCAL);
+ tag_list_command = git_tag_list_command_new (plugin->project_root_directory);
g_signal_connect (G_OBJECT (branch_list_command), "data-arrived",
G_CALLBACK (on_git_list_branch_command_data_arrived),
branch_list_model);
g_signal_connect (G_OBJECT (branch_list_command), "command-finished",
- G_CALLBACK (g_object_unref),
+ G_CALLBACK (git_report_errors),
+ NULL);
+
+ g_signal_connect (G_OBJECT (tag_list_command), "data-arrived",
+ G_CALLBACK (on_git_list_tag_command_data_arrived),
+ tag_list_model);
+
+ g_signal_connect (G_OBJECT (tag_list_command), "command-finished",
+ G_CALLBACK (git_report_errors),
NULL);
anjuta_command_start (ANJUTA_COMMAND (branch_list_command));
+ anjuta_command_start (ANJUTA_COMMAND (tag_list_command));
data = git_ui_data_new (plugin, bxml);
@@ -181,9 +271,21 @@ push_dialog (Git *plugin)
G_CALLBACK (on_git_origin_check_toggled),
push_url_entry);
+ g_signal_connect (G_OBJECT (push_tags_check), "toggled",
+ G_CALLBACK (on_push_tags_check_toggled),
+ data);
+
+ g_signal_connect (G_OBJECT (push_all_check), "toggled",
+ G_CALLBACK (on_push_all_check_toggled),
+ data);
+
g_signal_connect (G_OBJECT (push_branches_view_selected_renderer), "toggled",
G_CALLBACK (on_git_selected_column_toggled),
branch_list_model);
+
+ g_signal_connect (G_OBJECT (push_tags_view_selected_renderer), "toggled",
+ G_CALLBACK (on_git_selected_column_toggled),
+ tag_list_model);
gtk_widget_show_all (dialog);
}
diff --git a/plugins/git/git-push-dialog.h b/plugins/git/git-push-dialog.h
index 16e4565..b2f9ffc 100644
--- a/plugins/git/git-push-dialog.h
+++ b/plugins/git/git-push-dialog.h
@@ -26,6 +26,7 @@
#define _GIT_PUSH_DIALOG_H
#include "git-push-command.h"
+#include "git-tag-list-command.h"
#include "git-ui-utils.h"
void on_menu_git_push (GtkAction *action, Git *plugin);
diff --git a/plugins/git/git-ui-utils.c b/plugins/git/git-ui-utils.c
index 3ca0a68..579a0be 100644
--- a/plugins/git/git-ui-utils.c
+++ b/plugins/git/git-ui-utils.c
@@ -407,6 +407,27 @@ on_git_list_branch_combo_command_finished (AnjutaCommand *command,
g_object_unref (command);
}
+
+void
+on_git_list_tag_command_data_arrived (AnjutaCommand *command,
+ GtkListStore *tag_list_model)
+{
+ GQueue *output_queue;
+ gchar *tag_name;
+ GtkTreeIter iter;
+
+ output_queue = git_raw_output_command_get_output (GIT_RAW_OUTPUT_COMMAND (command));
+
+ while (g_queue_peek_head (output_queue))
+ {
+ tag_name = g_queue_pop_head (output_queue);
+
+ gtk_list_store_append (tag_list_model, &iter);
+ gtk_list_store_set (tag_list_model, &iter, 1, tag_name, -1);
+
+ g_free (tag_name);
+ }
+}
void
git_select_all_status_items (GtkButton *select_all_button,
AnjutaVcsStatusTreeView *tree_view)
diff --git a/plugins/git/git-ui-utils.h b/plugins/git/git-ui-utils.h
index 1a61f42..071c37b 100644
--- a/plugins/git/git-ui-utils.h
+++ b/plugins/git/git-ui-utils.h
@@ -78,6 +78,8 @@ void on_git_list_branch_command_data_arrived (AnjutaCommand *command,
void on_git_list_branch_combo_command_finished (AnjutaCommand *command,
guint return_code,
GtkComboBox *combo_box);
+void on_git_list_tag_command_data_arrived (AnjutaCommand *command,
+ GtkListStore *tag_list_model);
void git_select_all_status_items (GtkButton *select_all_button,
AnjutaVcsStatusTreeView *tree_view);
void git_clear_all_status_selections (GtkButton *clear_button,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]