From 076979c28593c6b3839526c75a44035225c5c3ea Mon Sep 17 00:00:00 2001 From: sgranjoux Date: Thu, 29 May 2008 20:58:53 +0000 Subject: [PATCH] * manuals/reference/libanjuta/writing-plugins.sgml: Fix #534175: Deprecated code in Plugin Tutorial git-svn-id: http://svn.gnome.org/svn/anjuta/trunk@3969 1dbfb86a-d425-0410-a06b-cb591aac69f6 --- ChangeLog | 6 ++++ manuals/reference/libanjuta/writing-plugins.sgml | 41 ++++++++---------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index e799cddd..bcc4d000 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-29 Arun Tejasvi Chaganty + + Reviewed by Sébastien Granjoux : + * manuals/reference/libanjuta/writing-plugins.sgml: + Fix #534175: Deprecated code in Plugin Tutorial + 2008-05-27 basti Reviewed by Sébastien Granjoux : diff --git a/manuals/reference/libanjuta/writing-plugins.sgml b/manuals/reference/libanjuta/writing-plugins.sgml index 1c0fa6d4..b8a31f08 100644 --- a/manuals/reference/libanjuta/writing-plugins.sgml +++ b/manuals/reference/libanjuta/writing-plugins.sgml @@ -109,7 +109,7 @@ typedef struct { AnjutaPluginClass parent_class; } HelloWorldPluginClass; -static void +static gboolean activate_plugin (AnjutaPlugin *plugin) { HelloWorldPlugin *hello_plugin = (HelloWorldPlugin*) plugin; @@ -131,7 +131,7 @@ activate_plugin (AnjutaPlugin *plugin) 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 @@ gpointer parent_class; 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 @@ on_hello_action_activate (GtkAction *action, HelloWorldPlugin *plugin) /* 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); } @@ -282,7 +269,7 @@ on_hello_action_activate (GtkAction *action, HelloWorldPlugin *plugin) and GtkUIManager for more details. -static GtkActionEntry actions = { +static GtkActionEntry actions[] = { { "ActionFileHelloWorld", /* Action name */ GTK_STOCK_NEW, /* Stock icon, if any */ @@ -360,7 +347,7 @@ deactivate_plugin (AnjutaPlugin *plugin) 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; -- 2.11.4.GIT