anjuta r4196 - in trunk: . plugins/git plugins/language-support-cpp-java
- From: naba svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4196 - in trunk: . plugins/git plugins/language-support-cpp-java
- Date: Fri, 29 Aug 2008 15:07:08 +0000 (UTC)
Author: naba
Date: Fri Aug 29 15:07:08 2008
New Revision: 4196
URL: http://svn.gnome.org/viewvc/anjuta?rev=4196&view=rev
Log:
* plugins/git/Makefile.am:
* plugins/git/anjuta-git.glade:
* plugins/git/anjuta-git.ui:
* plugins/git/git-add-command.c:
* plugins/git/git-add-command.h:
* plugins/git/git-add-dialog.c (on_fm_git_add):
* plugins/git/git-add-dialog.h:
* plugins/git/git-branch-checkout-command.c:
* plugins/git/git-branch-checkout-command.h:
* plugins/git/git-branch-list-command.c:
* plugins/git/git-branch-list-command.h:
* plugins/git/git-branch.c:
* plugins/git/git-branch.h:
* plugins/git/git-cat-blob-command.c (git_cat_blob_command_init),
(git_cat_blob_command_finalize), (git_cat_blob_command_run),
(git_cat_blob_command_class_init), (git_cat_blob_command_new):
* plugins/git/git-cat-blob-command.h:
* plugins/git/git-cat-file-menu.c (on_cat_command_finished),
(on_list_tree_command_finished), (git_cat_file),
(on_log_menu_git_cat_file), (git_cat_file_menu_set_sensitive):
* plugins/git/git-cat-file-menu.h:
* plugins/git/git-fetch-command.c:
* plugins/git/git-fetch-command.h:
* plugins/git/git-file-command.c:
* plugins/git/git-file-command.h:
* plugins/git/git-ignore-command.c:
* plugins/git/git-ignore-command.h:
* plugins/git/git-list-tree-command.c (git_list_tree_command_init),
(git_list_tree_command_finalize), (git_list_tree_command_run),
(git_list_tree_command_handle_output),
(git_list_tree_command_class_init), (git_list_tree_command_new),
(git_list_tree_command_get_blobs):
* plugins/git/git-list-tree-command.h:
* plugins/git/git-log-command.c (git_log_command_finalize),
(git_log_command_run), (git_log_command_new):
* plugins/git/git-log-command.h:
* plugins/git/git-log-dialog.c (on_log_command_finished),
(on_ref_command_finished), (on_log_view_button_clicked),
(git_log_window_create), (on_fm_git_log), (git_log_get_path):
* plugins/git/git-log-dialog.h:
* plugins/git/git-log-message-command.c:
* plugins/git/git-log-message-command.h:
* plugins/git/git-merge-command.c:
* plugins/git/git-merge-command.h:
* plugins/git/git-pull-command.c:
* plugins/git/git-pull-command.h:
* plugins/git/git-remove-command.c:
* plugins/git/git-remove-command.h:
* plugins/git/git-remove-dialog.c (on_fm_git_remove):
* plugins/git/git-remove-dialog.h:
* plugins/git/git-revert-command.c:
* plugins/git/git-revert-command.h:
* plugins/git/git-revision.c:
* plugins/git/git-revision.h:
* plugins/git/plugin.c (on_project_root_added),
(on_project_root_removed), (on_fm_file_added),
(on_fm_file_removed), (git_activate_plugin),
(git_deactivate_plugin):
* plugins/git/plugin.h:
* plugins/language-support-cpp-java/plugin.c
(on_editor_char_inserted_cpp):
GSoC Git plugin: Beta 1 completes the agreed-upon feature set in
the proposal. Specifically, this patch adds:
- Support for viewing logs of individual files or folders
- Support for viewing files at any revision (or \"blobs\" as git calls them)
- File manager integration for log viewing and adding and removing files
This release also fixes some minor bugs:
- Fixes problems with input checking, error dialogs, and widget
focusing when user doesn\'t enter a path in the log viewer when
not viewing the log of the whole project
- Memory leak fixes
- Copyright header fixes
It\'s finally done!! :-)
http://bugzilla.gnome.org/show_bug.cgi?id=529270
Added:
trunk/plugins/git/git-cat-blob-command.c
trunk/plugins/git/git-cat-blob-command.h
trunk/plugins/git/git-cat-file-menu.c
trunk/plugins/git/git-cat-file-menu.h
trunk/plugins/git/git-list-tree-command.c
trunk/plugins/git/git-list-tree-command.h
Modified:
trunk/ChangeLog
trunk/plugins/git/Makefile.am
trunk/plugins/git/anjuta-git.glade
trunk/plugins/git/anjuta-git.ui
trunk/plugins/git/git-add-command.c
trunk/plugins/git/git-add-command.h
trunk/plugins/git/git-add-dialog.c
trunk/plugins/git/git-add-dialog.h
trunk/plugins/git/git-branch-checkout-command.c
trunk/plugins/git/git-branch-checkout-command.h
trunk/plugins/git/git-branch-list-command.c
trunk/plugins/git/git-branch-list-command.h
trunk/plugins/git/git-branch.c
trunk/plugins/git/git-branch.h
trunk/plugins/git/git-fetch-command.c
trunk/plugins/git/git-fetch-command.h
trunk/plugins/git/git-file-command.c
trunk/plugins/git/git-file-command.h
trunk/plugins/git/git-ignore-command.c
trunk/plugins/git/git-ignore-command.h
trunk/plugins/git/git-log-command.c
trunk/plugins/git/git-log-command.h
trunk/plugins/git/git-log-dialog.c
trunk/plugins/git/git-log-dialog.h
trunk/plugins/git/git-log-message-command.c
trunk/plugins/git/git-log-message-command.h
trunk/plugins/git/git-merge-command.c
trunk/plugins/git/git-merge-command.h
trunk/plugins/git/git-pull-command.c
trunk/plugins/git/git-pull-command.h
trunk/plugins/git/git-remove-command.c
trunk/plugins/git/git-remove-command.h
trunk/plugins/git/git-remove-dialog.c
trunk/plugins/git/git-remove-dialog.h
trunk/plugins/git/git-revert-command.c
trunk/plugins/git/git-revert-command.h
trunk/plugins/git/git-revision.c
trunk/plugins/git/git-revision.h
trunk/plugins/git/git-ui-utils.h
trunk/plugins/git/plugin.c
trunk/plugins/git/plugin.h
trunk/plugins/language-support-cpp-java/plugin.c
Modified: trunk/plugins/git/Makefile.am
==============================================================================
--- trunk/plugins/git/Makefile.am (original)
+++ trunk/plugins/git/Makefile.am Fri Aug 29 15:07:08 2008
@@ -171,7 +171,13 @@
git-pull-command.c \
git-pull-command.h \
git-pull-dialog.c \
- git-pull-dialog.h
+ git-pull-dialog.h \
+ git-list-tree-command.c \
+ git-list-tree-command.h \
+ git-cat-blob-command.c \
+ git-cat-blob-command.h \
+ git-cat-file-menu.c \
+ git-cat-file-menu.h
libanjuta_git_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
Modified: trunk/plugins/git/anjuta-git.glade
==============================================================================
--- trunk/plugins/git/anjuta-git.glade (original)
+++ trunk/plugins/git/anjuta-git.glade Fri Aug 29 15:07:08 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Mon Jul 21 18:21:23 2008 -->
+<!--Generated with glade3 3.4.5 on Wed Jul 30 14:11:17 2008 -->
<glade-interface>
<requires lib="gnome"/>
<requires lib="anjuta"/>
@@ -1641,20 +1641,21 @@
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
- <widget class="GnomeFileEntry" id="path_entry">
+ <widget class="GnomeFileEntry" id="fileentry1">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="spacing">4</property>
+ <property name="use_filechooser">True</property>
<child internal-child="entry">
- <widget class="GtkEntry" id="path_text_entry">
+ <widget class="GtkEntry" id="log_path_entry">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
</widget>
</child>
</widget>
</child>
<child>
- <widget class="GtkButton" id="view_log_button">
+ <widget class="GtkButton" id="log_view_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -1694,7 +1695,7 @@
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="whole_project_check">
+ <widget class="GtkCheckButton" id="log_whole_project_check">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Whole project</property>
Modified: trunk/plugins/git/anjuta-git.ui
==============================================================================
--- trunk/plugins/git/anjuta-git.ui (original)
+++ trunk/plugins/git/anjuta-git.ui Fri Aug 29 15:07:08 2008
@@ -61,6 +61,7 @@
<popup name="PopupLog">
<menuitem name="Commit diff" action="ActionGitLogCommitDiff" />
+ <menuitem name="View Selected Revision" action="ActionGitLogViewRevision" />
<separator name="log_separator1" />
<menuitem name="Create branch..." action="ActionGitLogCreateBranch" />
<menuitem name="Create tag..." action="ActionGitLogCreateTag" />
@@ -75,4 +76,14 @@
</menu>
</placeholder>
</popup>
+
+ <popup name="PopupFileManager">
+ <placeholder name="PlaceholderPopupFileVCS">
+ <menu name="MenuGitFM" action="ActionMenuGitFM">
+ <menuitem name="View log..." action="ActionGitFMLog" />
+ <menuitem name="Add..." action="ActionGitFMAdd" />
+ <menuitem name="Remove..." action="ActionGitFMRemove" />
+ </menu>
+ </placeholder>
+ </popup>
</ui>
Modified: trunk/plugins/git/git-add-command.c
==============================================================================
--- trunk/plugins/git/git-add-command.c (original)
+++ trunk/plugins/git/git-add-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-add-command.h
==============================================================================
--- trunk/plugins/git/git-add-command.h (original)
+++ trunk/plugins/git/git-add-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-add-dialog.c
==============================================================================
--- trunk/plugins/git/git-add-dialog.c (original)
+++ trunk/plugins/git/git-add-dialog.c Fri Aug 29 15:07:08 2008
@@ -118,3 +118,9 @@
{
add_dialog (plugin, plugin->current_editor_filename);
}
+
+void
+on_fm_git_add (GtkAction *action, Git *plugin)
+{
+ add_dialog (plugin, plugin->current_fm_filename);
+}
Modified: trunk/plugins/git/git-add-dialog.h
==============================================================================
--- trunk/plugins/git/git-add-dialog.h (original)
+++ trunk/plugins/git/git-add-dialog.h Fri Aug 29 15:07:08 2008
@@ -29,5 +29,6 @@
#include "git-ui-utils.h"
void on_menu_git_add (GtkAction *action, Git *plugin);
+void on_fm_git_add (GtkAction *action, Git *plugin);
#endif
Modified: trunk/plugins/git/git-branch-checkout-command.c
==============================================================================
--- trunk/plugins/git/git-branch-checkout-command.c (original)
+++ trunk/plugins/git/git-branch-checkout-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-branch-checkout-command.h
==============================================================================
--- trunk/plugins/git/git-branch-checkout-command.h (original)
+++ trunk/plugins/git/git-branch-checkout-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-branch-list-command.c
==============================================================================
--- trunk/plugins/git/git-branch-list-command.c (original)
+++ trunk/plugins/git/git-branch-list-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-branch-list-command.h
==============================================================================
--- trunk/plugins/git/git-branch-list-command.h (original)
+++ trunk/plugins/git/git-branch-list-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-branch.c
==============================================================================
--- trunk/plugins/git/git-branch.c (original)
+++ trunk/plugins/git/git-branch.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-branch.h
==============================================================================
--- trunk/plugins/git/git-branch.h (original)
+++ trunk/plugins/git/git-branch.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Added: trunk/plugins/git/git-cat-blob-command.c
==============================================================================
--- (empty file)
+++ trunk/plugins/git/git-cat-blob-command.c Fri Aug 29 15:07:08 2008
@@ -0,0 +1,92 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ *
+ * anjuta is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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 anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "git-cat-blob-command.h"
+
+struct _GitCatBlobCommandPriv
+{
+ gchar *blob_sha;
+};
+
+G_DEFINE_TYPE (GitCatBlobCommand, git_cat_blob_command,
+ GIT_TYPE_RAW_OUTPUT_COMMAND);
+
+static void
+git_cat_blob_command_init (GitCatBlobCommand *self)
+{
+ self->priv = g_new0 (GitCatBlobCommandPriv, 1);
+}
+
+static void
+git_cat_blob_command_finalize (GObject *object)
+{
+ GitCatBlobCommand *self;
+
+ self = GIT_CAT_BLOB_COMMAND (object);
+
+ g_free (self->priv->blob_sha);
+ g_free (self->priv);
+
+ G_OBJECT_CLASS (git_cat_blob_command_parent_class)->finalize (object);
+}
+
+static guint
+git_cat_blob_command_run (AnjutaCommand *command)
+{
+ GitCatBlobCommand *self;
+
+ self = GIT_CAT_BLOB_COMMAND (command);
+
+ git_command_add_arg (GIT_COMMAND (command), "cat-file");
+ git_command_add_arg (GIT_COMMAND (command), "blob");
+ git_command_add_arg (GIT_COMMAND (command), self->priv->blob_sha);
+
+ return 0;
+}
+
+static void
+git_cat_blob_command_class_init (GitCatBlobCommandClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ AnjutaCommandClass *command_class = ANJUTA_COMMAND_CLASS (klass);
+
+ object_class->finalize = git_cat_blob_command_finalize;
+ command_class->run = git_cat_blob_command_run;
+}
+
+
+GitCatBlobCommand *
+git_cat_blob_command_new (const gchar *working_directory, const gchar *blob_sha)
+{
+ GitCatBlobCommand *self;
+
+ self = g_object_new (GIT_TYPE_CAT_BLOB_COMMAND,
+ "working-directory", working_directory,
+ NULL);
+
+ self->priv->blob_sha = g_strdup (blob_sha);
+
+ return self;
+}
+
Added: trunk/plugins/git/git-cat-blob-command.h
==============================================================================
--- (empty file)
+++ trunk/plugins/git/git-cat-blob-command.h Fri Aug 29 15:07:08 2008
@@ -0,0 +1,62 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ *
+ * anjuta is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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 anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GIT_CAT_BLOB_COMMAND_H_
+#define _GIT_CAT_BLOB_COMMAND_H_
+
+#include <glib-object.h>
+#include "git-raw-output-command.h"
+
+G_BEGIN_DECLS
+
+#define GIT_TYPE_CAT_BLOB_COMMAND (git_cat_blob_command_get_type ())
+#define GIT_CAT_BLOB_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIT_TYPE_CAT_BLOB_COMMAND, GitCatBlobCommand))
+#define GIT_CAT_BLOB_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIT_TYPE_CAT_BLOB_COMMAND, GitCatBlobCommandClass))
+#define GIT_IS_CAT_BLOB_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIT_TYPE_CAT_BLOB_COMMAND))
+#define GIT_IS_CAT_BLOB_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIT_TYPE_CAT_BLOB_COMMAND))
+#define GIT_CAT_BLOB_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIT_TYPE_CAT_BLOB_COMMAND, GitCatBlobCommandClass))
+
+typedef struct _GitCatBlobCommandClass GitCatBlobCommandClass;
+typedef struct _GitCatBlobCommand GitCatBlobCommand;
+typedef struct _GitCatBlobCommandPriv GitCatBlobCommandPriv;
+
+struct _GitCatBlobCommandClass
+{
+ GitRawOutputCommandClass parent_class;
+};
+
+struct _GitCatBlobCommand
+{
+ GitRawOutputCommand parent_instance;
+
+ GitCatBlobCommandPriv *priv;
+};
+
+GType git_cat_blob_command_get_type (void) G_GNUC_CONST;
+GitCatBlobCommand *git_cat_blob_command_new (const gchar *working_directory,
+ const gchar *blob_sha);
+
+G_END_DECLS
+
+#endif /* _GIT_CAT_BLOB_COMMAND_H_ */
Added: trunk/plugins/git/git-cat-file-menu.c
==============================================================================
--- (empty file)
+++ trunk/plugins/git/git-cat-file-menu.c Fri Aug 29 15:07:08 2008
@@ -0,0 +1,172 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ *
+ * anjuta is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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 anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "git-cat-file-menu.h"
+
+static void
+on_cat_command_finished (AnjutaCommand *command, guint return_code,
+ Git *plugin)
+{
+ AnjutaStatus *status;
+
+ status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell,
+ NULL);
+
+ anjuta_status (status, _("Git: File retrieved."), 5);
+
+ git_report_errors (command, return_code);
+
+ g_object_unref (command);
+}
+
+static void
+on_list_tree_command_finished (AnjutaCommand *command, guint return_code,
+ Git *plugin)
+{
+ gchar *path;
+ GFile *path_file;
+ gchar *basename;
+ gchar *short_commit_sha;
+ gchar *editor_name;
+ IAnjutaDocumentManager *document_manager;
+ IAnjutaEditor *editor;
+ GHashTable *blobs;
+ gchar *blob_sha;
+ GitCatBlobCommand *cat_command;
+
+ if (return_code != 0)
+ {
+ git_report_errors (command, return_code);
+ g_object_unref (command);
+
+ return;
+ }
+
+
+ short_commit_sha = g_object_get_data (G_OBJECT (command),
+ "short-commit-sha");
+ path = g_object_get_data (G_OBJECT (command), "path");
+ blobs = git_list_tree_command_get_blobs (GIT_LIST_TREE_COMMAND (command));
+ path_file = g_file_new_for_path (path);
+ basename = g_file_get_basename (path_file);
+ editor_name = g_strdup_printf ("[Revision %s] %s", short_commit_sha,
+ basename);
+ document_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
+ IAnjutaDocumentManager,
+ NULL);
+ editor = ianjuta_document_manager_add_buffer (document_manager,
+ editor_name,
+ "", NULL);
+ g_free (editor_name);
+
+ blob_sha = g_hash_table_lookup (blobs, basename);
+ cat_command = git_cat_blob_command_new (plugin->project_root_directory,
+ blob_sha);
+
+ g_signal_connect (G_OBJECT (cat_command), "data-arrived",
+ G_CALLBACK (git_send_raw_command_output_to_editor),
+ editor);
+
+ g_signal_connect (G_OBJECT (cat_command), "command_finished",
+ G_CALLBACK (on_cat_command_finished),
+ plugin);
+
+ anjuta_command_start (ANJUTA_COMMAND (cat_command));
+
+ g_hash_table_unref (blobs);
+ g_object_unref (path_file);
+ g_free (basename);
+}
+
+static void
+git_cat_file (Git *plugin, const gchar *path, GitRevision *revision)
+{
+ GFile *path_file;
+ GFile *path_parent_file;
+ gchar *parent_path;
+ gchar *commit_sha;
+ gchar *short_commit_sha;
+ GitListTreeCommand *list_tree_command;
+
+ /* Given paths are supposed to be full paths, not relative ones like
+ * git would expect. */
+ path_file = g_file_new_for_path (path);
+ path_parent_file = g_file_get_parent (path_file);
+ parent_path = g_file_get_path (path_parent_file);
+
+ commit_sha = git_revision_get_sha (revision);
+ short_commit_sha = git_revision_get_short_sha (revision);
+
+ /* Unlike with all the other commands, use the folder of the given file,
+ * as git ls-tree works like regular ls in that it will ususally only give
+ * listings for the current directory. */
+ list_tree_command = git_list_tree_command_new (parent_path,
+ commit_sha);
+
+ g_signal_connect (G_OBJECT (list_tree_command), "command-finished",
+ G_CALLBACK (on_list_tree_command_finished),
+ plugin);
+
+ g_object_set_data_full (G_OBJECT (list_tree_command), "path",
+ g_strdup (path), g_free);
+ g_object_set_data_full (G_OBJECT (list_tree_command), "short-commit-sha",
+ g_strdup (short_commit_sha), g_free);
+
+ anjuta_command_start (ANJUTA_COMMAND (list_tree_command));
+
+ g_object_unref (path_file);
+ g_object_unref (path_parent_file);
+ g_free (parent_path);
+ g_free (commit_sha);
+ g_free (short_commit_sha);
+}
+
+void
+on_log_menu_git_cat_file (GtkAction *action, Git *plugin)
+{
+ gchar *path;
+ GitRevision *revision;
+
+ path = git_log_get_path (plugin);
+ revision = git_log_get_selected_revision (plugin);
+
+ if (revision)
+ git_cat_file (plugin, path, revision);
+
+ g_free (path);
+ g_object_unref (revision);
+}
+
+void
+git_cat_file_menu_set_sensitive (Git *plugin, gboolean sensitive)
+{
+ AnjutaUI *ui;
+ GtkAction *view_revision_action;
+
+ ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
+ view_revision_action = anjuta_ui_get_action (ui, "ActionGroupGitLog",
+ "ActionGitLogViewRevision");
+
+ gtk_action_set_sensitive (view_revision_action, sensitive);
+}
Added: trunk/plugins/git/git-cat-file-menu.h
==============================================================================
--- (empty file)
+++ trunk/plugins/git/git-cat-file-menu.h Fri Aug 29 15:07:08 2008
@@ -0,0 +1,36 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ *
+ * anjuta is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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 anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GIT_CAT_FILE_MENU_H
+#define _GIT_CAT_FILE_MENU_H
+
+#include "git-list-tree-command.h"
+#include "git-cat-blob-command.h"
+#include "git-log-dialog.h"
+#include "git-ui-utils.h"
+
+void on_log_menu_git_cat_file (GtkAction *action, Git *plugin);
+void git_cat_file_menu_set_sensitive (Git *plugin, gboolean sensitive);
+
+#endif
Modified: trunk/plugins/git/git-fetch-command.c
==============================================================================
--- trunk/plugins/git/git-fetch-command.c (original)
+++ trunk/plugins/git/git-fetch-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-fetch-command.h
==============================================================================
--- trunk/plugins/git/git-fetch-command.h (original)
+++ trunk/plugins/git/git-fetch-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-file-command.c
==============================================================================
--- trunk/plugins/git/git-file-command.c (original)
+++ trunk/plugins/git/git-file-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-file-command.h
==============================================================================
--- trunk/plugins/git/git-file-command.h (original)
+++ trunk/plugins/git/git-file-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-ignore-command.c
==============================================================================
--- trunk/plugins/git/git-ignore-command.c (original)
+++ trunk/plugins/git/git-ignore-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-ignore-command.h
==============================================================================
--- trunk/plugins/git/git-ignore-command.h (original)
+++ trunk/plugins/git/git-ignore-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Added: trunk/plugins/git/git-list-tree-command.c
==============================================================================
--- (empty file)
+++ trunk/plugins/git/git-list-tree-command.c Fri Aug 29 15:07:08 2008
@@ -0,0 +1,138 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ *
+ * anjuta is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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 anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "git-list-tree-command.h"
+
+#define BLOB_REGEX "blob ([[:xdigit:]]{40})(?:\\t)(.*)"
+
+struct _GitListTreeCommandPriv
+{
+ gchar *commit_sha;
+ GRegex *blob_regex;
+ GHashTable *blobs;
+};
+
+G_DEFINE_TYPE (GitListTreeCommand, git_list_tree_command, GIT_TYPE_COMMAND);
+
+static void
+git_list_tree_command_init (GitListTreeCommand *self)
+{
+ self->priv = g_new0 (GitListTreeCommandPriv, 1);
+
+ self->priv->blob_regex = g_regex_new (BLOB_REGEX, 0, 0, NULL);
+ self->priv->blobs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
+ g_free);
+}
+
+static void
+git_list_tree_command_finalize (GObject *object)
+{
+ GitListTreeCommand *self;
+
+ self = GIT_LIST_TREE_COMMAND (object);
+
+ g_free (self->priv->commit_sha);
+ g_regex_unref (self->priv->blob_regex);
+ g_hash_table_unref (self->priv->blobs);
+
+ g_free (self->priv);
+
+ G_OBJECT_CLASS (git_list_tree_command_parent_class)->finalize (object);
+}
+
+static guint
+git_list_tree_command_run (AnjutaCommand *command)
+{
+ GitListTreeCommand *self;
+
+ self = GIT_LIST_TREE_COMMAND (command);
+
+ git_command_add_arg (GIT_COMMAND (command), "ls-tree");
+ git_command_add_arg (GIT_COMMAND (command), self->priv->commit_sha);
+
+ return 0;
+}
+
+static void
+git_list_tree_command_handle_output (GitCommand *git_command,
+ const gchar *output)
+{
+ GitListTreeCommand *self;
+ GMatchInfo *match_info;
+ gchar *blob_sha;
+ gchar *filename;
+
+ self = GIT_LIST_TREE_COMMAND (git_command);
+ match_info = NULL;
+
+ if (g_regex_match (self->priv->blob_regex, output, 0, &match_info))
+ {
+ blob_sha = g_match_info_fetch (match_info, 1);
+ filename = g_match_info_fetch (match_info, 2);
+
+ g_hash_table_insert (self->priv->blobs, g_strdup (filename),
+ g_strdup (blob_sha));
+
+ g_free (blob_sha);
+ g_free (filename);
+ }
+
+ if (match_info)
+ g_match_info_free (match_info);
+}
+
+static void
+git_list_tree_command_class_init (GitListTreeCommandClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GitCommandClass* parent_class = GIT_COMMAND_CLASS (klass);
+ AnjutaCommandClass *command_class = ANJUTA_COMMAND_CLASS (klass);
+
+ object_class->finalize = git_list_tree_command_finalize;
+ parent_class->output_handler = git_list_tree_command_handle_output;
+ command_class->run = git_list_tree_command_run;
+}
+
+
+GitListTreeCommand *
+git_list_tree_command_new (const gchar *working_directory,
+ const gchar *commit_sha)
+{
+ GitListTreeCommand *self;
+
+ self = g_object_new (GIT_TYPE_LIST_TREE_COMMAND,
+ "working-directory", working_directory,
+ "single-line-output", TRUE,
+ NULL);
+
+ self->priv->commit_sha = g_strdup (commit_sha);
+
+ return self;
+}
+
+GHashTable *
+git_list_tree_command_get_blobs (GitListTreeCommand *self)
+{
+ return g_hash_table_ref (self->priv->blobs);
+}
Added: trunk/plugins/git/git-list-tree-command.h
==============================================================================
--- (empty file)
+++ trunk/plugins/git/git-list-tree-command.h Fri Aug 29 15:07:08 2008
@@ -0,0 +1,63 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ *
+ * anjuta is free software.
+ *
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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 anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GIT_LIST_TREE_COMMAND_H_
+#define _GIT_LIST_TREE_COMMAND_H_
+
+#include <glib-object.h>
+#include "git-command.h"
+
+G_BEGIN_DECLS
+
+#define GIT_TYPE_LIST_TREE_COMMAND (git_list_tree_command_get_type ())
+#define GIT_LIST_TREE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIT_TYPE_LIST_TREE_COMMAND, GitListTreeCommand))
+#define GIT_LIST_TREE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIT_TYPE_LIST_TREE_COMMAND, GitListTreeCommandClass))
+#define GIT_IS_LIST_TREE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIT_TYPE_LIST_TREE_COMMAND))
+#define GIT_IS_LIST_TREE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIT_TYPE_LIST_TREE_COMMAND))
+#define GIT_LIST_TREE_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIT_TYPE_LIST_TREE_COMMAND, GitListTreeCommandClass))
+
+typedef struct _GitListTreeCommandClass GitListTreeCommandClass;
+typedef struct _GitListTreeCommand GitListTreeCommand;
+typedef struct _GitListTreeCommandPriv GitListTreeCommandPriv;
+
+struct _GitListTreeCommandClass
+{
+ GitCommandClass parent_class;
+};
+
+struct _GitListTreeCommand
+{
+ GitCommand parent_instance;
+
+ GitListTreeCommandPriv *priv;
+};
+
+GType git_list_tree_command_get_type (void) G_GNUC_CONST;
+GitListTreeCommand *git_list_tree_command_new (const gchar *working_directory,
+ const gchar *commit_sha);
+GHashTable *git_list_tree_command_get_blobs (GitListTreeCommand *self);
+
+G_END_DECLS
+
+#endif /* _GIT_LIST_TREE_COMMAND_H_ */
Modified: trunk/plugins/git/git-log-command.c
==============================================================================
--- trunk/plugins/git/git-log-command.c (original)
+++ trunk/plugins/git/git-log-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * git-command-test
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * git-command-test is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * git-command-test is distributed in the hope that it will be useful,
+ * anjuta 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 git-command-test. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
@@ -40,6 +40,7 @@
GRegex *author_regex;
GRegex *time_regex;
GRegex *short_log_regex;
+ gchar *path;
/* Filters */
gchar *author;
@@ -88,6 +89,7 @@
g_regex_unref (self->priv->author_regex);
g_regex_unref (self->priv->time_regex);
g_regex_unref (self->priv->short_log_regex);
+ g_free (self->priv->path);
g_free (self->priv->author);
g_free (self->priv->grep);
@@ -165,6 +167,12 @@
else
git_command_add_arg (GIT_COMMAND (command), "HEAD");
+ if (self->priv->path)
+ {
+ git_command_add_arg (GIT_COMMAND (command), "--");
+ git_command_add_arg (GIT_COMMAND (command), self->priv->path);
+ }
+
return 0;
}
@@ -277,6 +285,7 @@
GitLogCommand *
git_log_command_new (const gchar *working_directory,
+ const gchar *path,
const gchar *author, const gchar *grep,
const gchar *since_date, const gchar *until_date,
const gchar *since_commit,
@@ -290,6 +299,7 @@
NULL);
self->priv->author = g_strdup (author);
+ self->priv->path = g_strdup (path);
self->priv->grep = g_strdup (grep);
self->priv->since_date = g_strdup (since_date);
self->priv->until_date = g_strdup (until_date);
Modified: trunk/plugins/git/git-log-command.h
==============================================================================
--- trunk/plugins/git/git-log-command.h (original)
+++ trunk/plugins/git/git-log-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * git-command-test
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * git-command-test is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * git-command-test is distributed in the hope that it will be useful,
+ * anjuta 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 git-command-test. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
@@ -57,6 +57,7 @@
GType git_log_command_get_type (void) G_GNUC_CONST;
GitLogCommand *git_log_command_new (const gchar *working_directory,
+ const gchar *path,
const gchar *author,
const gchar *grep,
const gchar *since_date,
Modified: trunk/plugins/git/git-log-dialog.c
==============================================================================
--- trunk/plugins/git/git-log-dialog.c (original)
+++ trunk/plugins/git/git-log-dialog.c Fri Aug 29 15:07:08 2008
@@ -23,6 +23,7 @@
*/
#include "git-log-dialog.h"
+#include "git-cat-file-menu.h"
enum
{
@@ -197,25 +198,19 @@
LogData *data)
{
GtkWidget *log_changes_view;
- GtkTreeViewColumn *graph_column;
GQueue *queue;
GtkTreeIter iter;
GitRevision *revision;
- log_changes_view = glade_xml_get_widget (data->gxml, "log_changes_view");
-
- /* If the user is using any filters, hide the graph column, because
- * we can't be assured that the graph will be correct with filtered output
- * and Giggle's graph renderer doesn't seem to be written to handle this
- * case, so it might crash when rendering. FIXME: look into improving it;
- * qgit can handle this somewhat, maybe look there? */
- graph_column = gtk_tree_view_get_column (GTK_TREE_VIEW (log_changes_view),
- 1);
+ if (return_code != 0)
+ {
+ git_report_errors (command, return_code);
+ g_object_unref (command);
+
+ return;
+ }
- if (g_hash_table_size (data->filters) > 0)
- gtk_tree_view_column_set_visible (graph_column, FALSE);
- else
- gtk_tree_view_column_set_visible (graph_column, TRUE);
+ log_changes_view = glade_xml_get_widget (data->gxml, "log_changes_view");
g_object_ref (data->list_store);
gtk_tree_view_set_model (GTK_TREE_VIEW (log_changes_view), NULL);
@@ -245,6 +240,10 @@
on_ref_command_finished (AnjutaCommand *command, guint return_code,
LogData *data)
{
+ gchar *path;
+ const gchar *relative_path;
+ GtkWidget *log_changes_view;
+ GtkTreeViewColumn *graph_column;
gchar *author;
gchar *grep;
gchar *since_date;
@@ -254,6 +253,35 @@
GitLogCommand *log_command;
gint pulse_timer_id;
+ path = g_object_get_data (G_OBJECT (command), "path");
+ relative_path = NULL;
+
+ if (return_code != 0)
+ {
+ git_report_errors (command, return_code);
+ g_object_unref (command);
+
+ return;
+ }
+
+ if (path)
+ {
+ relative_path = git_get_relative_path (path,
+ data->plugin->project_root_directory);
+ }
+
+ /* If the user is using any filters or getting the log of an individual,
+ * file or folder, hide the graph column, because we can't be assured that
+ * the graph will be correct in these cases */
+ log_changes_view = glade_xml_get_widget (data->gxml, "log_changes_view");
+ graph_column = gtk_tree_view_get_column (GTK_TREE_VIEW (log_changes_view),
+ 1);
+
+ if (g_hash_table_size (data->filters) > 0 || path)
+ gtk_tree_view_column_set_visible (graph_column, FALSE);
+ else
+ gtk_tree_view_column_set_visible (graph_column, TRUE);
+
/* Get the filter data */
author = g_hash_table_lookup (data->filters, "author");
grep = g_hash_table_lookup (data->filters, "grep");
@@ -267,6 +295,7 @@
data->refs = git_ref_command_get_refs (GIT_REF_COMMAND (command));
log_command = git_log_command_new (data->plugin->project_root_directory,
+ relative_path,
author, grep, since_date, until_date,
since_commit, until_commit);
@@ -290,16 +319,59 @@
}
static void
-on_view_log_button_clicked (GtkButton *button, LogData *data)
+on_log_view_button_clicked (GtkButton *button, LogData *data)
{
+ gchar *path;
+ AnjutaShell *shell;
+ GtkWidget *log_whole_project_check;
+ GtkWidget *log_path_entry;
GitRefCommand *ref_command;
+ path = NULL;
+
+ log_whole_project_check = glade_xml_get_widget (data->gxml,
+ "log_whole_project_check");
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (log_whole_project_check)))
+ {
+ log_path_entry = glade_xml_get_widget (data->gxml, "log_path_entry");
+ path = gtk_editable_get_chars (GTK_EDITABLE (log_path_entry), 0, -1);
+
+ /* Log widget belongs to the shell at this point. */
+ shell = ANJUTA_PLUGIN (data->plugin)->shell;
+
+ if (!git_check_input (GTK_WIDGET (shell), log_path_entry, path,
+ _("Please enter a path.")))
+ {
+ g_free (path);
+ return;
+ }
+
+ /* Don't allow the user to try to view revisions of directories */
+ git_cat_file_menu_set_sensitive (data->plugin,
+ !g_file_test (path,
+ G_FILE_TEST_IS_DIR));
+ }
+ else
+ {
+ /* Users can't get individual files if they're viewing the whole
+ * project log. */
+ git_cat_file_menu_set_sensitive (data->plugin, FALSE);
+ }
+
ref_command = git_ref_command_new (data->plugin->project_root_directory);
g_signal_connect (G_OBJECT (ref_command), "command-finished",
G_CALLBACK (on_ref_command_finished),
data);
+
+ /* Attach path to this command so it can be passed to the log command. */
+ g_object_set_data_full (G_OBJECT (ref_command), "path",
+ g_strdup (path), g_free);
+
+ g_free (path);
+
anjuta_command_start (ANJUTA_COMMAND (ref_command));
}
@@ -695,9 +767,9 @@
GtkWidget *log_window;
GtkWidget *log_vbox;
GtkWidget *log_changes_view;
- GtkWidget *view_log_button;
- GtkWidget *whole_project_check;
- GtkWidget *path_entry;
+ GtkWidget *log_view_button;
+ GtkWidget *log_whole_project_check;
+ GtkWidget *log_path_entry;
GtkTreeSelection *selection;
data = g_new0 (LogData, 1);
@@ -710,11 +782,11 @@
log_window = glade_xml_get_widget (data->gxml, "log_window");
log_vbox = glade_xml_get_widget (data->gxml, "log_vbox");
log_changes_view = glade_xml_get_widget (data->gxml, "log_changes_view");
- whole_project_check = glade_xml_get_widget (data->gxml,
- "whole_project_check");
- path_entry = glade_xml_get_widget (data->gxml, "path_entry");
- view_log_button = glade_xml_get_widget (data->gxml,
- "view_log_button");
+ log_whole_project_check = glade_xml_get_widget (data->gxml,
+ "log_whole_project_check");
+ log_path_entry = glade_xml_get_widget (data->gxml, "log_path_entry");
+ log_view_button = glade_xml_get_widget (data->gxml,
+ "log_view_button");
g_object_set_data (G_OBJECT (log_vbox), "log-data", data);
@@ -728,13 +800,13 @@
plugin);
- g_signal_connect (G_OBJECT (view_log_button), "clicked",
- G_CALLBACK (on_view_log_button_clicked),
+ g_signal_connect (G_OBJECT (log_view_button), "clicked",
+ G_CALLBACK (on_log_view_button_clicked),
data);
- g_object_set_data (G_OBJECT (whole_project_check), "file-entry",
- path_entry);
- g_signal_connect (G_OBJECT (whole_project_check), "toggled",
+ g_object_set_data (G_OBJECT (log_whole_project_check), "file-entry",
+ log_path_entry);
+ g_signal_connect (G_OBJECT (log_whole_project_check), "toggled",
G_CALLBACK (on_git_whole_project_toggled), plugin);
data->list_store = gtk_list_store_new (NUM_COLS,
@@ -746,6 +818,8 @@
(GtkTreeSelectionFunc) on_log_changes_view_row_selected,
data, NULL);
+ git_cat_file_menu_set_sensitive (plugin, FALSE);
+
g_signal_connect (G_OBJECT (log_vbox), "destroy",
G_CALLBACK (on_log_vbox_destroy),
data);
@@ -764,23 +838,27 @@
plugin->log_viewer, NULL);
}
-/* TODO: Enable when FM support is implemented */
-#if 0
void
-on_fm_subversion_log (GtkAction *action, Git *plugin)
+on_fm_git_log (GtkAction *action, Git *plugin)
{
- GtkWidget *path_text_entry;
-
- path_text_entry = glade_xml_get_widget (plugin->log_gxml,
- "path_text_entry");
+ LogData *data;
+ GtkWidget *log_path_entry;
+ GtkWidget *log_whole_project_check;
- gtk_entry_set_text (GTK_ENTRY path_entry),
- plugin->fm_current_filename);
+ data = g_object_get_data (G_OBJECT (plugin->log_viewer), "log-data");
+ log_path_entry = glade_xml_get_widget (data->gxml,
+ "log_path_entry");
+ log_whole_project_check = glade_xml_get_widget (data->gxml,
+ "log_whole_project_check");
+
+ gtk_entry_set_text (GTK_ENTRY (log_path_entry),
+ plugin->current_fm_filename);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (log_whole_project_check),
+ FALSE);
anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
plugin->log_viewer, NULL);
}
-#endif
void
git_log_window_clear (Git *plugin)
@@ -819,3 +897,15 @@
return revision;
}
+
+gchar *
+git_log_get_path (Git *plugin)
+{
+ LogData *data;
+ GtkWidget *log_path_entry;
+
+ data = g_object_get_data (G_OBJECT (plugin->log_viewer), "log-data");
+ log_path_entry = glade_xml_get_widget (data->gxml, "log_path_entry");
+
+ return gtk_editable_get_chars (GTK_EDITABLE (log_path_entry), 0, -1);
+}
Modified: trunk/plugins/git/git-log-dialog.h
==============================================================================
--- trunk/plugins/git/git-log-dialog.h (original)
+++ trunk/plugins/git/git-log-dialog.h Fri Aug 29 15:07:08 2008
@@ -32,14 +32,11 @@
#include "giggle-graph-renderer.h"
void on_menu_git_log (GtkAction* action, Git *plugin);
-
-/* TODO: Enable when FM support is implemented */
-#if 0
void on_fm_git_log (GtkAction *action, Git *plugin);
-#endif
GtkWidget *git_log_window_create (Git *plugin);
void git_log_window_clear (Git *plugin);
GitRevision *git_log_get_selected_revision (Git *plugin);
+gchar *git_log_get_path (Git *plugin);
#endif
Modified: trunk/plugins/git/git-log-message-command.c
==============================================================================
--- trunk/plugins/git/git-log-message-command.c (original)
+++ trunk/plugins/git/git-log-message-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * git-command-test
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * git-command-test is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * git-command-test is distributed in the hope that it will be useful,
+ * anjuta 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 git-command-test. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-log-message-command.h
==============================================================================
--- trunk/plugins/git/git-log-message-command.h (original)
+++ trunk/plugins/git/git-log-message-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * git-command-test
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * git-command-test is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * git-command-test is distributed in the hope that it will be useful,
+ * anjuta 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 git-command-test. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-merge-command.c
==============================================================================
--- trunk/plugins/git/git-merge-command.c (original)
+++ trunk/plugins/git/git-merge-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-merge-command.h
==============================================================================
--- trunk/plugins/git/git-merge-command.h (original)
+++ trunk/plugins/git/git-merge-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-pull-command.c
==============================================================================
--- trunk/plugins/git/git-pull-command.c (original)
+++ trunk/plugins/git/git-pull-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-pull-command.h
==============================================================================
--- trunk/plugins/git/git-pull-command.h (original)
+++ trunk/plugins/git/git-pull-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-remove-command.c
==============================================================================
--- trunk/plugins/git/git-remove-command.c (original)
+++ trunk/plugins/git/git-remove-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-remove-command.h
==============================================================================
--- trunk/plugins/git/git-remove-command.h (original)
+++ trunk/plugins/git/git-remove-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-remove-dialog.c
==============================================================================
--- trunk/plugins/git/git-remove-dialog.c (original)
+++ trunk/plugins/git/git-remove-dialog.c Fri Aug 29 15:07:08 2008
@@ -117,3 +117,9 @@
{
remove_dialog (plugin, plugin->current_editor_filename);
}
+
+void
+on_fm_git_remove (GtkAction *action, Git *plugin)
+{
+ remove_dialog (plugin, plugin->current_fm_filename);
+}
Modified: trunk/plugins/git/git-remove-dialog.h
==============================================================================
--- trunk/plugins/git/git-remove-dialog.h (original)
+++ trunk/plugins/git/git-remove-dialog.h Fri Aug 29 15:07:08 2008
@@ -29,5 +29,6 @@
#include "git-ui-utils.h"
void on_menu_git_remove (GtkAction *action, Git *plugin);
+void on_fm_git_remove (GtkAction *action, Git *plugin);
#endif
Modified: trunk/plugins/git/git-revert-command.c
==============================================================================
--- trunk/plugins/git/git-revert-command.c (original)
+++ trunk/plugins/git/git-revert-command.c Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-revert-command.h
==============================================================================
--- trunk/plugins/git/git-revert-command.h (original)
+++ trunk/plugins/git/git-revert-command.h Fri Aug 29 15:07:08 2008
@@ -1,22 +1,22 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * anjuta-git
+ * anjuta
* Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * anjuta-git is free software.
+ * anjuta is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * anjuta-git is distributed in the hope that it will be useful,
+ * anjuta 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 anjuta-git. If not, write to:
+ * along with anjuta. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
Modified: trunk/plugins/git/git-revision.c
==============================================================================
--- trunk/plugins/git/git-revision.c (original)
+++ trunk/plugins/git/git-revision.c Fri Aug 29 15:07:08 2008
@@ -1,19 +1,25 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * git-command-test
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * git-command-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.
+ * anjuta is free software.
*
- * git-command-test is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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/>.
+ * You should have received a copy of the GNU General Public License
+ * along with anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#include "git-revision.h"
Modified: trunk/plugins/git/git-revision.h
==============================================================================
--- trunk/plugins/git/git-revision.h (original)
+++ trunk/plugins/git/git-revision.h Fri Aug 29 15:07:08 2008
@@ -1,19 +1,25 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
- * git-command-test
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
*
- * git-command-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.
+ * anjuta is free software.
*
- * git-command-test is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * anjuta 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/>.
+ * You should have received a copy of the GNU General Public License
+ * along with anjuta. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
*/
#ifndef _GIT_REVISION_H_
Modified: trunk/plugins/git/git-ui-utils.h
==============================================================================
--- trunk/plugins/git/git-ui-utils.h (original)
+++ trunk/plugins/git/git-ui-utils.h Fri Aug 29 15:07:08 2008
@@ -62,7 +62,7 @@
void git_report_errors (AnjutaCommand *command, guint return_code);
gchar *git_get_filename_from_full_path (gchar *path);
const gchar *git_get_relative_path (const gchar *path,
- const gchar *working_directory);
+ const gchar *working_directory);
/* Stock signal handlers */
void on_git_command_finished (AnjutaCommand *command, guint return_code,
Modified: trunk/plugins/git/plugin.c
==============================================================================
--- trunk/plugins/git/plugin.c (original)
+++ trunk/plugins/git/plugin.c Fri Aug 29 15:07:08 2008
@@ -43,6 +43,7 @@
#include "git-delete-remote-dialog.h"
#include "git-create-patch-series-dialog.h"
#include "git-pull-dialog.h"
+#include "git-cat-file-menu.h"
#define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta-git.ui"
@@ -328,6 +329,14 @@
G_CALLBACK (on_log_menu_git_commit_diff) /* action callback */
},
{
+ "ActionGitLogViewRevision", /* Action name */
+ GTK_STOCK_FIND, /* Stock icon, if any */
+ N_("_View selected revision"), /* Display label */
+ NULL, /* short-cut */
+ NULL, /* Tooltip */
+ G_CALLBACK (on_log_menu_git_cat_file) /* action callback */
+ },
+ {
"ActionGitLogCreateBranch", /* Action name */
NULL, /* Stock icon, if any */
N_("_Create branch..."), /* Display label */
@@ -385,6 +394,42 @@
}
};
+static GtkActionEntry actions_fm[] =
+{
+ {
+ "ActionMenuGitFM", /* Action name */
+ NULL, /* Stock icon, if any */
+ N_("_Git"), /* Display label */
+ NULL, /* short-cut */
+ NULL, /* Tooltip */
+ NULL /* action callback */
+ },
+ {
+ "ActionGitFMLog", /* Action name */
+ GTK_STOCK_ZOOM_100, /* Stock icon, if any */
+ N_("_View log..."), /* Display label */
+ NULL, /* short-cut */
+ NULL, /* Tooltip */
+ G_CALLBACK (on_fm_git_log) /* action callback */
+ },
+ {
+ "ActionGitFMAdd", /* Action name */
+ GTK_STOCK_ADD, /* Stock icon, if any */
+ N_("_Add..."), /* Display label */
+ NULL, /* short-cut */
+ NULL, /* Tooltip */
+ G_CALLBACK (on_fm_git_add) /* action callback */
+ },
+ {
+ "ActionGitFMRemove", /* Action name */
+ GTK_STOCK_REMOVE, /* Stock icon, if any */
+ N_("_Remove..."), /* Display label */
+ NULL, /* short-cut */
+ NULL, /* Tooltip */
+ G_CALLBACK (on_fm_git_remove) /* action callback */
+ }
+};
+
static void
on_project_root_added (AnjutaPlugin *plugin, const gchar *name,
const GValue *value, gpointer user_data)
@@ -394,6 +439,7 @@
GFile *file;
AnjutaUI *ui;
GtkAction *git_menu_action;
+ GtkAction *git_fm_menu_action;
git_plugin = ANJUTA_PLUGIN_GIT (plugin);
@@ -407,8 +453,12 @@
git_menu_action = anjuta_ui_get_action (ui,
"ActionGroupGit",
"ActionMenuGit");
+ git_fm_menu_action = anjuta_ui_get_action (ui,
+ "ActionGroupGitFM",
+ "ActionMenuGitFM");
gtk_action_set_sensitive (git_menu_action, TRUE);
+ gtk_action_set_sensitive (git_fm_menu_action, TRUE);
gtk_widget_set_sensitive (git_plugin->log_viewer, TRUE);
g_free (project_root_uri);
@@ -420,7 +470,9 @@
on_project_root_removed (AnjutaPlugin *plugin, const gchar *name,
gpointer user_data)
{
+ AnjutaUI *ui;
GtkAction *git_menu_action;
+ GtkAction *git_fm_menu_action;
Git *git_plugin;
git_plugin = ANJUTA_PLUGIN_GIT (plugin);
@@ -428,12 +480,17 @@
g_free (git_plugin->project_root_directory);
git_plugin->project_root_directory = NULL;
- git_menu_action = anjuta_ui_get_action (anjuta_shell_get_ui (plugin->shell,
- NULL),
+ ui = anjuta_shell_get_ui (plugin->shell, NULL);
+
+ git_menu_action = anjuta_ui_get_action (ui,
"ActionGroupGit",
"ActionMenuGit");
+ git_fm_menu_action = anjuta_ui_get_action (ui,
+ "ActionGroupGitFM",
+ "ActionMenuGitFM");
gtk_action_set_sensitive (git_menu_action, FALSE);
+ gtk_action_set_sensitive (git_fm_menu_action, FALSE);
gtk_widget_set_sensitive (git_plugin->log_viewer, FALSE);
git_log_window_clear (git_plugin);
@@ -479,12 +536,39 @@
git_plugin->current_editor_filename = NULL;
}
+static void
+on_fm_file_added (AnjutaPlugin *plugin, const char *name,
+ const GValue *value, gpointer data)
+{
+ Git *git_plugin;
+ GFile *file;
+
+ git_plugin = ANJUTA_PLUGIN_GIT (plugin);
+
+ g_free (git_plugin->current_fm_filename);
+
+ file = G_FILE (g_value_get_object (value));
+ git_plugin->current_fm_filename = g_file_get_path (file);
+}
+
+static void
+on_fm_file_removed (AnjutaPlugin *plugin, const char *name, gpointer data)
+{
+ Git *git_plugin;
+
+ git_plugin = ANJUTA_PLUGIN_GIT (plugin);
+
+ g_free (git_plugin->current_fm_filename);
+ git_plugin->current_fm_filename = NULL;
+}
+
static gboolean
git_activate_plugin (AnjutaPlugin *plugin)
{
AnjutaUI *ui;
Git *git_plugin;
GtkAction *git_menu_action;
+ GtkAction *git_fm_menu_action;
DEBUG_PRINT ("Git: Activating Git plugin ...");
@@ -502,11 +586,16 @@
actions_log,
G_N_ELEMENTS (actions_log),
GETTEXT_PACKAGE, TRUE, plugin);
+ anjuta_ui_add_action_group_entries (ui, "ActionGroupGitFM",
+ _("Git FM operations"),
+ actions_fm,
+ G_N_ELEMENTS (actions_fm),
+ GETTEXT_PACKAGE, TRUE, plugin);
git_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);
git_plugin->log_popup_menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
- "/PopupLog");
+ "/PopupLog");
/* Add watches */
git_plugin->project_root_watch_id = anjuta_plugin_add_watch (plugin,
@@ -521,6 +610,12 @@
on_editor_removed,
NULL);
+ git_plugin->fm_watch_id = anjuta_plugin_add_watch (plugin,
+ IANJUTA_FILE_MANAGER_SELECTED_FILE,
+ on_fm_file_added,
+ on_fm_file_removed,
+ NULL);
+
/* Log viewer */
git_plugin->log_viewer = git_log_window_create (git_plugin);
anjuta_shell_add_widget (plugin->shell,
@@ -540,10 +635,15 @@
NULL),
"ActionGroupGit",
"ActionMenuGit");
+ git_fm_menu_action = anjuta_ui_get_action (anjuta_shell_get_ui (plugin->shell,
+ NULL),
+ "ActionGroupGitFM",
+ "ActionMenuGitFM");
if (!git_plugin->project_root_directory)
{
gtk_action_set_sensitive (git_menu_action, FALSE);
+ gtk_action_set_sensitive (git_fm_menu_action, FALSE);
gtk_widget_set_sensitive (git_plugin->log_viewer, FALSE);
}
@@ -564,6 +664,12 @@
TRUE);
anjuta_plugin_remove_watch (plugin, git_plugin->editor_watch_id,
TRUE);
+ anjuta_plugin_remove_watch (plugin, git_plugin->fm_watch_id,
+ TRUE);
+
+ g_free (git_plugin->project_root_directory);
+ g_free (git_plugin->current_editor_filename);
+ g_free (git_plugin->current_fm_filename);
anjuta_shell_remove_widget (plugin->shell, git_plugin->log_viewer, NULL);
gtk_widget_destroy (git_plugin->log_popup_menu);
Modified: trunk/plugins/git/plugin.h
==============================================================================
--- trunk/plugins/git/plugin.h (original)
+++ trunk/plugins/git/plugin.h Fri Aug 29 15:07:08 2008
@@ -28,6 +28,7 @@
#include <libanjuta/interfaces/ianjuta-message-view.h>
#include <libanjuta/interfaces/ianjuta-file.h>
#include <libanjuta/interfaces/ianjuta-project-manager.h>
+#include <libanjuta/interfaces/ianjuta-file-manager.h>
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/anjuta-debug.h>
@@ -51,11 +52,13 @@
gint uiid;
gchar *project_root_directory;
gchar *current_editor_filename;
+ gchar *current_fm_filename;
IAnjutaMessageView *message_view;
/* Watches */
gint project_root_watch_id;
gint editor_watch_id;
+ gint fm_watch_id;
GtkWidget *log_viewer;
GtkWidget *log_popup_menu;
Modified: trunk/plugins/language-support-cpp-java/plugin.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/plugin.c (original)
+++ trunk/plugins/language-support-cpp-java/plugin.c Fri Aug 29 15:07:08 2008
@@ -1347,7 +1347,6 @@
IAnjutaEditorAttribute attrib;
IAnjutaIterable *iter;
gboolean should_auto_indent = FALSE;
- static GString *stack = NULL;
iter = ianjuta_iterable_clone (insert_pos, NULL);
@@ -1417,34 +1416,50 @@
if (anjuta_preferences_get_int (plugin->prefs, PREF_BRACE_AUTOCOMPLETION))
{
- if (!stack)
- stack = g_string_new ("");
-
if (ch == '[' || ch == '(')
{
- ianjuta_iterable_next (iter, NULL);
-
- switch (ch)
+ gchar *prev_char;
+ IAnjutaIterable *previous;
+
+ previous = ianjuta_iterable_clone (iter, NULL);
+ ianjuta_iterable_previous (previous, NULL);
+ prev_char = ianjuta_editor_get_text (editor, previous, iter, NULL);
+
+ /* If the previous char is a ' we don't have to autocomplete */
+ if (*prev_char != '\'')
{
- case '[': ianjuta_editor_insert (editor, iter,
- "]", 1, NULL);
- g_string_prepend_c (stack, ']');
- break;
- case '(': ianjuta_editor_insert (editor, iter,
- ")", 1, NULL);
- g_string_prepend_c (stack, ')');
- break;
- default: break;
- }
+ ianjuta_iterable_next (iter, NULL);
+
+ switch (ch)
+ {
+ case '[': ianjuta_document_begin_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+ ianjuta_editor_insert (editor, iter,
+ "]", 1, NULL);
+ ianjuta_document_end_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+ break;
+ case '(': ianjuta_document_begin_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+ ianjuta_editor_insert (editor, iter,
+ ")", 1, NULL);
+ ianjuta_document_end_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+ break;
+ default: break;
+ }
- ianjuta_iterable_previous (iter, NULL);
- ianjuta_editor_goto_position (editor, iter, NULL);
+ ianjuta_document_begin_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+ ianjuta_iterable_previous (iter, NULL);
+ ianjuta_editor_goto_position (editor, iter, NULL);
+ ianjuta_document_end_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+ }
+ g_object_unref (previous);
}
- else if (ch == ']' || ch == ')' || ch == '"')
+ else if (ch == ']' || ch == ')' || ch == '"' || ch == '\'')
{
- gchar *str = stack->str;
- gchar *next_char;
- IAnjutaIterable *end;
+ gchar *prev_char;
+ IAnjutaIterable *previous;
+
+ previous = ianjuta_iterable_clone (iter, NULL);
+ ianjuta_iterable_previous (previous, NULL);
+ prev_char = ianjuta_editor_get_text (editor, previous, iter, NULL);
/* First iter*/
ianjuta_iterable_next (iter, NULL);
@@ -1453,34 +1468,33 @@
* If the character is " we have to decide if we need insert
* another " or we have to skip the character
*/
- if (ch == '"' && *str != '"')
+ if (ch == '"' || ch == '\'')
{
- ianjuta_editor_insert (editor, iter,
- "\"", 1, NULL);
- g_string_prepend_c (stack, '"');
-
- ianjuta_iterable_previous (iter, NULL);
- ianjuta_editor_goto_position (editor, iter, NULL);
+ /*
+ * Now we have to detect if we want to manage " as a char
+ */
+ if (*prev_char != '\'' && *prev_char != '\\')
+ {
+ gchar *c;
+
+ if (ch == '"')
+ c = g_strdup ("\"");
+ else c = g_strdup ("'");
+
+ ianjuta_document_begin_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+ ianjuta_editor_insert (editor, iter, c, 1, NULL);
+
+ ianjuta_iterable_previous (iter, NULL);
+ ianjuta_editor_goto_position (editor, iter, NULL);
+ ianjuta_document_end_undo_action (IANJUTA_DOCUMENT (editor), NULL);
+
+ g_free (c);
+ }
+ g_object_unref (previous);
g_object_unref (iter);
return;
}
-
- /* End iter*/
- end = ianjuta_iterable_clone (iter, NULL);
- ianjuta_iterable_next (end, NULL);
-
- next_char = ianjuta_editor_get_text (editor, iter, end, NULL);
-
- if (ch == *str && ch == *next_char)
- {
- g_string_erase (stack, 0, 1);
- ianjuta_editor_erase (editor, iter, end, NULL);
- }
- else {
- g_string_free (stack, TRUE);
- stack = g_string_new ("");
- }
- g_object_unref (end);
+ g_object_unref (previous);
}
}
g_object_unref (iter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]