anjuta r3969 - in trunk: . manuals/reference/libanjuta



Author: sgranjoux
Date: Thu May 29 20:58:53 2008
New Revision: 3969
URL: http://svn.gnome.org/viewvc/anjuta?rev=3969&view=rev

Log:
	* manuals/reference/libanjuta/writing-plugins.sgml:
	Fix #534175: Deprecated code in Plugin Tutorial


Modified:
   trunk/ChangeLog
   trunk/manuals/reference/libanjuta/writing-plugins.sgml

Modified: trunk/manuals/reference/libanjuta/writing-plugins.sgml
==============================================================================
--- trunk/manuals/reference/libanjuta/writing-plugins.sgml	(original)
+++ trunk/manuals/reference/libanjuta/writing-plugins.sgml	Thu May 29 20:58:53 2008
@@ -109,7 +109,7 @@
 	AnjutaPluginClass parent_class;
 } HelloWorldPluginClass;
 
-static void
+static gboolean
 activate_plugin (AnjutaPlugin *plugin)
 {
 	HelloWorldPlugin *hello_plugin = (HelloWorldPlugin*) plugin;
@@ -131,7 +131,7 @@
 static gboolean
 deactivate_plugin (AnjutaPlugin *plugin)
 {
-	HelloWorldPlugin *hello_plugin;
+	HelloWorldPlugin *hello_plugin = (HelloWorldPlugin*) plugin;
 	
 	/* Remove widgets from Shell */
 	anjuta_shell_remove_widget (plugin->shell, hello_plugin->widget, NULL);
@@ -238,10 +238,10 @@
 static void
 on_hello_action_activate (GtkAction *action, HelloWorldPlugin *plugin)
 {
-	IAnjutaFile *file;
-	IAnjutaEditor *editor;
+	IAnjutaDocument *doc;
 	IAnjutaDocumentManager *docman;
 	GtkWindow *parent_win;
+	gchar *filename;
 	
 	/* We are using Anjuta widow as parent for displaying the dialog */
 	parent_win = GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell);
@@ -249,28 +249,15 @@
 	/* Query for object implementing IAnjutaDocumentManager interface */
 	docman = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
 	                                     IAnjutaDocumentManager, NULL);
-	
-	/* Get current editor */
-	editor = ianjuta_document_manager_get_current_editor (docman, NULL);
-	
-	/* Check if IAnjutaFile is implemented by the editor */
-	if (IANJUTA_IS_FILE(editor)
-	{
-		/* Editor implements IAnjutaFile interface */
-		gchar *filename = ianjuta_file_get_filename (IANJUTA_FILE(editor));
+	                                     
+	/* Get current document */
+	doc = ianjuta_document_manager_get_current_document (docman, NULL);
+	filename = ianjuta_document_get_filename (doc, NULL);
 		
-		/* Display the filename */
-		anjuta_util_dialog_info (parent_win,
-		                         "Current filename is: %s", filename);
-		g_free (filename);
-	}
-	else
-	{
-		/* Editor doesn't support IAnjutaFile interface */
-		/* Display the filename */
-		anjuta_util_dialog_error (parent_win,
-		                          "Editor doesn't support IAnjutaFile Interface");
-	}
+	/* Display the filename */
+	anjuta_util_dialog_info (parent_win,
+	                         "Current filename is: %s", filename);
+	g_free (filename);
 }
 			</programlisting>
 		</para>
@@ -282,7 +269,7 @@
 			and <link linkend="GtkUIManager"><type>GtkUIManager</type></link>
 			for more details.
 			<programlisting>
-static GtkActionEntry actions = {
+static GtkActionEntry actions[] = {
 	{
 		"ActionFileHelloWorld",                   /* Action name */
 		GTK_STOCK_NEW,                            /* Stock icon, if any */
@@ -360,7 +347,7 @@
 	anjuta_ui_unmerge (ui, hello_plugin->uiid);
 	
 	/* Remove Action groups */
-	anjuta_ui_remove_action_groups (ui, hello_plugin->action_group);
+	anjuta_ui_remove_action_group (ui, hello_plugin->action_group);
 	
 	/* FALSE if plugin doesn't want to deactivate */
 	return TRUE;



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