static IAnjutaEditor* itext_editor_factory_new_editor(IAnjutaEditorFactory* factory, GFile* file, const gchar* filename, GError** error) { /* file can be NULL, if we open a buffer, not a file */ gchar* uri = file ? g_file_get_uri (file) : NULL; IAnjutaEditor* editor = IANJUTA_EDITOR(text_editor_new(ANJUTA_PLUGIN (factory), uri, filename)); g_free(uri); return editor; }
static IAnjutaProject* iproject_backend_new_project (IAnjutaProjectBackend* backend, GFile *file, GError** err) { IAnjutaProject *project; IAnjutaLanguage* langman; DEBUG_PRINT("create new amp project"); langman = anjuta_shell_get_interface (ANJUTA_PLUGIN (backend)->shell, IAnjutaLanguage, NULL); project = (IAnjutaProject *)amp_project_new (file, langman, err); return project; }
guint status_bar_progress_pulse (Subversion *plugin, gchar *text) { PulseProgressData *data; data = g_new0 (PulseProgressData, 1); data->status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL); data->text = g_strdup (text); return g_timeout_add_full (G_PRIORITY_DEFAULT, 100, (GSourceFunc) status_pulse_timer, data, (GDestroyNotify) on_pulse_timer_destroyed); }
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); }
/* Complete the document addition process */ void vim_widget_add_document_complete (VimWidget *widget, VimEditor *editor) { IAnjutaDocumentManager *docman; if (g_ptr_array_find (widget->priv->unloaded, editor) != -1) g_ptr_array_remove (widget->priv->unloaded, editor); g_ptr_array_add (widget->priv->documents, editor); editor->priv->loaded = TRUE; vim_editor_update_variables (editor); docman = anjuta_shell_get_interface (ANJUTA_PLUGIN(widget->priv->plugin)->shell, IAnjutaDocumentManager, NULL); ianjuta_document_manager_add_document (docman, IANJUTA_DOCUMENT(editor), NULL); }
static void iwizard_activate (IAnjutaWizard *wiz, GError **err) { AnjutaProjectImportPlugin* plugin = ANJUTA_PLUGIN_PROJECT_IMPORT (wiz); AnjutaPluginManager *plugin_manager; ProjectImportDialog* pi; plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (plugin)->shell, NULL); pi = project_import_dialog_new(plugin_manager, NULL, NULL); g_signal_connect (pi, "response", G_CALLBACK (import_dialog_response), plugin); gtk_widget_show (GTK_WIDGET (pi)); }
void anjuta_cvs_update (AnjutaPlugin *obj, const gchar* filename, gboolean recurse, gboolean prune, gboolean create, gboolean reset_sticky, const gchar* revision, GError **err) { GString* options = g_string_new(""); CVSPlugin* plugin = ANJUTA_PLUGIN_CVS (obj); gchar* command; add_option(!recurse, options, "-l"); add_option(prune, options, "-P"); add_option(create, options, "-d"); if (strlen(revision)) { g_string_append_printf(options, " -r %s", revision); } else { add_option(reset_sticky, options, "-A"); } if (!is_directory(filename)) { gchar* file = g_strdup(filename); command = create_cvs_command(anjuta_shell_get_preferences (ANJUTA_PLUGIN(plugin)->shell, NULL), "update", options->str, basename(file)); cvs_execute(plugin, command, dirname(file)); g_free(file); } else { gchar* dir = g_strdup(filename); command = create_cvs_command(anjuta_shell_get_preferences (ANJUTA_PLUGIN(plugin)->shell, NULL), "update", options->str, ""); cvs_execute(plugin, command, dir); } g_free(command); g_string_free(options, TRUE); }
void anjuta_cvs_commit (AnjutaPlugin *obj, const gchar* filename, const gchar* log, const gchar* rev, gboolean recurse, GError **err) { GString* options = g_string_new(""); CVSPlugin* plugin = ANJUTA_PLUGIN_CVS (obj); gchar* command; if (strlen(log)) g_string_printf(options, "-m '%s'", log); else g_string_printf(options, "-m 'no log message'"); if (strlen(rev)) { g_string_append_printf(options, " -r %s", rev); } add_option(!recurse, options, "-l"); if (!is_directory(filename)) { gchar* file = g_strdup(filename); command = create_cvs_command(anjuta_shell_get_preferences (ANJUTA_PLUGIN(plugin)->shell, NULL), "commit", options->str, basename(file)); cvs_execute(plugin, command, dirname(file)); g_free(file); } else { gchar* dir = g_strdup(filename); command = create_cvs_command(anjuta_shell_get_preferences (ANJUTA_PLUGIN(plugin)->shell, NULL), "commit", options->str, ""); cvs_execute(plugin, command, dir); g_free(dir); } g_free(command); g_string_free(options, TRUE); }
static void on_pull_command_finished (AnjutaCommand *command, guint return_code, Git *plugin) { AnjutaStatus *status; status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL); anjuta_status (status, _("Git: Pull complete."), 5); git_report_errors (command, return_code); g_object_unref (command); }
static void on_commit_command_finished (AnjutaCommand *command, guint return_code, Subversion *plugin) { AnjutaStatus *status; status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL); anjuta_status (status, _("Subversion: Commit complete."), 5); report_errors (command, return_code); svn_commit_command_destroy (SVN_COMMIT_COMMAND (command)); }
void anjuta_cvs_remove (AnjutaPlugin *obj, const gchar* filename, GError **err) { gchar* command; CVSPlugin* plugin = ANJUTA_PLUGIN_CVS (obj); GString* options = g_string_new(""); gchar* file = g_strdup(filename); command = create_cvs_command( anjuta_shell_get_preferences (ANJUTA_PLUGIN(plugin)->shell, NULL), "remove", options->str, basename(file)); cvs_execute(plugin, command, dirname(file)); g_free(file); g_free(command); g_string_free(options, TRUE); }
static IAnjutaEditor* language_support_get_editor_from_file (CppJavaPlugin* lang_plugin, GFile *file) { IAnjutaDocumentManager *document_manager = anjuta_shell_get_interface ( ANJUTA_PLUGIN (lang_plugin)->shell, IAnjutaDocumentManager, NULL); IAnjutaDocument *document = ianjuta_document_manager_find_document_with_file (document_manager, file, NULL); return IANJUTA_EDITOR (document); }
void on_cvs_update_response(GtkDialog* dialog, gint response, CVSData* data) { if (is_busy(data->plugin, dialog)) return; switch (response) { case GTK_RESPONSE_OK: { const gchar* revision; GtkWidget* createdir; GtkWidget* removedir; GtkWidget* norecurse; GtkWidget* removesticky; GtkWidget* revisionentry; GtkWidget* fileentry = GTK_WIDGET(gtk_builder_get_object(data->bxml, "cvs_update_filename")); const gchar* filename = g_strdup(gtk_entry_get_text(GTK_ENTRY(fileentry))); norecurse = GTK_WIDGET(gtk_builder_get_object(data->bxml, "cvs_update_norecurse")); removedir = GTK_WIDGET(gtk_builder_get_object(data->bxml, "cvs_removedir")); createdir = GTK_WIDGET(gtk_builder_get_object(data->bxml, "cvs_createdir")); revisionentry = GTK_WIDGET(gtk_builder_get_object(data->bxml, "cvs_update_revision")); revision = gtk_entry_get_text(GTK_ENTRY(revisionentry)); removesticky = GTK_WIDGET(gtk_builder_get_object(data->bxml, "cvs_removesticky")); if (!check_filename(dialog, filename)) break; anjuta_cvs_update(ANJUTA_PLUGIN(data->plugin), filename, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(norecurse)), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(removedir)), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(createdir)), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(removesticky)), revision, NULL); cvs_data_free(data); gtk_widget_destroy(GTK_WIDGET(dialog)); break; } default: gtk_widget_destroy(GTK_WIDGET(dialog)); cvs_data_free(data); break; } }
static BuildContext* build_save_distclean_and_execute_command (BasicAutotoolsPlugin* bplugin, BuildProgram *prog, gboolean with_view, GError **err) { BuildContext *context; gchar *root_path; gboolean same; BuildConfiguration *config; GList *vars; context = build_get_context (bplugin, prog->work_dir, with_view); root_path = g_file_get_path (bplugin->project_root_dir); same = strcmp (prog->work_dir, root_path) != 0; g_free (root_path); config = build_configuration_list_get_selected (bplugin->configurations); vars = build_configuration_get_variables (config); if (!same && directory_has_file (bplugin->project_root_dir, "config.status")) { BuildProgram *new_prog; // Need to run make clean before if (!anjuta_util_dialog_boolean_question (GTK_WINDOW (ANJUTA_PLUGIN (bplugin)->shell), _("Before using this new configuration, the default one needs to be removed. Do you want to do that ?"), NULL)) { if (err) *err = g_error_new (ianjuta_builder_error_quark (), IANJUTA_BUILDER_CANCELED, _("Command canceled by user")); return NULL; } new_prog = build_program_new_with_command (bplugin->project_root_dir, "%s", CHOOSE_COMMAND (bplugin, DISTCLEAN)); build_program_set_callback (new_prog, build_execute_after_command, prog); prog = new_prog; } build_program_add_env_list (prog, vars); build_set_command_in_context (context, prog); build_save_and_execute_command_in_context (context, NULL); return context; }
void anjuta_cvs_import (AnjutaPlugin *obj, const gchar* dir, const gchar* cvsroot, const gchar* module, const gchar* vendor, const gchar* release, const gchar* log, gint server_type, const gchar* username, const gchar* password, GError** error) { gchar* cvs_command; gchar* root; GString* options = g_string_new(""); CVSPlugin* plugin = ANJUTA_PLUGIN_CVS (obj); switch (server_type) { case SERVER_LOCAL: { root = g_strdup_printf("-d %s", cvsroot); break; } case SERVER_EXTERN: { root = g_strdup_printf("-d:ext:%s@%s", username, cvsroot); break; } case SERVER_PASSWORD: { root = g_strdup_printf("-d:pserver:%s:%s@%s", username, password, cvsroot); break; } default: { DEBUG_PRINT("%s", "Invalid cvs server type!"); g_string_free (options, TRUE); return; } } g_string_printf(options, "-m '%s'", log); g_string_append_printf(options, " %s %s %s", module, vendor, release); cvs_command = create_cvs_command_with_cvsroot( anjuta_shell_get_preferences (ANJUTA_PLUGIN(plugin)->shell, NULL), "import", options->str, "", root); cvs_execute(plugin, cvs_command, dir); g_string_free(options, TRUE); g_free(cvs_command); }
static void on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase, AnjutaSession *session, StarterPlugin *plugin) { if (phase == ANJUTA_SESSION_PHASE_END) { if (!plugin->priv->starter) on_value_removed (ANJUTA_PLUGIN (plugin), NULL, plugin); if (plugin->priv->starter) { anjuta_shell_maximize_widget (shell, "AnjutaStarter", NULL); } } }
void vim_signal_buf_enter_cb (DBusGProxy *proxy, const guint bufno, const gchar* filename, VimWidget *widget) { IAnjutaDocumentManager *docman; VimEditor *editor = vim_widget_get_document_bufno (widget, bufno, NULL); if (!editor) return; editor->priv->bufno = bufno; if (widget->priv->current_editor != editor) { widget->priv->current_editor = editor; /* Set the current editor */ docman = anjuta_shell_get_interface (ANJUTA_PLUGIN(widget->priv->plugin)->shell, IAnjutaDocumentManager, NULL); ianjuta_document_manager_set_current_document (docman, IANJUTA_DOCUMENT(editor), NULL); } }
static gboolean sourceview_plugin_deactivate (AnjutaPlugin *obj) { SourceviewPlugin* plugin = ANJUTA_PLUGIN_SOURCEVIEW (obj); AnjutaUI *ui; DEBUG_PRINT ("%s", "SourceviewPlugin: Dectivating SourceviewPlugin plugin ..."); ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL); anjuta_ui_unmerge (ui, plugin->uiid); if (plugin->group != NULL) { anjuta_ui_remove_action_group (ui, plugin->group); plugin->group = NULL; } return TRUE; }
static IAnjutaEditor* ieditor_factory_new_editor(IAnjutaEditorFactory* factory, GFile* file, const gchar* filename, GError** error) { AnjutaPlugin* plugin = ANJUTA_PLUGIN(factory); SourceviewPlugin* splugin = ANJUTA_PLUGIN_SOURCEVIEW (plugin); gchar* current_style = g_settings_get_string (splugin->settings, SOURCEVIEW_STYLE); GtkSourceStyleSchemeManager* manager = gtk_source_style_scheme_manager_get_default(); Sourceview* sv; sv = sourceview_new(file, filename, plugin); if (current_style) gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (sv->priv->document), gtk_source_style_scheme_manager_get_scheme (manager, current_style)); g_free (current_style); return IANJUTA_EDITOR (sv); }
static void on_file_view_show_popup_menu (AnjutaFileView* view, GFile* file, gboolean is_dir, guint button, guint32 time, AnjutaFileManager* file_manager) { GtkWidget *popup; GtkWidget *rename; AnjutaUI* ui = anjuta_shell_get_ui (ANJUTA_PLUGIN(file_manager)->shell, NULL); popup = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui), "/PopupFileManager"); rename = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui), "/PopupFileManager/PopupFileManagerRename"); /* TODO */ gtk_widget_hide (rename); g_return_if_fail (GTK_IS_WIDGET (popup)); gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, button, time); }
static void on_snippets_browser_unmaximize_request (SnippetsBrowser *snippets_browser, gpointer user_data) { SnippetsManagerPlugin *snippets_manager_plugin = NULL; /* Assertions */ g_return_if_fail (ANJUTA_IS_PLUGIN_SNIPPETS_MANAGER (user_data)); snippets_manager_plugin = ANJUTA_PLUGIN_SNIPPETS_MANAGER (user_data); if (!snippets_manager_plugin->browser_maximized) return; anjuta_shell_unmaximize (ANJUTA_PLUGIN (snippets_manager_plugin)->shell, NULL); snippets_browser_hide_editor (snippets_browser); snippets_manager_plugin->browser_maximized = FALSE; }
static void cpp_packages_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { CppPackages* packages; g_return_if_fail (CPP_IS_PACKAGES (object)); packages = CPP_PACKAGES (object); switch (prop_id) { case PROP_PLUGIN: packages->plugin = ANJUTA_PLUGIN (g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void cpp_packages_load_real (CppPackages* packages, GError* error, IAnjutaProjectManager* pm) { IAnjutaSymbolManager* sm = anjuta_shell_get_interface (anjuta_plugin_get_shell (ANJUTA_PLUGIN(packages->plugin)), IAnjutaSymbolManager, NULL); GList* pkgs; GList* pkg; GList* packages_to_add = NULL; if (!pm || !sm) return; ianjuta_symbol_manager_deactivate_all (sm, NULL); pkgs = ianjuta_project_manager_get_packages (pm, NULL); for (pkg = pkgs; pkg != NULL; pkg = g_list_next (pkg)) { cpp_packages_activate_package (sm, pkg->data, &packages_to_add); } g_list_free (pkgs); if (packages_to_add) { packages->loading = TRUE; packages->queue = anjuta_command_queue_new (ANJUTA_COMMAND_QUEUE_EXECUTE_MANUAL); for (pkg = packages_to_add; pkg != NULL; pkg = g_list_next (pkg)) { PackageData* pkg_data = pkg->data; AnjutaCommand* command = anjuta_pkg_scanner_new (pkg_data->pkg, pkg_data->version); g_signal_connect (command, "command-finished", G_CALLBACK (on_package_ready), sm); anjuta_command_queue_push (packages->queue, command); } g_list_foreach (packages_to_add, (GFunc) pkg_data_free, NULL); g_list_free (packages_to_add); g_signal_connect (packages->queue, "finished", G_CALLBACK (on_queue_finished), packages); /* Make sure the pointer is valid when the queue finishes */ g_object_ref (packages); anjuta_command_queue_start (packages->queue); } }
static void on_load_libc (GSettings* settings, gchar* key, CppPackages* packages) { gboolean load = g_settings_get_boolean (ANJUTA_PLUGIN_CPP_JAVA(packages->plugin)->settings, key); if (load) { cpp_packages_activate_libc (packages); } else { IAnjutaSymbolManager* sm = anjuta_shell_get_interface (anjuta_plugin_get_shell (ANJUTA_PLUGIN(packages->plugin)), IAnjutaSymbolManager, NULL); ianjuta_symbol_manager_deactivate_package (sm, LIBC, LIBC_VERSION, NULL); } }
static gboolean sourceview_plugin_activate (AnjutaPlugin *obj) { SourceviewPlugin* plugin = ANJUTA_PLUGIN_SOURCEVIEW (obj); AnjutaUI *ui; DEBUG_PRINT ("%s", "SourceviewPlugin: Activating SourceviewPlugin plugin ..."); /* Add menu entries */ ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL); plugin->group = anjuta_ui_add_toggle_action_group_entries (ui, "ActionGroupEditorView", _("Editor view settings"), actions_view, G_N_ELEMENTS (actions_view), GETTEXT_PACKAGE, TRUE, plugin); ui_states_init (plugin, ui); plugin->uiid = anjuta_ui_merge (ui, UI_FILE); return TRUE; }
void create_message_view(Subversion* plugin) { IAnjutaMessageManager* mesg_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell, IAnjutaMessageManager, NULL); plugin->mesg_view = ianjuta_message_manager_get_view_by_name(mesg_manager, _("Subversion"), NULL); if (!plugin->mesg_view) { plugin->mesg_view = ianjuta_message_manager_add_view (mesg_manager, _("Subversion"), ICON_FILE, NULL); g_object_weak_ref (G_OBJECT (plugin->mesg_view), (GWeakNotify)on_mesg_view_destroy, plugin); } ianjuta_message_view_clear(plugin->mesg_view, NULL); ianjuta_message_manager_set_current_view(mesg_manager, plugin->mesg_view, NULL); }
GtkWidget* anjuta_docman_new (DocmanPlugin* plugin, AnjutaPreferences *pref) { GtkWidget *docman; docman = gtk_widget_new (ANJUTA_TYPE_DOCMAN, NULL); if (docman) { AnjutaUI* ui; AnjutaDocman* real_docman = ANJUTA_DOCMAN (docman); real_docman->priv->plugin = plugin; real_docman->priv->preferences = pref; real_docman->priv->documents_action_group = gtk_action_group_new ("ActionGroupDocument"); ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL); gtk_ui_manager_insert_action_group (GTK_UI_MANAGER (ui), real_docman->priv->documents_action_group, 0); g_object_unref (real_docman->priv->documents_action_group); } return docman; }
SymbolDBSystem * symbol_db_system_new (SymbolDBPlugin *sdb_plugin, const SymbolDBEngine *sdbe) { SymbolDBSystem *sdbs; SymbolDBSystemPriv *priv; g_return_val_if_fail (sdbe != NULL, NULL); sdbs = g_object_new (SYMBOL_TYPE_DB_SYSTEM, NULL); priv = sdbs->priv; priv->sdbe_globals = (SymbolDBEngine*)sdbe; priv->lang_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN(sdb_plugin)->shell, IAnjutaLanguage, NULL); g_signal_connect (G_OBJECT (priv->sdbe_globals), "single-file-scan-end", G_CALLBACK (on_engine_package_single_file_scan_end), sdbs); return sdbs; }
static gboolean deactivate_plugin (AnjutaPlugin *plugin) { EditorPlugin* editor = ANJUTA_PLUGIN_EDITOR (plugin); IAnjutaSymbolManager *manager = anjuta_shell_get_interface (plugin->shell, IAnjutaSymbolManager, NULL); AnjutaUI *ui; /* Remove menu items */ ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (plugin)->shell, NULL); anjuta_ui_unmerge (ui, editor->uiid); anjuta_ui_remove_action_group (ui, editor->group); /* Disconnect signals */ g_signal_handlers_disconnect_by_func (G_OBJECT (manager), G_CALLBACK (on_project_symbol_scanned), editor->query_project); g_signal_handlers_disconnect_by_func (G_OBJECT (manager), G_CALLBACK (on_system_symbol_scanned), editor->query_system); g_object_unref (editor->query_project); g_object_unref (editor->query_system); return TRUE; }
/* Remove the starter plugin once a document was opened */ static void on_value_added_current_editor (AnjutaPlugin *plugin, const gchar *name, const GValue *value, gpointer data) { GObject *doc; AnjutaShell *shell; StarterPlugin *splugin; doc = g_value_get_object (value); shell = ANJUTA_PLUGIN(plugin)->shell; splugin = ANJUTA_PLUGIN_STARTER (plugin); if (doc) { if (splugin->priv->starter) { DEBUG_PRINT ("Hiding starter"); anjuta_shell_remove_widget (shell, splugin->priv->starter, NULL); } splugin->priv->starter = NULL; } }