anjuta r3815 - in trunk: . plugins/document-manager plugins/file-loader



Author: jhs
Date: Fri Apr  4 10:00:02 2008
New Revision: 3815
URL: http://svn.gnome.org/viewvc/anjuta?rev=3815&view=rev

Log:
2008-04-04  Johannes Schmid  <jhs gnome org>

	* plugins/document-manager/action-callbacks.c:
	* plugins/document-manager/anjuta-document-manager.ui:
	* plugins/document-manager/plugin.c (ui_give_shorter_names),
	(update_document_ui_disable_all):
	* plugins/file-loader/anjuta-loader-plugin.ui:
	* plugins/file-loader/plugin.c (on_new_activate),
	(activate_plugin):
	
	Moved \"New\" action from document-manager to file-loader using 
	IAnjutaDocumentManager interface. Reenabled pop-down menu for \"New\"-ToolItem.

Modified:
   trunk/ChangeLog
   trunk/plugins/document-manager/action-callbacks.c
   trunk/plugins/document-manager/anjuta-document-manager.ui
   trunk/plugins/document-manager/plugin.c
   trunk/plugins/file-loader/anjuta-loader-plugin.ui
   trunk/plugins/file-loader/plugin.c

Modified: trunk/plugins/document-manager/action-callbacks.c
==============================================================================
--- trunk/plugins/document-manager/action-callbacks.c	(original)
+++ trunk/plugins/document-manager/action-callbacks.c	Fri Apr  4 10:00:02 2008
@@ -250,17 +250,6 @@
 }
 
 void
-on_new_file_activate (GtkAction *action, gpointer user_data)
-{
-	AnjutaDocman *docman;
-	DocmanPlugin *plugin;
-	plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
-	docman = ANJUTA_DOCMAN (plugin->docman);
-
-	anjuta_docman_add_editor (docman, NULL, NULL);
-}
-
-void
 on_reload_file_activate (GtkAction *action, gpointer user_data)
 {
 	IAnjutaDocument *doc;

Modified: trunk/plugins/document-manager/anjuta-document-manager.ui
==============================================================================
--- trunk/plugins/document-manager/anjuta-document-manager.ui	(original)
+++ trunk/plugins/document-manager/anjuta-document-manager.ui	Fri Apr  4 10:00:02 2008
@@ -3,9 +3,6 @@
 	<menubar name="MenuMain">
 		<menu name="MenuFile" action="ActionMenuFile">
 			<placeholder name="PlaceholderFileMenus">
-				<placeholder name="PlaceholderFilewMenuNew">
-					<menuitem name="New" action="ActionFileNew" />
-				</placeholder>
 				<menuitem name="Save" action="ActionFileSave" />
 				<menuitem name="SaveAs" action="ActionFileSaveAs" />
 				<menuitem name="SaveAll" action="ActionFileSaveAll" />
@@ -117,9 +114,6 @@
 	</menubar>
 	<toolbar name="ToolbarMain">
 		<placeholder name="PlaceholderFileToolbar">
-			<placeholder name="PlaceholderFileToolbarNew">
-				<toolitem name="New" action="ActionFileNew" />
-			</placeholder>
 			<toolitem name="Save" action="ActionFileSave" />
 			<toolitem name="Reload" action="ActionFileReload" />
 			<separator name="separator16"/>

Modified: trunk/plugins/document-manager/plugin.c
==============================================================================
--- trunk/plugins/document-manager/plugin.c	(original)
+++ trunk/plugins/document-manager/plugin.c	Fri Apr  4 10:00:02 2008
@@ -150,9 +150,6 @@
 };
 
 static GtkActionEntry actions_file[] = {
-  { "ActionFileNew", GTK_STOCK_NEW, N_("_New"), "<control>n",
-	N_("New empty file"),
-    G_CALLBACK (on_new_file_activate)},
   { "ActionFileSave", GTK_STOCK_SAVE, N_("_Save"), "<control>s",
 	N_("Save current file"), G_CALLBACK (on_save_activate)},
   { "ActionFileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."),  "<shift><control>s",
@@ -582,10 +579,6 @@
 			
 	ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
 	action = anjuta_ui_get_action (ui, "ActionGroupEditorFile",
-									"ActionFileNew");
-	g_object_set (G_OBJECT (action), "short-label", _("New"),
-				  "is-important", TRUE, NULL);
-	action = anjuta_ui_get_action (ui, "ActionGroupEditorFile",
 								   "ActionFileSave");
 	g_object_set (G_OBJECT (action), "short-label", _("Save"),
 				  "is-important", TRUE, NULL);
@@ -636,10 +629,8 @@
 		{
 			action = anjuta_ui_get_action (ui, action_groups[i].name,
 										   action_groups[i].group[j].name);
-			if (action_groups[i].group[j].callback &&
-				strcmp (action_groups[i].group[j].name, "ActionFileNew") != 0)
+			if (action_groups[i].group[j].callback)
 			{
-				/* Disable all but ActoinFileNew actions */
 				g_object_set (G_OBJECT (action), "sensitive", FALSE, NULL);
 			}
 		}

Modified: trunk/plugins/file-loader/anjuta-loader-plugin.ui
==============================================================================
--- trunk/plugins/file-loader/anjuta-loader-plugin.ui	(original)
+++ trunk/plugins/file-loader/anjuta-loader-plugin.ui	Fri Apr  4 10:00:02 2008
@@ -3,7 +3,7 @@
 	<menubar name="MenuMain">
 		<menu name="MenuFile" action="ActionMenuFile">
 			<placeholder name="PlaceholderFileMenus">
-				<placeholder name="PlaceholderFilewMenuNew" />
+				<menuitem name="New" action="ActionFileNew" />
 				<menuitem name="Wizard" action="ActionFileWizard" />
 				<menuitem name="Open" action="ActionFileOpen" />
 				<menuitem name="OpenRecent" action="ActionFileOpenRecent" />
@@ -27,7 +27,7 @@
 	</popup>
 	<toolbar name="ToolbarMain">
 		<placeholder name="PlaceholderFileToolbar">
-			<placeholder name="PlaceholderFileToolbarNew" />
+			<toolitem name="New" action="ActionFileWizard" />
 			<toolitem name="Open" action="ActionFileOpenRecent" />
 		</placeholder>
 	</toolbar>

Modified: trunk/plugins/file-loader/plugin.c
==============================================================================
--- trunk/plugins/file-loader/plugin.c	(original)
+++ trunk/plugins/file-loader/plugin.c	Fri Apr  4 10:00:02 2008
@@ -546,6 +546,17 @@
 }
 
 static void
