Index: geany-plugins/geanyvc/geanyvc.c
===================================================================
--- geany-plugins/geanyvc/geanyvc.c	(Revision 385)
+++ geany-plugins/geanyvc/geanyvc.c	(Arbeitskopie)
@@ -1889,149 +1889,228 @@
 	REGISTER_VC(HG, enable_hg);
 }
 
-/* Called by Geany to initialize the plugin */
-void
-plugin_init(G_GNUC_UNUSED GeanyData * data)
+static void
+current_file_menu(GtkWidget **parent_menu, GtkTooltips **tooltips)
 {
-	GtkWidget *menu_vc = NULL;
-	GtkWidget *menu_vc_menu = NULL;
-	GtkTooltips *tooltips = NULL;
+	GtkWidget *menu_current_file_menu = NULL;
+    /* Menu which will hold the items in the current file menu */
+	menu_current_file_menu = gtk_menu_new();
 
-	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
+	*parent_menu = gtk_image_menu_item_new_with_mnemonic(_("Current _File"));
+	g_signal_connect((gpointer) *parent_menu, "activate", G_CALLBACK(update_menu_items), NULL);
 
-	config_file =
-		g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S,
-			    "VC", G_DIR_SEPARATOR_S, "VC.conf", NULL);
-
-	load_config();
-	registrate();
-
-	tooltips = gtk_tooltips_new();
-
-	menu_vc = gtk_image_menu_item_new_with_mnemonic(_("_VC"));
-	gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_vc);
-
-	g_signal_connect((gpointer) menu_vc, "activate", G_CALLBACK(update_menu_items), NULL);
-
-	menu_vc_menu = gtk_menu_new();
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_vc), menu_vc_menu);
-
-	// Single file
-	menu_vc_diff_file = gtk_menu_item_new_with_mnemonic(_("Diff From Current File"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_diff_file);
-	gtk_tooltips_set_tip(tooltips, menu_vc_diff_file,
+    /* Diff of current file */
+	menu_vc_diff_file = gtk_menu_item_new_with_mnemonic(_("_Diff"));
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), menu_vc_diff_file);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_diff_file,
 			     _("Make a diff from the current active file"), NULL);
 
 	g_signal_connect((gpointer) menu_vc_diff_file, "activate",
 			 G_CALLBACK(vcdiff_file_activated), NULL);
 
-	// Directory
-	menu_vc_diff_dir = gtk_menu_item_new_with_mnemonic(_("Diff From Current Directory"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_diff_dir);
-	gtk_tooltips_set_tip(tooltips, menu_vc_diff_dir,
-			     _("Make a diff from the directory of the current active file"), NULL);
+	/* Revert current file */
+	menu_vc_revert_file = gtk_menu_item_new_with_mnemonic(_("_Revert"));
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), menu_vc_revert_file);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_revert_file,
+			     _("Restore pristine working copy file (undo local edits)."), NULL);
 
-	g_signal_connect((gpointer) menu_vc_diff_dir, "activate",
-			 G_CALLBACK(vcdiff_dir_activated), NULL);
+	g_signal_connect((gpointer) menu_vc_revert_file, "activate",
+			 G_CALLBACK(vcrevert_activated), NULL);
 
-	// Base directory
-	menu_vc_diff_basedir = gtk_menu_item_new_with_mnemonic(_("Diff From Base Directory"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_diff_basedir);
-	gtk_tooltips_set_tip(tooltips, menu_vc_diff_basedir,
-			     _("Make a diff from the top VC directory"), NULL);
 
-	g_signal_connect((gpointer) menu_vc_diff_basedir, "activate",
-			 G_CALLBACK(vcdiff_basedir_activated), NULL);
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), gtk_separator_menu_item_new());
 
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
 
-	// Blame for current file
-	menu_vc_blame = gtk_menu_item_new_with_mnemonic(_("Blame From Current File"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_blame);
-	gtk_tooltips_set_tip(tooltips, menu_vc_blame,
+	/* Blame for current file */
+	menu_vc_blame = gtk_menu_item_new_with_mnemonic(_("_Blame"));
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), menu_vc_blame);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_blame,
 			     _("Shows the changes made at one file per revision and author."),
 			     NULL);
 
 	g_signal_connect((gpointer) menu_vc_blame, "activate", G_CALLBACK(vcblame_activated), NULL);
 
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), gtk_separator_menu_item_new());
 
-	// Log
-	menu_vc_log_file = gtk_menu_item_new_with_mnemonic(_("Log Of Current File"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_log_file);
-	gtk_tooltips_set_tip(tooltips, menu_vc_log_file,
+	/* History/log of current file */
+	menu_vc_log_file = gtk_menu_item_new_with_mnemonic(_("_History"));
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), menu_vc_log_file);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_log_file,
 			     _("Shows the log of the current file"), NULL);
 
 	g_signal_connect((gpointer) menu_vc_log_file, "activate",
 			 G_CALLBACK(vclog_file_activated), NULL);
 
