[Geany] VCdiff plugin

Yura Siamashka yurand2 at xxxxx
Wed Nov 14 21:42:11 UTC 2007


On Wed, Nov 14, 2007 at 04:53:19PM +0000, Nick Treleaven wrote:
> 
> I made some changes so that more information about each version control
> system is held in the VC_RECORD struct. If you have time, could you
> test that it still works as expected for GIT?
Works fine, thanks.

> 
> Also is it necessary to have a separate ENV for each command? Perhaps
> one ENV per VC system would be sufficient?
Perhaps.


Here is another little patch for this plugin. 
It adds check if project directory is actually VC dir. 
Also don't call find_cmd_env if doc->filename is NULL.

Best regards,
Yura Siamashka
-------------- next part --------------
Index: plugins/vcdiff.c
===================================================================
--- plugins/vcdiff.c	(revision 2048)
+++ plugins/vcdiff.c	(working copy)
@@ -458,17 +458,21 @@
 {
 	document	*doc;
 	gboolean	have_file;
-	gboolean    have_vc = FALSE;
+	gboolean	have_vc = FALSE;
+	gboolean	project_have_vc = FALSE;
 
 	doc = documents->get_current();
 	have_file = doc && doc->file_name && g_path_is_absolute(doc->file_name);
-	if (find_cmd_env(VC_COMMAND_DIFF_FILE, TRUE, doc->file_name))
+	if (have_file && find_cmd_env(VC_COMMAND_DIFF_FILE, TRUE, doc->file_name))
 		have_vc = TRUE;
+	
+	if (project != NULL && NZV(project->base_path) &&
+			find_cmd_env(VC_COMMAND_DIFF_DIR, TRUE, project->base_path))
+		project_have_vc = TRUE;
 
-	gtk_widget_set_sensitive(menu_vcdiff_file, have_vc && have_file);
-	gtk_widget_set_sensitive(menu_vcdiff_dir, have_vc && have_file);
-	gtk_widget_set_sensitive(menu_vcdiff_project,
-		project != NULL && NZV(project->base_path));
+	gtk_widget_set_sensitive(menu_vcdiff_file, have_vc);
+	gtk_widget_set_sensitive(menu_vcdiff_dir, have_vc);
+	gtk_widget_set_sensitive(menu_vcdiff_project, project_have_vc);
 }
 
 


More information about the Users mailing list