Beispiel #1
0
static gboolean
activate_plugin (AnjutaPlugin *plugin)
{
	StarterPlugin *splugin = ANJUTA_PLUGIN_STARTER (plugin);

	DEBUG_PRINT ("StarterPlugin: Activating document manager plugin...");
	
	splugin->priv->editor_watch_id =
		anjuta_plugin_add_watch (plugin,
								 IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
								 on_value_added_current_editor,
								 on_value_removed,
								 NULL);
	splugin->priv->project_watch_id =
		anjuta_plugin_add_watch (plugin,
								 IANJUTA_PROJECT_MANAGER_CURRENT_PROJECT,
								 on_value_added_current_project,
								 on_value_removed,
								 NULL);
	on_value_removed (plugin, NULL, splugin);

	g_signal_connect (anjuta_plugin_get_shell (plugin),
					  "load-session",
					  G_CALLBACK (on_session_load),
					  plugin);
	
	return TRUE;
}
Beispiel #2
0
static gboolean
activate_plugin (AnjutaPlugin * plugin)
{
	//AnjutaPreferences *prefs;
	AnjutaUI *ui;
	MacroPlugin *macro_plugin;

	DEBUG_PRINT ("%s", "MacroPlugin: Activating Macro plugin…");

	macro_plugin = ANJUTA_PLUGIN_MACRO (plugin);
	ui = anjuta_shell_get_ui (plugin->shell, NULL);

	/* Add all our actions */
	macro_plugin->action_group = 
		anjuta_ui_add_action_group_entries (ui, "ActionGroupMacro",
											_("Macro operations"),
											actions_macro,
											G_N_ELEMENTS (actions_macro),
											GETTEXT_PACKAGE, TRUE, plugin);
	macro_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);

	macro_plugin->editor_watch_id =
		anjuta_plugin_add_watch (plugin,
					 IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
					 value_added_current_editor,
					 value_removed_current_editor, NULL);
					 
	macro_plugin->macro_db = macro_db_new();
	
	return TRUE;
}
Beispiel #3
0
static gboolean
python_plugin_activate (AnjutaPlugin *plugin)
{
	AnjutaUI *ui;

	PythonPlugin *python_plugin;
	static gboolean initialized = FALSE;

	python_plugin = (PythonPlugin*) plugin;
	
	python_plugin->prefs = anjuta_shell_get_preferences (plugin->shell, NULL);
	
	/* Add all UI actions and merge UI */
	ui = anjuta_shell_get_ui (plugin->shell, NULL);
	
	python_plugin->action_group = 

	anjuta_ui_add_action_group_entries (ui, "ActionGroupPythonAssist",
											_("Python Assistance"),
											actions,
											G_N_ELEMENTS (actions),
											GETTEXT_PACKAGE, TRUE,
											plugin);
	python_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);

	initialized = FALSE;

	/* Add watches */
	python_plugin->project_root_watch_id = anjuta_plugin_add_watch (plugin,
																 IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
																 on_project_root_added,
																 on_project_root_removed,
																 NULL);
	
	python_plugin->editor_watch_id = anjuta_plugin_add_watch (plugin,
														   IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
														   on_editor_added,
														   on_editor_removed,
														   NULL);
	return TRUE;
}
Beispiel #4
0
static gboolean
activate_plugin (AnjutaPlugin *plugin)
{
	TerminalPlugin *term_plugin;
	static gboolean initialized = FALSE;
	AnjutaUI *ui;
	
	DEBUG_PRINT ("%s", "TerminalPlugin: Activating Terminal plugin ...");
	
	term_plugin = ANJUTA_PLUGIN_TERMINAL (plugin);
	term_plugin->widget_added_to_shell = FALSE;
	ui = anjuta_shell_get_ui (plugin->shell, NULL);
	term_plugin->action_group = anjuta_ui_add_action_group_entries (ui,
										"ActionGroupTerminal",
										_("terminal operations"),
										actions_terminal,
										G_N_ELEMENTS (actions_terminal),
										GETTEXT_PACKAGE, TRUE, term_plugin);
	term_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);
	
	terminal_create (term_plugin);
	
	if (!initialized)
	{
		register_stock_icons (plugin);
	}
	
	/* Setup prefs callbacks */
	prefs_init (term_plugin);
	
	/* Added widget in shell */
	anjuta_shell_add_widget (plugin->shell, term_plugin->frame,
							 "AnjutaTerminal", _("Terminal"),
							 "terminal-plugin-icon",
							 ANJUTA_SHELL_PLACEMENT_BOTTOM, NULL);
	/* terminal_focus_cb (term_plugin->term, NULL, term_plugin); */
	term_plugin->widget_added_to_shell = TRUE;
	initialized = TRUE;

	/* Set all terminal preferences, at that time the terminal widget is
	 * not realized, a few vte functions are not working. Another
	 * possibility could be to call this when the widget is realized */
	preferences_changed (term_plugin->settings, term_plugin);
	
	/* set up project directory watch */
	term_plugin->root_watch_id = anjuta_plugin_add_watch (plugin,
														  IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
														  on_project_root_added,
														  0, NULL);
	
	return TRUE;
}
Beispiel #5
0
static gboolean
js_support_plugin_activate (AnjutaPlugin *plugin)
{
	JSLang *js_support_plugin;

	DEBUG_PRINT ("%s", "JSLang: Activating JSLang plugin ...");
	js_support_plugin = (JSLang*) plugin;
	js_support_plugin->editor_watch_id =
		anjuta_plugin_add_watch (plugin, IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
					 on_value_added_current_editor,
					 on_value_removed_current_editor,
					 plugin);

	js_support_plugin->prefs = g_settings_new (JS_SUPPORT_SCHEMA);
	return TRUE;
}
Beispiel #6
0
static void
quick_open_plugin_setup_project_handling(QuickOpenPlugin* self)
{
    IAnjutaProject* project;

    self->project_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN(self)->shell,
        IAnjutaProjectManager, NULL);
    g_return_if_fail(self->project_manager);

    g_object_add_weak_pointer(G_OBJECT(self->project_manager), (void**)&self->project_manager);

    /* Connect to project manager events. */
    self->project_watch_id = anjuta_plugin_add_watch(ANJUTA_PLUGIN(self),
        IANJUTA_PROJECT_MANAGER_CURRENT_PROJECT,
        current_project_added, current_project_removed, self);

    g_signal_connect(self->project_manager, "project-loaded",
        G_CALLBACK (on_project_loaded), self);

    project = ianjuta_project_manager_get_current_project (self->project_manager, NULL);
    if (project)
        quick_open_plugin_project_added(self, project);
}
Beispiel #7
0
static gboolean
cpp_java_plugin_activate_plugin (AnjutaPlugin *plugin)
{
    AnjutaUI *ui;
    CppJavaPlugin *lang_plugin;
    static gboolean initialized = FALSE;

    lang_plugin = ANJUTA_PLUGIN_CPP_JAVA (plugin);

    DEBUG_PRINT ("%s", "AnjutaLanguageCppJavaPlugin: Activating plugin ...");

    if (!initialized)
    {
        register_stock_icons (plugin);
    }

    ui = anjuta_shell_get_ui (plugin->shell, NULL);
    lang_plugin->action_group =
        anjuta_ui_add_action_group_entries (ui, "ActionGroupCppJavaAssist",
                                            _("C++/Java Assistance"),
                                            actions,
                                            G_N_ELEMENTS (actions),
                                            GETTEXT_PACKAGE, TRUE,
                                            plugin);
    lang_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);

    lang_plugin->editor_watch_id =
        anjuta_plugin_add_watch (plugin,
                                 IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
                                 on_value_added_current_editor,
                                 on_value_removed_current_editor,
                                 plugin);

    initialized = FALSE;
    return TRUE;
}
Beispiel #8
0
static gboolean
file_manager_activate (AnjutaPlugin *plugin)
{
	AnjutaUI *ui;
	AnjutaFileManager *file_manager;
	
	DEBUG_PRINT ("%s", "AnjutaFileManager: Activating AnjutaFileManager plugin ...");
	file_manager = (AnjutaFileManager*) plugin;
	
	/* Add all UI actions and merge UI */
	ui = anjuta_shell_get_ui (plugin->shell, NULL);
	
	/* Add action group */
	file_manager->action_group = 
		anjuta_ui_add_action_group_entries (ui, "ActionGroupFileManager",
											_("File manager popup actions"),
											popup_actions, 1,
											GETTEXT_PACKAGE, FALSE,
											plugin);
	
	file_manager->uiid = anjuta_ui_merge (ui, UI_FILE);
	
	file_manager->sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (file_manager->sw),
								    GTK_POLICY_AUTOMATIC,
								    GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (file_manager->sw),
										 GTK_SHADOW_IN);
	
	file_manager->fv = ANJUTA_FILE_VIEW (file_view_new ());
	
	g_signal_connect (G_OBJECT (file_manager->fv), "file-open",
					  G_CALLBACK (on_file_view_open_file), file_manager);
	g_signal_connect (G_OBJECT(file_manager->fv), "show-popup-menu",
					  G_CALLBACK (on_file_view_show_popup_menu), file_manager);
	g_signal_connect (G_OBJECT(file_manager->fv), "current-file-changed",
					  G_CALLBACK (on_file_view_current_file_changed),
					  file_manager);
	file_manager_set_default_uri (file_manager);
	file_view_refresh (file_manager->fv);
	
	gtk_container_add (GTK_CONTAINER (file_manager->sw), 
					   GTK_WIDGET (file_manager->fv));
	
	gtk_widget_show_all (file_manager->sw);
	
	anjuta_shell_add_widget (plugin->shell, file_manager->sw,
							 "AnjutaFileManager",
							 _("Files"), GTK_STOCK_OPEN,
							 ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
	
	file_manager->root_watch_id =
		anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
								 project_root_added,
								 project_root_removed, NULL);
	

	g_signal_connect (file_manager->settings, "changed::" PREF_ROOT, 
	                  G_CALLBACK (on_notify_root), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_BINARY, 
	                  G_CALLBACK (on_notify), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_HIDDEN, 
	                  G_CALLBACK (on_notify), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_BACKUP, 
	                  G_CALLBACK (on_notify), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_UNVERSIONED, 
	                  G_CALLBACK (on_notify), file_manager);
	on_notify (file_manager->settings, NULL, file_manager);
	
	return TRUE;
}
static gboolean
snippets_manager_activate (AnjutaPlugin * plugin)
{
    SnippetsManagerPlugin *snippets_manager_plugin = ANJUTA_PLUGIN_SNIPPETS_MANAGER (plugin);
    AnjutaUI *anjuta_ui = NULL;

    /* Assertions */
    g_return_val_if_fail (ANJUTA_IS_PLUGIN_SNIPPETS_MANAGER (snippets_manager_plugin),
                          FALSE);

    /* Link the AnjutaShell to the SnippetsDB and load the SnippetsDB*/
    snippets_manager_plugin->snippets_db->anjuta_shell = plugin->shell;
    snippets_db_load (snippets_manager_plugin->snippets_db);

    /* Link the AnjutaShell to the SnippetsProvider and load if necessary */
    snippets_manager_plugin->snippets_provider->anjuta_shell = plugin->shell;

    /* Load the SnippetsBrowser with the snippets in the SnippetsDB */
    snippets_manager_plugin->snippets_browser->anjuta_shell = plugin->shell;
    snippets_browser_load (snippets_manager_plugin->snippets_browser,
                           snippets_manager_plugin->snippets_db,
                           snippets_manager_plugin->snippets_interaction);
    anjuta_shell_add_widget (plugin->shell,
                             GTK_WIDGET (snippets_manager_plugin->snippets_browser),
                             "snippets_browser",
                             _("Snippets"),
                             GTK_STOCK_FILE,
                             ANJUTA_SHELL_PLACEMENT_LEFT,
                             NULL);
    snippets_manager_plugin->browser_maximized = FALSE;

    /* Initialize the Interaction Interpreter */
    snippets_interaction_start (snippets_manager_plugin->snippets_interaction,
                                plugin->shell);

    /* Add a watch for the current document */
    snippets_manager_plugin->cur_editor_watch_id =
        anjuta_plugin_add_watch (plugin,
                                 IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
                                 on_added_current_document,
                                 on_removed_current_document,
                                 NULL);

    /* Merge the Menu UI */
    anjuta_ui = anjuta_shell_get_ui (plugin->shell, FALSE);

    snippets_manager_plugin->action_group =
        anjuta_ui_add_action_group_entries (anjuta_ui,
                                            "ActionGroupSnippetsManager",
                                            _("Snippets Manager actions"),
                                            actions_snippets,
                                            G_N_ELEMENTS (actions_snippets),
                                            GETTEXT_PACKAGE,
                                            TRUE,
                                            snippets_manager_plugin);

    snippets_manager_plugin->uiid = anjuta_ui_merge (anjuta_ui, MENU_UI);

    DEBUG_PRINT ("%s", "SnippetsManager: Activating SnippetsManager plugin …");

    return TRUE;
}