-	menu_vc_log_dir = gtk_menu_item_new_with_mnemonic(_("Log Of Current Directory"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_log_dir);
-	gtk_tooltips_set_tip(tooltips, menu_vc_log_dir,
+
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), gtk_separator_menu_item_new());
+
+	/* add current file */
+	menu_vc_add_file = gtk_menu_item_new_with_mnemonic(_("_Add to Version Control"));
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), menu_vc_add_file);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_add_file, _("Add file to repository."), NULL);
+
+	g_signal_connect((gpointer) menu_vc_add_file, "activate",
+			 G_CALLBACK(vcadd_activated), NULL);
+
+	/* revert current file */
+	menu_vc_remove_file = gtk_menu_item_new_with_mnemonic(_("_Remove from Version Control"));
+	gtk_container_add(GTK_CONTAINER(menu_current_file_menu), menu_vc_remove_file);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_remove_file,
+			     _("Remove file from repository."), NULL);
+
+	g_signal_connect((gpointer) menu_vc_remove_file, "activate",
+			 G_CALLBACK(vcremove_activated), NULL);
+
+    /* connect to parent menu */
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(*parent_menu), menu_current_file_menu);
+}
+
+static void
+current_dir_menu(GtkWidget **parent_menu, GtkTooltips **tooltips)
+{
+    GtkWidget *menu_current_dir_menu = NULL;
+    /* Menu which will hold the items in the current file menu */
+	menu_current_dir_menu = gtk_menu_new();
+
+	*parent_menu = gtk_image_menu_item_new_with_mnemonic(_("Current _Directory"));
+	g_signal_connect((gpointer) *parent_menu, "activate", G_CALLBACK(update_menu_items), NULL);
+	/* Diff of the current dir */
+	menu_vc_diff_dir = gtk_menu_item_new_with_mnemonic(_("_Diff"));
+	gtk_container_add(GTK_CONTAINER(menu_current_dir_menu), menu_vc_diff_dir);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_diff_dir,
+			     _("Make a diff from the directory of the current active file"), NULL);
+
+	g_signal_connect((gpointer) menu_vc_diff_dir, "activate",
+			 G_CALLBACK(vcdiff_dir_activated), NULL);
+
+	gtk_container_add(GTK_CONTAINER(menu_current_dir_menu), gtk_separator_menu_item_new());
+    /* History/log of the current dir */
+	menu_vc_log_dir = gtk_menu_item_new_with_mnemonic(_("_History"));
+	gtk_container_add(GTK_CONTAINER(menu_current_dir_menu), menu_vc_log_dir);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_log_dir,
 			     _("Shows the log of the current directory"), NULL);
 
+
+    /* connect to parent menu */
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(*parent_menu), menu_current_dir_menu);
+}
+
+static void
+basedir_menu(GtkWidget **parent_menu, GtkTooltips **tooltips)
+{
+    GtkWidget *menu_basedir_menu = NULL;
+    /* Menu which will hold the items in the current file menu */
+	menu_basedir_menu = gtk_menu_new();
+
+	*parent_menu = gtk_image_menu_item_new_with_mnemonic(_("Current _Basedirectory"));
+	g_signal_connect((gpointer) *parent_menu, "activate", G_CALLBACK(update_menu_items), NULL);
+
+	/* Complete diff of base directory */
+	menu_vc_diff_basedir = gtk_menu_item_new_with_mnemonic(_("_Diff"));
+	gtk_container_add(GTK_CONTAINER(menu_basedir_menu), menu_vc_diff_basedir);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_diff_basedir,
+			     _("Make a diff from the top VC directory"), NULL);
+
+	g_signal_connect((gpointer) menu_vc_diff_basedir, "activate",
+			 G_CALLBACK(vcdiff_basedir_activated), NULL);
+
+	gtk_container_add(GTK_CONTAINER(menu_basedir_menu), gtk_separator_menu_item_new());
 	g_signal_connect((gpointer) menu_vc_log_dir, "activate",
 			 G_CALLBACK(vclog_dir_activated), NULL);
 
-	menu_vc_log_basedir = gtk_menu_item_new_with_mnemonic(_("Log Of Base Directory"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_log_basedir);
-	gtk_tooltips_set_tip(tooltips, menu_vc_log_basedir,
+    /* Complete History/Log of base directory */
+	menu_vc_log_basedir = gtk_menu_item_new_with_mnemonic(_("_History"));
+	gtk_container_add(GTK_CONTAINER(menu_basedir_menu), menu_vc_log_basedir);
+	gtk_tooltips_set_tip(*tooltips, menu_vc_log_basedir,
 			     _("Shows the log of the top VC directory"), NULL);
 
 	g_signal_connect((gpointer) menu_vc_log_basedir, "activate",
 			 G_CALLBACK(vclog_basedir_activated), NULL);
 
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
+	/* connect to parent menu */
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(*parent_menu), menu_basedir_menu);
+}
 
