[giggle] Add UI and command line option for the clone command
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [giggle] Add UI and command line option for the clone command
- Date: Fri, 7 May 2010 03:33:31 +0000 (UTC)
commit c873b0c98e5b04f18e6e4d4470f203d2851e531b
Author: Florian Müllner <florian muellner gmail com>
Date: Fri May 7 04:36:26 2010 +0200
Add UI and command line option for the clone command
https://bugzilla.gnome.org/show_bug.cgi?id=608267
src/giggle-main.c | 26 ++++++++++++++++++++++++--
src/giggle-window.c | 23 +++++++++++++++++++++++
2 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/src/giggle-main.c b/src/giggle-main.c
index 8f6dc5a..962bd3f 100644
--- a/src/giggle-main.c
+++ b/src/giggle-main.c
@@ -20,6 +20,7 @@
#include "config.h"
#include "giggle-window.h"
+#include "giggle-clone-dialog.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -28,9 +29,14 @@
static gboolean diff_window = FALSE;
static gboolean version = FALSE;
+static gchar *clone_uri = NULL;
static gchar **dirs = NULL;
static GOptionEntry options[] = {
+ { "clone", 'c',
+ 0, G_OPTION_ARG_FILENAME, &clone_uri,
+ N_("Clone a repository"),
+ N_("URL") },
{ "diff", 'd',
0, G_OPTION_ARG_NONE, &diff_window,
N_("Show the diff window"),
@@ -120,15 +126,31 @@ main (int argc,
dir = g_get_current_dir ();
}
}
-
g_unsetenv ("GIT_DIR");
+ if (clone_uri) {
+ GtkWidget *clone_dialog;
+ GtkResponseType response;
+ gchar *clone_dir;
+
+ clone_dir = g_strdup (dir);
+ clone_dialog = giggle_clone_dialog_new (clone_uri, clone_dir);
+ g_free (clone_dir);
+
+ response = gtk_dialog_run (GTK_DIALOG (clone_dialog));
+ if (response == GTK_RESPONSE_ACCEPT) {
+ /* replace dir with the the newly cloned repo's one */
+ g_free (dir);
+ dir = g_strdup (giggle_clone_dialog_get_directory (GIGGLE_CLONE_DIALOG (clone_dialog)));
+ }
+ gtk_widget_destroy (clone_dialog);
+ }
+
if (giggle_git_test_dir (dir)) {
giggle_window_set_directory (GIGGLE_WINDOW (window), dir);
} else {
gtk_widget_show (window);
}
-
g_free (dir);
/* window will show itself when it reads its initial size configuration */
diff --git a/src/giggle-window.c b/src/giggle-window.c
index d3695f5..b24cab9 100644
--- a/src/giggle-window.c
+++ b/src/giggle-window.c
@@ -24,6 +24,7 @@
#include "giggle-window.h"
#include "eggfindbar.h"
+#include "giggle-clone-dialog.h"
#include "giggle-diff-window.h"
#include "giggle-helpers.h"
#include "giggle-view-file.h"
@@ -708,6 +709,23 @@ window_action_open_cb (GtkAction *action,
}
static void
+window_action_clone_cb (GtkAction *action,
+ GiggleWindow *window)
+{
+ GtkWidget *clone_dialog;
+
+ clone_dialog = giggle_clone_dialog_new (NULL, NULL);
+ gtk_window_set_transient_for (GTK_WINDOW (clone_dialog),
+ GTK_WINDOW (window));
+ if (gtk_dialog_run (GTK_DIALOG (clone_dialog)) == GTK_RESPONSE_ACCEPT)
+ giggle_window_set_directory (window,
+ giggle_clone_dialog_get_directory (
+ GIGGLE_CLONE_DIALOG (clone_dialog)
+ ));
+ gtk_widget_destroy (clone_dialog);
+}
+
+static void
window_action_properties_cb (GtkAction *action,
GiggleWindow *window)
{
@@ -1079,6 +1097,10 @@ window_create_ui_manager (GiggleWindow *window)
NULL, N_("Open a git repository"),
G_CALLBACK (window_action_open_cb)
},
+ { "Clone", NULL,
+ N_("Clone _location"), "<control>L", N_("Clone a location"),
+ G_CALLBACK (window_action_clone_cb)
+ },
#if 0
{ "SavePatch", GTK_STOCK_SAVE,
N_("_Save patch"), "<control>S", N_("Save a patch"),
@@ -1153,6 +1175,7 @@ window_create_ui_manager (GiggleWindow *window)
" <menubar name='MainMenubar'>"
" <menu action='ProjectMenu'>"
" <menuitem action='Open'/>"
+ " <menuitem action='Clone'/>"
#if 0
" <menuitem action='SavePatch'/>"
" <menuitem action='Diff'/>"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]