[anjuta] glade: Add a menu item for glade properties dialog
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] glade: Add a menu item for glade properties dialog
- Date: Tue, 12 Feb 2013 20:09:44 +0000 (UTC)
commit d6751dad3976b5e44e77a7f579ce50ff2970963d
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Mon Feb 11 21:48:49 2013 +0100
glade: Add a menu item for glade properties dialog
plugins/glade/anjuta-glade.xml | 40 +++-------------------------
plugins/glade/plugin.c | 56 +++++++++++++++++++++++++++++++++++-----
2 files changed, 54 insertions(+), 42 deletions(-)
---
diff --git a/plugins/glade/anjuta-glade.xml b/plugins/glade/anjuta-glade.xml
index 20c261f..5b559d2 100644
--- a/plugins/glade/anjuta-glade.xml
+++ b/plugins/glade/anjuta-glade.xml
@@ -1,40 +1,10 @@
<!--*- xml -*-->
<ui>
<menubar name="MenuMain">
- <placeholder name="PlaceHolderDesignerMenus">
- <menu name="MenuGlade" action="ActionMenuGlade">
- <menuitem name="SwitchDesigner" action="ActionGladeSwitchDesigner" />
- <menuitem name="AssociateDnE" action="ActionAssociateDesignerAndEditor" />
- <menuitem name="InsertAutoHandlerStub" action="ActionInsertAutoHandlerStub" />
- <menuitem name="AssociationsDialog" action="ActionGladeAssociationsDialog" />
- <menuitem name="VersionDialog" action="ActionVersionDialog" />
- <!--menuitem name="PreviewMode" action="ActionPreviewMode" /-->
- <!--menuitem name="VerifyProject" action="ActionVerifyProject" /-->
- </menu>
- </placeholder>
+ <menu name="MenuFile" action="ActionMenuFile">
+ <placeholder name="PlaceholderFileMenus">
+ <menuitem name="GladePropertiesDialog" action="ActionGladePropertiesDialog" />
+ </placeholder>
+ </menu>
</menubar>
- <popup name="PopupDocumentManager">
- <separator />
- <menuitem name="InsertHandlerStub" action="ActionInsertHandlerStub" />
- </popup>
- <popup name="PopupProjectManager">
- <separator />
- <menuitem name="SetDefaultTarget" action="ActionSetDefaultTarget" />
- </popup>
- <toolbar name='GladeDesignLayoutToolBar'>
- <toolitem action='Close' action='ActionGladeClose'/>
- <separator/>
- <toolitem action='Save' action='ActionGladeSave'/>
- <separator/>
- <toolitem action='VersionDialog' action='ActionVersionDialog'/>
- <!--separator/-->
- <!--toolitem action='Undo' action='ActionGladeUndo'/-->
- <!--toolitem action='Redo' action='ActionGladeRedo'/-->
- <separator/>
- <toolitem action='Cut' action='ActionGladeCut'/>
- <toolitem action='Copy' action='ActionGladeCopy'/>
- <toolitem action='Paste' action='ActionGladePaste'/>
- <separator/>
- <toolitem action='Delete' action='ActionGladeDelete'/>
- </toolbar>
</ui>
diff --git a/plugins/glade/plugin.c b/plugins/glade/plugin.c
index c7e82e4..14806d2 100644
--- a/plugins/glade/plugin.c
+++ b/plugins/glade/plugin.c
@@ -42,7 +42,8 @@ struct _GladePluginPriv
gint uiid;
GtkActionGroup *action_group;
GladeApp *app;
-
+ GladeProject *project;
+
GtkWidget *inspector;
GtkWidget *palette;
GtkWidget *editor;
@@ -87,17 +88,17 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name,
if (ANJUTA_IS_DESIGN_DOCUMENT(editor))
{
AnjutaDesignDocument* view = ANJUTA_DESIGN_DOCUMENT(editor);
- GladeProject* project = glade_design_view_get_project(GLADE_DESIGN_VIEW(view));
+ priv->project = glade_design_view_get_project(GLADE_DESIGN_VIEW(view));
if (!view->is_project_added)
{
- glade_app_add_project (project);
- g_signal_connect (G_OBJECT (project), "notify::pointer-mode",
+ glade_app_add_project (priv->project);
+ g_signal_connect (G_OBJECT (priv->project), "notify::pointer-mode",
G_CALLBACK (on_pointer_mode_changed), glade_plugin);
view->is_project_added = TRUE;
}
/* Change view components */
- glade_palette_set_project (GLADE_PALETTE (priv->palette), project);
- glade_inspector_set_project (GLADE_INSPECTOR (priv->inspector), project);
+ glade_palette_set_project (GLADE_PALETTE (priv->palette), priv->project);
+ glade_inspector_set_project (GLADE_INSPECTOR (priv->inspector), priv->project);
}
}
@@ -105,7 +106,10 @@ static void
value_removed_current_editor (AnjutaPlugin *plugin,
const char *name, gpointer data)
{
-
+ GladePlugin* glade_plugin = ANJUTA_PLUGIN_GLADE(plugin);
+ GladePluginPriv* priv = glade_plugin->priv;
+
+ priv->project = NULL;
}
static void
@@ -591,6 +595,27 @@ glade_plugin_load_progress (GladeProject *project,
g_free (project_name);
}
+static void
+on_glade_show_properties_dialog (GtkAction* action, GladePlugin* plugin)
+{
+ GladePluginPriv* priv = plugin->priv;
+
+ if (priv->project != NULL)
+ glade_project_properties (priv->project);
+}
+
+static GtkActionEntry actions_glade[] =
+{
+ {
+ "ActionGladePropertiesDialog",
+ GTK_STOCK_PROPERTIES,
+ N_("Glade Propertiesâ"),
+ NULL,
+ N_("Switch between library versions and check deprecations"),
+ G_CALLBACK (on_glade_show_properties_dialog)
+ }
+};
+
static gboolean
activate_plugin (AnjutaPlugin *plugin)
{
@@ -599,6 +624,7 @@ activate_plugin (AnjutaPlugin *plugin)
AnjutaStatus* status;
GtkWidget* button_box;
GtkBuilder* builder;
+ AnjutaUI *ui;
GError* err = NULL;
DEBUG_PRINT ("%s", "GladePlugin: Activating Glade pluginâ");
@@ -618,6 +644,7 @@ activate_plugin (AnjutaPlugin *plugin)
{
priv->app = glade_app_new ();
}
+ priv->project = NULL;
glade_app_set_window (GTK_WIDGET (ANJUTA_PLUGIN(plugin)->shell));
@@ -692,6 +719,15 @@ activate_plugin (AnjutaPlugin *plugin)
gtk_widget_show (priv->editor);
gtk_widget_show (priv->inspector);
+ /* Add UI */
+ ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL);
+ priv->action_group =
+ anjuta_ui_add_action_group_entries (ui,
+ "ActionGroupGlade", _("Glade designer operations"),
+ actions_glade, G_N_ELEMENTS (actions_glade),
+ GETTEXT_PACKAGE, TRUE, plugin);
+ priv->uiid = anjuta_ui_merge (ui, UI_FILE);
+
/* Add widgets */
anjuta_shell_add_widget (anjuta_plugin_get_shell (ANJUTA_PLUGIN (plugin)),
priv->paned,
@@ -720,6 +756,7 @@ static gboolean
deactivate_plugin (AnjutaPlugin *plugin)
{
GladePluginPriv *priv;
+ AnjutaUI *ui;
priv = ANJUTA_PLUGIN_GLADE (plugin)->priv;
@@ -751,6 +788,11 @@ deactivate_plugin (AnjutaPlugin *plugin)
priv->paned,
NULL);
+ /* Remove UI*/
+ ui = anjuta_shell_get_ui (plugin->shell, NULL);
+ anjuta_ui_unmerge (ui, priv->uiid);
+ anjuta_ui_remove_action_group (ui, priv->action_group);
+
priv->uiid = 0;
priv->action_group = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]