-	// Status
-	menu_vc_status = gtk_menu_item_new_with_mnemonic(_("_Status"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_status);
-	gtk_tooltips_set_tip(tooltips, menu_vc_status, _("Show status."), NULL);
+static void
+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_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);
+}
 
-	g_signal_connect((gpointer) menu_vc_status, "activate",
-			 G_CALLBACK(vcstatus_activated), NULL);
+/* Called by Geany to initialize the plugin */
+void
+plugin_init(G_GNUC_UNUSED GeanyData * data)
+{
+	GtkWidget *menu_vc = NULL;
+	GtkWidget *menu_vc_menu = NULL;
+	GtkWidget *menu_vc_file = NULL;
+	GtkWidget *menu_vc_dir = NULL;
+	GtkWidget *menu_vc_basedir = NULL;
+	GtkTooltips *tooltips = NULL;
 
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
+	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
 
-	// Revert file
-	menu_vc_revert_file = gtk_menu_item_new_with_mnemonic(_("_Revert File"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_revert_file);
-	gtk_tooltips_set_tip(tooltips, menu_vc_revert_file,
-			     _("Restore pristine working copy file (undo local edits)."), NULL);
+	config_file =
+		g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S,
+				"VC", G_DIR_SEPARATOR_S, "VC.conf", NULL);
 
-	g_signal_connect((gpointer) menu_vc_revert_file, "activate",
-			 G_CALLBACK(vcrevert_activated), NULL);
+	load_config();
+	registrate();
 
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
+	tooltips = gtk_tooltips_new();
 
-	// Add file
-	menu_vc_add_file = gtk_menu_item_new_with_mnemonic(_("_Add File"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_add_file);
-	gtk_tooltips_set_tip(tooltips, menu_vc_add_file, _("Add file to repository."), NULL);
+	menu_vc = gtk_image_menu_item_new_with_mnemonic(_("_VC"));
+	gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), menu_vc);
 
-	g_signal_connect((gpointer) menu_vc_add_file, "activate",
-			 G_CALLBACK(vcadd_activated), NULL);
+	g_signal_connect((gpointer) menu_vc, "activate", G_CALLBACK(update_menu_items), NULL);
 
-	// Remove file
-	menu_vc_remove_file = gtk_menu_item_new_with_mnemonic(_("Remove File"));
-	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_remove_file);
-	gtk_tooltips_set_tip(tooltips, menu_vc_remove_file,
-			     _("Remove file from repository."), NULL);
+	menu_vc_menu = gtk_menu_new();
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_vc), menu_vc_menu);
 
-	g_signal_connect((gpointer) menu_vc_remove_file, "activate",
-			 G_CALLBACK(vcremove_activated), NULL);
+	/* Create the current file Submenu */
+	current_file_menu(&menu_vc_file, &tooltips);
+	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_file);
+	/* Create the current directory Submenu */
+	current_dir_menu(&menu_vc_dir, &tooltips);
+	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_dir);
+	/* Create the current base directory Submenu */
+	basedir_menu(&menu_vc_basedir, &tooltips);
+	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_basedir);
 
 	gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
+    /* Status of basedir */
+	menu_vc_status = gtk_menu_item_new_with_mnemonic(_("_Status"));
+	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_status);
+	gtk_tooltips_set_tip(tooltips, menu_vc_status, _("Show status."), NULL);
 
-	// Update
-	menu_vc_update = gtk_menu_item_new_with_mnemonic(_("Update"));
+	g_signal_connect((gpointer) menu_vc_status, "activate",
+			 G_CALLBACK(vcstatus_activated), NULL);
+
+	gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
+	/* complete update */
+	menu_vc_update = gtk_menu_item_new_with_mnemonic(_("_Update"));
 	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_update);
 	gtk_tooltips_set_tip(tooltips, menu_vc_update, _("Update from remote repositary."), NULL);
 
 	g_signal_connect((gpointer) menu_vc_update, "activate",
 			 G_CALLBACK(vcupdate_activated), NULL);
 
-	// Commit
+
+	/* Commit all changes */
 	menu_vc_commit = gtk_menu_item_new_with_mnemonic(_("_Commit"));
 	gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_commit);
 	gtk_tooltips_set_tip(tooltips, menu_vc_commit, _("Commit changes."), NULL);
@@ -2039,27 +2118,16 @@
 	g_signal_connect((gpointer) menu_vc_commit, "activate",
 			 G_CALLBACK(vccommit_activated), NULL);
 
+
 	gtk_widget_show_all(menu_vc);
+	gtk_widget_show_all(menu_vc_file);
+	gtk_widget_show_all(menu_vc_dir);
+	gtk_widget_show_all(menu_vc_basedir);
+	/* initialize keybindings */
+	init_keybindings();
 
-	/* 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_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);
-
 	plugin_fields->menu_item = menu_vc;
 	plugin_fields->flags = PLUGIN_IS_DOCUMENT_SENSITIVE;
-
 }
 
 
