[anjuta] git: Add the Generate Patch Series pane
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] git: Add the Generate Patch Series pane
- Date: Fri, 21 Jan 2011 09:17:11 +0000 (UTC)
commit 572e629c2577d258e8de4d0b136bc8b4f137ac03
Author: James Liggett <jrliggett cox net>
Date: Fri Jan 21 01:15:09 2011 -0800
git: Add the Generate Patch Series pane
plugins/git/Makefile.am | 4 +-
plugins/git/anjuta-git.ui | 170 +++++++++++++++++++++++++++++++++++
plugins/git/git-patch-series-pane.c | 169 ++++++++++++++++++++++++++++++++++
plugins/git/git-patch-series-pane.h | 60 ++++++++++++
plugins/git/plugin.c | 19 ++++-
5 files changed, 420 insertions(+), 2 deletions(-)
---
diff --git a/plugins/git/Makefile.am b/plugins/git/Makefile.am
index 8f1949f..d8267d2 100644
--- a/plugins/git/Makefile.am
+++ b/plugins/git/Makefile.am
@@ -220,7 +220,9 @@ libanjuta_git_la_SOURCES = \
git-reset-pane.c \
git-reset-pane.h \
git-cherry-pick-pane.c \
- git-cherry-pick-pane.h
+ git-cherry-pick-pane.h \
+ git-patch-series-pane.c \
+ git-patch-series-pane.h
libanjuta_git_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index b7dbdbe..f0d2df8 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -2058,6 +2058,176 @@
</packing>
</child>
</object>
+ <object class="GtkVBox" id="patch_series_pane">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <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="can_focus">True</property>
+ <property name="invisible_char">â?¢</property>
+ <property name="text" translatable="yes">Repository origin; Drop or type a different revision here</property>
+ <property name="secondary_icon_stock">gtk-clear</property>
+ <property name="help_text">Repository origin; Drop or type a different revision here</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Generate patches relative to:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkFileChooserButton" id="folder_chooser_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="action">select-folder</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Folder to create patches in:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <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="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="signoff_check">
+ <property name="label" translatable="yes">Add signed off by line</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="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Options:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ok_button">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
<object class="GtkVBox" id="pull_pane">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/plugins/git/git-patch-series-pane.c b/plugins/git/git-patch-series-pane.c
new file mode 100644
index 0000000..78b7b98
--- /dev/null
+++ b/plugins/git/git-patch-series-pane.c
@@ -0,0 +1,169 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * git-shell-test
+ * Copyright (C) James Liggett 2010 <jrliggett cox net>
+ *
+ * git-shell-test is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * git-shell-test is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "git-patch-series-pane.h"
+
+struct _GitPatchSeriesPanePriv
+{
+ GtkBuilder *builder;
+};
+
+G_DEFINE_TYPE (GitPatchSeriesPane, git_patch_series_pane, GIT_TYPE_PANE);
+
+static void
+on_ok_button_clicked (GtkButton *button, GitPatchSeriesPane *self)
+{
+ Git *plugin;
+ AnjutaEntry *revision_entry;
+ GtkFileChooser *folder_chooser_button;
+ GtkToggleButton *signoff_check;
+ const gchar *revision;
+ gchar *output_path;
+ GitFormatPatchCommand *format_patch_command;
+
+ plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
+ revision_entry = ANJUTA_ENTRY (gtk_builder_get_object (self->priv->builder,
+ "revision_entry"));
+ folder_chooser_button = GTK_FILE_CHOOSER (gtk_builder_get_object (self->priv->builder,
+ "folder_chooser_button"));
+ signoff_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
+ "signoff_check"));
+ revision = anjuta_entry_get_text (revision_entry);
+
+ if (g_utf8_strlen (revision, -1) == 0)
+ revision = "origin";
+
+ output_path = gtk_file_chooser_get_filename (folder_chooser_button);
+
+ format_patch_command = git_format_patch_command_new (plugin->project_root_directory,
+ output_path,
+ revision,
+ gtk_toggle_button_get_active (signoff_check));
+
+ git_pane_create_message_view (plugin);
+
+ g_signal_connect (G_OBJECT (format_patch_command), "data-arrived",
+ G_CALLBACK (git_pane_on_command_info_arrived),
+ plugin);
+
+ g_signal_connect (G_OBJECT (format_patch_command), "command-finished",
+ G_CALLBACK (git_pane_report_errors),
+ plugin);
+
+
+ g_signal_connect (G_OBJECT (format_patch_command), "command-finished",
+ G_CALLBACK (g_object_unref),
+ NULL);
+
+ anjuta_command_start (ANJUTA_COMMAND (format_patch_command));
+
+ g_free (output_path);
+
+ git_pane_remove_from_dock (GIT_PANE (self));
+}
+
+
+static void
+git_patch_series_pane_init (GitPatchSeriesPane *self)
+{
+ gchar *objects[] = {"patch_series_pane",
+ NULL};
+ GError *error = NULL;
+ GtkWidget *ok_button;
+ GtkWidget *cancel_button;
+
+
+ self->priv = g_new0 (GitPatchSeriesPanePriv, 1);
+ self->priv->builder = gtk_builder_new ();
+
+ if (!gtk_builder_add_objects_from_file (self->priv->builder, BUILDER_FILE,
+ objects,
+ &error))
+ {
+ g_warning ("Couldn't load builder file: %s", error->message);
+ g_error_free (error);
+ }
+
+ ok_button = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
+ "ok_button"));
+ cancel_button = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
+ "cancel_button"));
+
+ g_signal_connect (G_OBJECT (ok_button), "clicked",
+ G_CALLBACK (on_ok_button_clicked),
+ self);
+
+ g_signal_connect_swapped (G_OBJECT (cancel_button), "clicked",
+ G_CALLBACK (git_pane_remove_from_dock),
+ self);
+}
+
+static void
+git_patch_series_pane_finalize (GObject *object)
+{
+ GitPatchSeriesPane *self;
+
+ self = GIT_PATCH_SERIES_PANE (object);
+
+ g_object_unref (self->priv->builder);
+ g_free (self->priv);
+
+ G_OBJECT_CLASS (git_patch_series_pane_parent_class)->finalize (object);
+}
+
+static GtkWidget *
+git_patch_series_pane_get_widget (AnjutaDockPane *pane)
+{
+ GitPatchSeriesPane *self;
+
+ self = GIT_PATCH_SERIES_PANE (pane);
+
+ return GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
+ "patch_series_pane"));
+}
+
+static void
+git_patch_series_pane_class_init (GitPatchSeriesPaneClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ AnjutaDockPaneClass *pane_class = ANJUTA_DOCK_PANE_CLASS (klass);
+
+ object_class->finalize = git_patch_series_pane_finalize;
+ pane_class->get_widget = git_patch_series_pane_get_widget;
+ pane_class->refresh = NULL;
+}
+
+
+AnjutaDockPane *
+git_patch_series_pane_new (Git *plugin)
+{
+ return g_object_new (GIT_TYPE_PATCH_SERIES_PANE, "plugin", plugin, NULL);
+}
+
+void
+on_patch_series_button_clicked (GtkAction *action, Git *plugin)
+{
+ AnjutaDockPane *pane;
+
+ pane = git_patch_series_pane_new (plugin);
+
+ anjuta_dock_add_pane (ANJUTA_DOCK (plugin->dock), "PatchSeries",
+ _("Generate Patch Series"), NULL, pane,
+ GDL_DOCK_BOTTOM, NULL, 0, NULL);
+}
\ No newline at end of file
diff --git a/plugins/git/git-patch-series-pane.h b/plugins/git/git-patch-series-pane.h
new file mode 100644
index 0000000..c476578
--- /dev/null
+++ b/plugins/git/git-patch-series-pane.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * git-shell-test
+ * Copyright (C) James Liggett 2010 <jrliggett cox net>
+ *
+ * git-shell-test is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * git-shell-test is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _GIT_PATCH_SERIES_PANE_H_
+#define _GIT_PATCH_SERIES_PANE_H_
+
+#include <glib-object.h>
+#include <libanjuta/anjuta-entry.h>
+#include "git-pane.h"
+#include "plugin.h"
+#include "git-format-patch-command.h"
+
+G_BEGIN_DECLS
+
+#define GIT_TYPE_PATCH_SERIES_PANE (git_patch_series_pane_get_type ())
+#define GIT_PATCH_SERIES_PANE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIT_TYPE_PATCH_SERIES_PANE, GitPatchSeriesPane))
+#define GIT_PATCH_SERIES_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIT_TYPE_PATCH_SERIES_PANE, GitPatchSeriesPaneClass))
+#define GIT_IS_PATCH_SERIES_PANE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIT_TYPE_PATCH_SERIES_PANE))
+#define GIT_IS_PATCH_SERIES_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIT_TYPE_PATCH_SERIES_PANE))
+#define GIT_PATCH_SERIES_PANE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIT_TYPE_PATCH_SERIES_PANE, GitPatchSeriesPaneClass))
+
+typedef struct _GitPatchSeriesPaneClass GitPatchSeriesPaneClass;
+typedef struct _GitPatchSeriesPane GitPatchSeriesPane;
+typedef struct _GitPatchSeriesPanePriv GitPatchSeriesPanePriv;
+
+struct _GitPatchSeriesPaneClass
+{
+ GitPaneClass parent_class;
+};
+
+struct _GitPatchSeriesPane
+{
+ GitPane parent_instance;
+
+ GitPatchSeriesPanePriv *priv;
+};
+
+GType git_patch_series_pane_get_type (void) G_GNUC_CONST;
+AnjutaDockPane *git_patch_series_pane_new (Git *plugin);
+void on_patch_series_button_clicked (GtkAction *action, Git *plugin);
+
+G_END_DECLS
+
+#endif /* _GIT_RESET_PANE_H_ */
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index 987a005..1d7955d 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -54,6 +54,7 @@
#include "git-reset-pane.h"
#include "git-revert-pane.h"
#include "git-cherry-pick-pane.h"
+#include "git-patch-series-pane.h"
AnjutaCommandBarEntry branch_entries[] =
{
@@ -405,7 +406,23 @@ static AnjutaCommandBarEntry log_entries[] =
N_("Revert a commit"),
GTK_STOCK_UNDO,
G_CALLBACK (on_revert_button_clicked)
- }
+ },
+ {
+ ANJUTA_COMMAND_BAR_ENTRY_FRAME,
+ "NULL",
+ N_("Patch series"),
+ NULL,
+ NULL,
+ NULL
+ },
+ {
+ ANJUTA_COMMAND_BAR_ENTRY_BUTTON,
+ "GeneratePatchSeries",
+ N_("Generate a patch series"),
+ N_("Generate a patch series"),
+ NULL,
+ G_CALLBACK (on_patch_series_button_clicked)
+ },
};
static gpointer parent_class;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]