+on_new_activate (GtkAction *action, AnjutaFileLoaderPlugin *plugin)
+{
+	AnjutaShell* shell = ANJUTA_PLUGIN (plugin)->shell;
+	IAnjutaDocumentManager *docman = anjuta_shell_get_interface (shell, 
+																 IAnjutaDocumentManager,
+																 NULL);
+	if (docman)
+		ianjuta_document_manager_add_buffer (docman, NULL, NULL, NULL);
+}
+
+static void
 on_open_activate (GtkAction *action, AnjutaFileLoaderPlugin *plugin)
 {
 	GtkWidget *dlg;
@@ -768,6 +779,14 @@
 }
 
 static GtkActionEntry actions_file[] = {
+	{ 
+		"ActionFileNew", 
+		GTK_STOCK_NEW,
+		N_("_New"), 
+		"<control>n",
+		N_("New empty file"),
+		G_CALLBACK (on_new_activate)
+	},
 	{
 		"ActionFileOpen",
 		GTK_STOCK_OPEN,
@@ -1171,6 +1190,8 @@
 											GETTEXT_PACKAGE, FALSE, plugin);
 	saction = gtk_recent_action_new ("ActionFileWizard", _("New"),
 							  _("New file, project and project components."), NULL);
+	g_object_set (saction, "stock-id", GTK_STOCK_NEW, NULL);
+	g_signal_connect (saction, "activate", G_CALLBACK (on_new_activate), loader_plugin);
 	gtk_action_group_add_action (loader_plugin->action_group,
 								 GTK_ACTION (saction));
 	
@@ -1207,6 +1228,10 @@
 					"/MenuMain/MenuFile/PlaceholderFileMenus/Wizard");
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (widget), on_create_submenu(loader_plugin));
 	
+	widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER(ui),
+					"/ToolbarMain/PlaceholderFileToolbar/New");
+	gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (widget), on_create_submenu(loader_plugin));
+	
 	/* Install drag n drop handler */
 	dnd_drop_init (GTK_WIDGET (plugin->shell), dnd_dropped, plugin,
 				   "text/plain", "text/html", "text/source", "application-x/anjuta",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]