Revision: 410 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=410&view=rev Author: kugel- Date: 2009-01-30 01:08:23 +0000 (Fri, 30 Jan 2009)
Log Message: ----------- revert for current dir and basedir for subversion, I hope it's ok :)
Modified Paths: -------------- branches/GeanyVC_menu_redesign/geanyvc.c branches/GeanyVC_menu_redesign/geanyvc.h branches/GeanyVC_menu_redesign/vc_svn.c
Modified: branches/GeanyVC_menu_redesign/geanyvc.c =================================================================== --- branches/GeanyVC_menu_redesign/geanyvc.c 2009-01-28 21:59:09 UTC (rev 409) +++ branches/GeanyVC_menu_redesign/geanyvc.c 2009-01-30 01:08:23 UTC (rev 410) @@ -126,7 +126,9 @@ VC_COMMIT, VC_STATUS, VC_UPDATE, - VC_REVERT, + VC_REVERT_FILE, + VC_REVERT_DIR, + VC_REVERT_BASEDIR, COUNT_KB };
@@ -437,7 +439,6 @@ { return 0; } - for (cur = largv; cur != NULL; cur = g_slist_next(cur)) { argv = cur->data; @@ -861,6 +862,11 @@ vc = find_vc(dir); g_return_val_if_fail(vc, FALSE);
+ if (flags & FLAG_BASEDIR) + { + dir = vc->get_base_dir(dir); + } + if (doc->changed) { document_save_file(doc, FALSE); @@ -872,7 +878,7 @@ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, question, - (flags & FLAG_DIR ? dir : doc->file_name)); + (flags & (FLAG_DIR|FLAG_BASEDIR) ? dir : doc->file_name)); result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } @@ -885,11 +891,12 @@ { if (flags & FLAG_FILE) execute_command(vc, text, NULL, doc->file_name, cmd, NULL, NULL); - if (flags & FLAG_DIR) + if (flags & (FLAG_DIR|FLAG_BASEDIR)) execute_command(vc, text, NULL, dir, cmd, NULL, NULL); if (flags & FLAG_RELOAD) document_reload_file(doc, NULL); } + g_free(dir); return (result == GTK_RESPONSE_YES); }
@@ -902,6 +909,14 @@ }
static void +vcrevert_dir_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, gint gdata) +{ + command_with_question_activated(NULL, VC_COMMAND_REVERT_DIR, + _("Do you really want to revert: %s?"), + FLAG_RELOAD | gdata | FLAG_FORCE_ASK); +} + +static void vcadd_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gdata) { command_with_question_activated(NULL, VC_COMMAND_ADD, @@ -1470,6 +1485,8 @@ static GtkWidget *menu_vc_log_basedir = NULL; static GtkWidget *menu_vc_status = NULL; static GtkWidget *menu_vc_revert_file = NULL; +static GtkWidget *menu_vc_revert_dir = NULL; +static GtkWidget *menu_vc_revert_basedir = NULL; static GtkWidget *menu_vc_add_file = NULL; static GtkWidget *menu_vc_remove_file = NULL; static GtkWidget *menu_vc_update = NULL; @@ -1513,6 +1530,8 @@ gtk_widget_set_sensitive(menu_vc_status, d_have_vc);
gtk_widget_set_sensitive(menu_vc_revert_file, f_have_vc); + gtk_widget_set_sensitive(menu_vc_revert_dir, f_have_vc); + gtk_widget_set_sensitive(menu_vc_revert_basedir, f_have_vc);
gtk_widget_set_sensitive(menu_vc_remove_file, f_have_vc); gtk_widget_set_sensitive(menu_vc_add_file, d_have_vc && !f_have_vc); @@ -1553,12 +1572,24 @@ }
static void -kbrevert(G_GNUC_UNUSED guint key_id) +kbrevert_file(G_GNUC_UNUSED guint key_id) { vcrevert_activated(NULL, NULL); }
static void +kbrevert_dir(G_GNUC_UNUSED guint key_id) +{ + vcrevert_dir_activated(NULL, FLAG_DIR); +} + +static void +kbrevert_basedir(G_GNUC_UNUSED guint key_id) +{ + vcrevert_dir_activated(NULL, FLAG_BASEDIR); +} + +static void kbupdate(G_GNUC_UNUSED guint key_id) { vcupdate_activated(NULL, NULL); @@ -1945,7 +1976,7 @@ g_signal_connect((gpointer) menu_vc_add_file, "activate", G_CALLBACK(vcadd_activated), NULL);
- /* revert current file */ + /* remove current file */ menu_vc_remove_file = gtk_menu_item_new_with_mnemonic(_("_Remove from Version Control")); gtk_container_add(GTK_CONTAINER(cur_file_menu), menu_vc_remove_file); gtk_tooltips_set_tip(*tooltips, menu_vc_remove_file, @@ -1976,6 +2007,15 @@ g_signal_connect((gpointer) menu_vc_diff_dir, "activate", G_CALLBACK(vcdiff_dir_activated), NULL);
+ /* Revert current dir */ + menu_vc_revert_dir = gtk_menu_item_new_with_mnemonic(_("_Revert")); + gtk_container_add(GTK_CONTAINER(cur_dir_menu), menu_vc_revert_dir); + gtk_tooltips_set_tip(*tooltips, menu_vc_revert_dir, + _("Restore original files in the current folder (undo local edits)."), NULL); + + g_signal_connect((gpointer) menu_vc_revert_dir, "activate", + G_CALLBACK(vcrevert_dir_activated), (gpointer)FLAG_DIR); + gtk_container_add(GTK_CONTAINER(cur_dir_menu), gtk_separator_menu_item_new()); /* History/log of the current dir */ menu_vc_log_dir = gtk_menu_item_new_with_mnemonic(_("_History")); @@ -2007,6 +2047,15 @@ g_signal_connect((gpointer) menu_vc_diff_basedir, "activate", G_CALLBACK(vcdiff_basedir_activated), NULL);
+ /* Revert everything */ + menu_vc_revert_basedir = gtk_menu_item_new_with_mnemonic(_("_Revert")); + gtk_container_add(GTK_CONTAINER(basedir_menu), menu_vc_revert_basedir); + gtk_tooltips_set_tip(*tooltips, menu_vc_revert_basedir, + _("Revert any local edits."), NULL); + + g_signal_connect((gpointer) menu_vc_revert_basedir, "activate", + G_CALLBACK(vcrevert_dir_activated), (gpointer)FLAG_BASEDIR); + gtk_container_add(GTK_CONTAINER(basedir_menu), gtk_separator_menu_item_new()); g_signal_connect((gpointer) menu_vc_log_dir, "activate", G_CALLBACK(vclog_dir_activated), NULL); @@ -2028,22 +2077,24 @@ init_keybindings(void) { /* init keybindins */ - keybindings_set_item(plugin_key_group, VC_DIFF_FILE, kbdiff_file, - 0, 0, "vc_show_diff_of_file", _("Show diff of file"), - menu_vc_diff_file); - keybindings_set_item(plugin_key_group, VC_DIFF_DIR, kbdiff_dir, 0, 0, "vc_show_diff_of_dir", - _("Show diff of diretory"), menu_vc_diff_dir); + keybindings_set_item(plugin_key_group, VC_DIFF_FILE, kbdiff_file, 0, 0, + "vc_show_diff_of_file", _("Show diff of file"), menu_vc_diff_file); + keybindings_set_item(plugin_key_group, VC_DIFF_DIR, kbdiff_dir, 0, 0, + "vc_show_diff_of_dir", _("Show diff of diretory"), menu_vc_diff_dir); keybindings_set_item(plugin_key_group, VC_DIFF_BASEDIR, kbdiff_basedir, 0, 0, - "vc_show_diff_of_basedir", _("Show diff of basedir"), - menu_vc_diff_basedir); - keybindings_set_item(plugin_key_group, VC_COMMIT, kbcommit, 0, 0, "vc_commit", - _("Commit changes"), menu_vc_commit); - keybindings_set_item(plugin_key_group, VC_STATUS, kbstatus, 0, 0, "vc_status", - _("Show status"), menu_vc_status); - keybindings_set_item(plugin_key_group, VC_REVERT, kbrevert, 0, 0, "vc_revert", - _("Revert changes"), menu_vc_revert_file); - keybindings_set_item(plugin_key_group, VC_UPDATE, kbupdate, 0, 0, "vc_update", - _("Update file"), menu_vc_update); + "vc_show_diff_of_basedir", _("Show diff of basedir"), menu_vc_diff_basedir); + keybindings_set_item(plugin_key_group, VC_COMMIT, kbcommit, 0, 0, + "vc_commit", _("Commit changes"), menu_vc_commit); + keybindings_set_item(plugin_key_group, VC_STATUS, kbstatus, 0, 0, + "vc_status", _("Show status"), menu_vc_status); + keybindings_set_item(plugin_key_group, VC_REVERT_FILE, kbrevert_file, 0, 0, + "vc_revert_file", _("Revert single file"), menu_vc_revert_file); + keybindings_set_item(plugin_key_group, VC_REVERT_DIR, kbrevert_dir, 0, 0, + "vc_revert_dir", _("Revert whole directory"),menu_vc_revert_dir); + keybindings_set_item(plugin_key_group, VC_REVERT_BASEDIR, kbrevert_basedir, 0, 0, + "vc_revert_basedir", _("Revert whole tree"), menu_vc_revert_basedir); + keybindings_set_item(plugin_key_group, VC_UPDATE, kbupdate, 0, 0, + "vc_update", _("Update file"), menu_vc_update); }
/* Called by Geany to initialize the plugin */
Modified: branches/GeanyVC_menu_redesign/geanyvc.h =================================================================== --- branches/GeanyVC_menu_redesign/geanyvc.h 2009-01-28 21:59:09 UTC (rev 409) +++ branches/GeanyVC_menu_redesign/geanyvc.h 2009-01-30 01:08:23 UTC (rev 410) @@ -27,6 +27,7 @@ VC_COMMAND_DIFF_FILE, VC_COMMAND_DIFF_DIR, VC_COMMAND_REVERT_FILE, + VC_COMMAND_REVERT_DIR, VC_COMMAND_STATUS, VC_COMMAND_ADD, VC_COMMAND_REMOVE, @@ -55,6 +56,7 @@ #define FLAG_FORCE_ASK (1<<1) #define FLAG_FILE (1<<2) #define FLAG_DIR (1<<3) +#define FLAG_BASEDIR (1<<4)
#define P_ABS_DIRNAME "*<?geanyvcDIRNAME>*" #define P_ABS_FILENAME "*<?geanyvcFILENAME>*"
Modified: branches/GeanyVC_menu_redesign/vc_svn.c =================================================================== --- branches/GeanyVC_menu_redesign/vc_svn.c 2009-01-28 21:59:09 UTC (rev 409) +++ branches/GeanyVC_menu_redesign/vc_svn.c 2009-01-30 01:08:23 UTC (rev 410) @@ -38,6 +38,7 @@ { "svn", "diff", "--non-interactive", BASE_FILENAME, NULL }; static const gchar *SVN_CMD_DIFF_DIR[] = { "svn", "diff", "--non-interactive", BASE_DIRNAME, NULL }; static const gchar *SVN_CMD_REVERT_FILE[] = { "svn", "revert", BASENAME, NULL }; +static const gchar *SVN_CMD_REVERT_DIR[] = { "svn", "revert", BASE_DIRNAME, "-R", NULL }; static const gchar *SVN_CMD_STATUS[] = { "svn", "status", NULL }; static const gchar *SVN_CMD_ADD[] = { "svn", "add", BASENAME, NULL }; static const gchar *SVN_CMD_REMOVE[] = { "svn", "rm", BASENAME, NULL }; @@ -67,6 +68,11 @@ .function = NULL}, { .startdir = VC_COMMAND_STARTDIR_FILE, + .command = SVN_CMD_REVERT_DIR, + .env = NULL, + .function = NULL}, + { + .startdir = VC_COMMAND_STARTDIR_FILE, .command = SVN_CMD_STATUS, .env = NULL, .function = NULL},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org