Revision: 416 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=416&view=rev Author: kugel- Date: 2009-01-31 20:30:11 +0000 (Sat, 31 Jan 2009)
Log Message: ----------- Implement (the currently unused) VC_COMMAND_SHOW, which is supposed to return the base-version (i.e. unchanged version) of the current file. Working for svn, however the output isn't syntax-highlightened (FIXME, I didn't figured out how to do that)
Modified Paths: -------------- branches/GeanyVC_menu_redesign/geanyvc.c branches/GeanyVC_menu_redesign/vc_svn.c
Modified: branches/GeanyVC_menu_redesign/geanyvc.c =================================================================== --- branches/GeanyVC_menu_redesign/geanyvc.c 2009-01-31 19:59:05 UTC (rev 415) +++ branches/GeanyVC_menu_redesign/geanyvc.c 2009-01-31 20:30:11 UTC (rev 416) @@ -674,7 +674,7 @@ { gchar *name; name = g_strconcat(dir, ".vc.diff", NULL); - show_output(text, name, NULL); + show_output(text, name, doc->encoding); g_free(text); g_free(name); } @@ -816,6 +816,27 @@ g_free(base_name); }
+static void +vcshow_file_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gdata) +{ + gchar *output = NULL; + const VC_RECORD *vc; + GeanyDocument *doc; + + doc = document_get_current(); + g_return_if_fail(doc != NULL && doc->file_name != NULL); + + vc = find_vc(doc->file_name); + g_return_if_fail(vc); + + execute_command(vc, &output, NULL, doc->file_name, VC_COMMAND_SHOW, NULL, NULL); + if (output) + { + show_output(output, "*VC-ORIG*", NULL); + g_free(output); + } +} + static gboolean command_with_question_activated(gchar ** text, gint cmd, const gchar * question, gint flags) { @@ -1461,6 +1482,7 @@ static GtkWidget *menu_vc_remove_file = NULL; static GtkWidget *menu_vc_update = NULL; static GtkWidget *menu_vc_commit = NULL; +static GtkWidget *menu_vc_show_file = NULL;
static void update_menu_items() @@ -1508,6 +1530,8 @@
gtk_widget_set_sensitive(menu_vc_update, d_have_vc); gtk_widget_set_sensitive(menu_vc_commit, d_have_vc); + + gtk_widget_set_sensitive(menu_vc_show_file, f_have_vc); }
@@ -1935,7 +1959,16 @@ g_signal_connect((gpointer) menu_vc_log_file, "activate", G_CALLBACK(vclog_file_activated), NULL);
+ /* base version of the current file */ + menu_vc_show_file = gtk_menu_item_new_with_mnemonic(_("_Original")); + gtk_container_add(GTK_CONTAINER(cur_file_menu), menu_vc_show_file); + gtk_tooltips_set_tip(*tooltips, menu_vc_log_file, + _("Shows the orignal of the current file"), NULL);
+ g_signal_connect((gpointer) menu_vc_show_file, "activate", + G_CALLBACK(vcshow_file_activated), NULL); + + gtk_container_add(GTK_CONTAINER(cur_file_menu), gtk_separator_menu_item_new());
/* add current file */
Modified: branches/GeanyVC_menu_redesign/vc_svn.c =================================================================== --- branches/GeanyVC_menu_redesign/vc_svn.c 2009-01-31 19:59:05 UTC (rev 415) +++ branches/GeanyVC_menu_redesign/vc_svn.c 2009-01-31 20:30:11 UTC (rev 416) @@ -47,7 +47,7 @@ static const gchar *SVN_CMD_COMMIT[] = { "svn", "commit", "--non-interactive", "-m", MESSAGE, FILE_LIST, NULL }; static const gchar *SVN_CMD_BLAME[] = { "svn", "blame", BASENAME, NULL }; -static const gchar *SVN_CMD_SHOW[] = { "svn", "cat", BASENAME, NULL }; +static const gchar *SVN_CMD_SHOW[] = { "svn", "cat", "-rBASE", BASENAME, NULL }; static const gchar *SVN_CMD_UPDATE[] = { "svn", "up", NULL };
static const VC_COMMAND commands[] = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org