/* callback for gtkpod window's close button */ static gboolean on_gtkpod_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { if (!ok_to_close_gtkpod()) return TRUE; AnjutaPluginManager *plugin_manager; AnjutaApp *app; gchar *remembered_plugins; gchar *session_dir; app = ANJUTA_APP(widget); plugin_manager = anjuta_shell_get_plugin_manager(ANJUTA_SHELL(app), NULL); /* Save remembered plugins */ remembered_plugins = anjuta_plugin_manager_get_remembered_plugins(plugin_manager); g_settings_set_string(app->settings, GTKPOD_REMEMBERED_PLUGINS, remembered_plugins); g_free(remembered_plugins); session_dir = get_user_session_dir(); anjuta_shell_session_save(ANJUTA_SHELL(app), session_dir, NULL); g_free(session_dir); anjuta_shell_notify_exit(ANJUTA_SHELL(app), NULL); if (!gtkpod_cleanup_quit()) { // Dont want to quit so avoid signalling any destroy event return TRUE; } return FALSE; }
static IAnjutaVcs* get_vcs_plugin(AnjutaFileManager* file_manager, const gchar* root_uri) { typedef struct { const gchar* file; const gchar* name; } VcsSystem; VcsSystem vcs_systems[] = { {".svn", "Subversion"}, {".git", "Git"}, {NULL, NULL} }; gint i; const gchar* vcs_system = NULL; IAnjutaVcs* ivcs = NULL; for (i = 0; vcs_systems[i].name != NULL; i++) { gchar* vcs_uri = g_build_filename (root_uri, vcs_systems[i].file, NULL); GFile* vcs_file = g_file_new_for_uri (vcs_uri); if (g_file_query_exists(vcs_file, NULL)) { vcs_system = vcs_systems[i].name; } g_free (vcs_uri); g_object_unref (vcs_file); if (vcs_system) break; } if (vcs_system) { /* Load current language editor support plugins */ AnjutaPluginManager* plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN(file_manager)->shell, NULL); GList* plugin_handles = anjuta_plugin_manager_query (plugin_manager, "Anjuta Plugin", "Interfaces", "IAnjutaVcs", "Vcs", "System", vcs_system, NULL); if (plugin_handles) { ivcs = IANJUTA_VCS(anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, (AnjutaPluginHandle *)plugin_handles->data)); g_signal_connect (G_OBJECT (ivcs), "status_changed", G_CALLBACK (refresh_signal_cb), file_manager); g_list_free (plugin_handles); } } return ivcs; }
static void project_import_checkout_project (AnjutaProjectImportPlugin *import_plugin, ProjectImportDialog *import_dialog) { CheckoutData *ch_data; AnjutaAsyncNotify *async_notify; gchar *vcs_uri, *plugin_id, *name; GFile *dest_dir, *checkout_dir; AnjutaPluginManager *plugin_manager; IAnjutaVcs *ivcs; GError *err; name = project_import_dialog_get_name (import_dialog); dest_dir = project_import_dialog_get_dest_dir (import_dialog); checkout_dir = g_file_get_child (dest_dir, name); g_object_unref (dest_dir); g_free (name); ch_data = g_slice_new (CheckoutData); ch_data->import_plugin = import_plugin; ch_data->import_dialog = import_dialog; ch_data->checkout_dir = checkout_dir; async_notify = anjuta_async_notify_new (); g_signal_connect (async_notify, "finished", G_CALLBACK (checkout_finished), ch_data); vcs_uri = project_import_dialog_get_vcs_uri (import_dialog); plugin_id = project_import_dialog_get_vcs_id (import_dialog); plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (import_plugin)->shell, NULL); ivcs = IANJUTA_VCS (anjuta_plugin_manager_get_plugin_by_id (plugin_manager, plugin_id)); err = NULL; ianjuta_vcs_checkout (ivcs, vcs_uri, checkout_dir, NULL, async_notify, &err); if (err) { anjuta_util_dialog_error (GTK_WINDOW (import_dialog), _("Couldn't check out the supplied URI " "\"%s\". The error returned was: \"%s\""), vcs_uri, err->message); g_error_free (err); goto cleanup; } /* hide the import dialog */ gtk_widget_hide (GTK_WIDGET (import_dialog)); cleanup: g_free (vcs_uri); g_free (plugin_id); }
static IAnjutaVcs* get_vcs_plugin(AnjutaFileManager* file_manager, const gchar* root_uri) { typedef struct { const gchar* file; const gchar* name; } VcsSystem; VcsSystem vcs_systems[] = { {".svn", "Subversion"}, {".git", "Git"}, {NULL, NULL} }; gint i; const gchar* vcs_system = NULL; IAnjutaVcs* ivcs = NULL; for (i = 0; vcs_systems[i].name != NULL; i++) { gchar* vcs_uri = g_build_filename (root_uri, vcs_systems[i].file, NULL); GFile* vcs_file = g_file_new_for_uri (vcs_uri); if (g_file_query_exists(vcs_file, NULL)) { vcs_system = vcs_systems[i].name; } g_free (vcs_uri); g_object_unref (vcs_file); if (vcs_system) break; } if (vcs_system) { /* Load current language editor support plugins */ AnjutaPluginManager* plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN(file_manager)->shell, NULL); GList* plugin_descs = anjuta_plugin_manager_query (plugin_manager, "Anjuta Plugin", "Interfaces", "IAnjutaVcs", "Vcs", "System", vcs_system, NULL); if (plugin_descs) { gchar* plugin_id; anjuta_plugin_description_get_string (plugin_descs->data, "Anjuta Plugin", "Location", &plugin_id); ivcs = IANJUTA_VCS(anjuta_plugin_manager_get_plugin_by_id (plugin_manager, plugin_id)); g_list_free (plugin_descs); } } return ivcs; }
static void add_wizard_buttons (Starter *starter) { AnjutaPluginManager *plugin_manager; GList *node; gint count; GList *plugin_descs = NULL; plugin_manager = anjuta_shell_get_plugin_manager (starter->priv->shell, NULL); plugin_descs = anjuta_plugin_manager_query (plugin_manager, "Anjuta Plugin", "Interfaces", "IAnjutaWizard", NULL); plugin_descs = g_list_sort (plugin_descs, sort_wizards); node = plugin_descs; count = 0; while (node) { AnjutaPluginDescription *desc; gchar *str, *name; desc = node->data; name = NULL; if (anjuta_plugin_description_get_locale_string (desc, "Wizard", "Title", &str) || anjuta_plugin_description_get_locale_string (desc, "Anjuta Plugin", "Name", &str)) { name = g_strdup (N_(str)); g_free (str); } if (name) { GtkWidget *button; button = anjuta_starter_button_new (name); g_free(name); gtk_widget_show (button); g_object_set_data (G_OBJECT (button), "__plugin_desc", desc); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_wizard_clicked), starter); gtk_box_pack_start (GTK_BOX (starter->priv->file_box), button, FALSE, FALSE, 0); } node = g_list_next (node); } g_list_free (plugin_descs); }
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)); }
static void on_wizard_clicked (GtkButton *menuitem, Starter *starter) { AnjutaPluginManager *plugin_manager; AnjutaPluginDescription *desc; desc = g_object_get_data (G_OBJECT (menuitem), "__plugin_desc"); plugin_manager = anjuta_shell_get_plugin_manager (starter->priv->shell, NULL); if (desc) { gchar *id; GObject *plugin; if (anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Location", &id)) { plugin = anjuta_plugin_manager_get_plugin_by_id (plugin_manager, id); ianjuta_wizard_activate (IANJUTA_WIZARD (plugin), NULL); } } }
static void on_new_project_activated (GtkListBoxRow *row, gpointer user_data) { AnjutaPlugin *plugin = ANJUTA_PLUGIN (user_data); AnjutaPluginManager *plugin_manager = anjuta_shell_get_plugin_manager (anjuta_plugin_get_shell (plugin), NULL); GList *plugin_handles = NULL; plugin_handles = anjuta_plugin_manager_query (plugin_manager, "Anjuta Plugin", "Location", PROJECT_WIZARD_ID, NULL); if (plugin_handles != NULL) { GObject* wizard = anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, (AnjutaPluginHandle *)plugin_handles->data); if (wizard) ianjuta_wizard_activate (IANJUTA_WIZARD (wizard), NULL); } g_list_free (plugin_handles); }
static gboolean on_anjuta_delete_event (AnjutaApp *app, GdkEvent *event, gpointer data) { AnjutaPluginManager *plugin_manager; AnjutaProfileManager *profile_manager; AnjutaProfile *current_profile; AnjutaSavePrompt *save_prompt; gchar *remembered_plugins; DEBUG_PRINT ("%s", "AnjutaApp delete event"); plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_SHELL (app), NULL); profile_manager = anjuta_shell_get_profile_manager (ANJUTA_SHELL (app), NULL); /* Save remembered plugins */ remembered_plugins = anjuta_plugin_manager_get_remembered_plugins (plugin_manager); g_settings_set_string (app->settings, ANJUTA_REMEMBERED_PLUGINS, remembered_plugins); g_free (remembered_plugins); /* Check for unsaved data */ save_prompt = anjuta_save_prompt_new (GTK_WINDOW (app)); anjuta_shell_save_prompt (ANJUTA_SHELL (app), save_prompt, NULL); if (anjuta_save_prompt_get_items_count (save_prompt) > 0) { switch (gtk_dialog_run (GTK_DIALOG (save_prompt))) { case GTK_RESPONSE_DELETE_EVENT: case ANJUTA_SAVE_PROMPT_RESPONSE_CANCEL: gtk_widget_destroy (GTK_WIDGET (save_prompt)); /* Do not exit now */ return TRUE; case ANJUTA_SAVE_PROMPT_RESPONSE_DISCARD: case ANJUTA_SAVE_PROMPT_RESPONSE_SAVE_CLOSE: /* exit now */ break; } } /* Wait for files to be really saved (asyncronous operation) */ if (app->save_count > 0) { g_message ("Waiting for %d file(s) to be saved!", app->save_count); while (app->save_count > 0) { g_main_context_iteration (NULL, TRUE); } } /* If current active profile is "user", save current session as * default session */ current_profile = anjuta_profile_manager_get_current (profile_manager); if (strcmp (anjuta_profile_get_name (current_profile), "user") == 0) { gchar *session_dir; session_dir = USER_SESSION_PATH_NEW; anjuta_shell_session_save (ANJUTA_SHELL (app), session_dir, NULL); g_free (session_dir); } anjuta_shell_notify_exit (ANJUTA_SHELL (app), NULL); gtk_widget_destroy (GTK_WIDGET (save_prompt)); /* Shutdown */ if (g_object_get_data (G_OBJECT (app), "__proper_shutdown")) { gtk_widget_hide (GTK_WIDGET (app)); anjuta_plugin_manager_unload_all_plugins (anjuta_shell_get_plugin_manager (ANJUTA_SHELL (app), NULL)); } return FALSE; }
void gtkpod_init(int argc, char *argv[]) { AnjutaPluginManager *plugin_manager; AnjutaProfileManager *profile_manager; AnjutaApp *app; AnjutaStatus *status; AnjutaProfile *profile; GFile *session_profile; GError *error = NULL; gchar *default_profile_file = NULL; gchar *user_profile_file = NULL; gchar *ui_file = NULL; gchar *remembered_plugins = NULL; gchar *session_dir = NULL; gchar *splash = NULL; /* Initialise important directories */ init_directories(argv); register_stock_icon(GTKPOD_ICON, GTKPOD_ICON_STOCK_ID); /* Initialise the ui file */ ui_file = g_build_filename(get_ui_dir(), "gtkpod.ui", NULL); anjuta_set_ui_file_path(ui_file); /* Register the application icon */ register_stock_icon("gtkpod", GTKPOD_APP_ICON_STOCK_ID); /* Initialize application class instance*/ app = ANJUTA_APP(anjuta_app_new()); gtkpod_app = GTKPOD_APP(app); /* Initialise the preferences as required for the display of the splash screen */ prefs_init(argc, argv); /* Show some progress as the app is initialised */ status = anjuta_shell_get_status(ANJUTA_SHELL(app), NULL); anjuta_status_progress_add_ticks(status, 1); /* Show the splash screen if user requires */ if (! prefs_get_int(DISABLE_SPLASH_SCREEN)) { splash = g_build_filename(get_icon_dir(), "gtkpod-splash.png", NULL); if (g_file_test(splash, G_FILE_TEST_IS_REGULAR)) anjuta_status_set_splash(status, splash, 100); else { anjuta_status_disable_splash(status, TRUE); } g_free(splash); } /* * initialise gtkpod library items. Needs to be safety threaded due * to splash screen. */ gdk_threads_enter(); gp_init(argc, argv); gdk_threads_leave(); /* Add blocking widgets from the framework */ add_blocked_widget(app->toolbar); add_blocked_widget(app->view_menu); /* Set up shutdown signals */ g_signal_connect(G_OBJECT(app), "delete_event", G_CALLBACK( on_gtkpod_delete_event), NULL); g_signal_connect(G_OBJECT(app), "destroy", G_CALLBACK(on_gtkpod_destroy), NULL); plugin_manager = anjuta_shell_get_plugin_manager(ANJUTA_SHELL(app), NULL); profile_manager = anjuta_shell_get_profile_manager(ANJUTA_SHELL(app), NULL); /* Restore remembered plugins */ remembered_plugins = g_settings_get_string(app->settings, GTKPOD_REMEMBERED_PLUGINS); if (remembered_plugins) anjuta_plugin_manager_set_remembered_plugins(plugin_manager, remembered_plugins); g_free(remembered_plugins); /* Load default profile */ default_profile_file = get_default_profile_path(); profile = anjuta_profile_new(USER_PROFILE_NAME, plugin_manager); session_profile = g_file_new_for_path(default_profile_file); anjuta_profile_add_plugins_from_xml(profile, session_profile, TRUE, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } g_object_unref(session_profile); g_free(default_profile_file); /* Load user session profile */ user_profile_file = get_user_profile_path(); session_profile = g_file_new_for_path(user_profile_file); if (g_file_query_exists(session_profile, NULL)) { anjuta_profile_add_plugins_from_xml(profile, session_profile, FALSE, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } } anjuta_profile_set_sync_file(profile, session_profile); g_object_unref(session_profile); g_free(user_profile_file); /* Load profile */ anjuta_profile_manager_freeze(profile_manager); anjuta_profile_manager_push(profile_manager, profile, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } /* Prepare for session save and load on profile change */ g_signal_connect (profile_manager, "profile-scoped", G_CALLBACK (on_profile_scoped), app); anjuta_profile_manager_thaw(profile_manager, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } g_signal_connect (profile_manager, "profile-descoped", G_CALLBACK (on_profile_descoped), app); gdk_threads_enter(); gp_init_itdbs(); gdk_threads_leave(); /* Load layout.*/ session_dir = get_user_session_dir(); if (!g_file_test(session_dir, G_FILE_TEST_IS_DIR)) session_dir = g_strdup(get_data_dir()); /* Restore session */ anjuta_shell_session_load(ANJUTA_SHELL(app), session_dir, NULL); g_free(session_dir); anjuta_status_progress_tick(status, NULL, _("Loaded Session...")); anjuta_status_disable_splash(status, TRUE); gtk_window_set_default_icon_name("gtkpod"); gtk_window_set_auto_startup_notification(TRUE); gtk_window_set_role(GTK_WINDOW(app), "gtkpod-app"); gtk_widget_show(GTK_WIDGET(app)); }
gboolean anjuta_pm_project_load (AnjutaPmProject *project, GFile *file, GError **error) { AnjutaPluginManager *plugin_manager; GList *desc; IAnjutaProjectBackend *backend; gint found = 0; GValue value = {0, }; g_return_val_if_fail (file != NULL, FALSE); DEBUG_PRINT ("loading gbf backend…\n"); plugin_manager = anjuta_shell_get_plugin_manager (project->plugin->shell, NULL); if (!anjuta_plugin_manager_is_active_plugin (plugin_manager, "IAnjutaProjectBackend")) { GList *descs = NULL; descs = anjuta_plugin_manager_query (plugin_manager, "Anjuta Plugin", "Interfaces", "IAnjutaProjectBackend", NULL); backend = NULL; for (desc = g_list_first (descs); desc != NULL; desc = g_list_next (desc)) { AnjutaPluginDescription *backend_desc; gchar *location = NULL; IAnjutaProjectBackend *plugin; gint backend_val; backend_desc = (AnjutaPluginDescription *)desc->data; anjuta_plugin_description_get_string (backend_desc, "Anjuta Plugin", "Location", &location); plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager, location); g_free (location); backend_val = ianjuta_project_backend_probe (plugin, file, NULL); if (backend_val > found) { /* Backend found */; backend = plugin; found = backend_val; } } g_list_free (descs); } else { /* A backend is already loaded, use it */ backend = IANJUTA_PROJECT_BACKEND (anjuta_shell_get_object (project->plugin->shell, "IAnjutaProjectBackend", NULL)); g_object_ref (backend); } if (!backend) { /* FIXME: Set err */ g_warning ("no backend available for this project\n"); return FALSE; } DEBUG_PRINT ("%s", "Creating new gbf project\n"); project->project = ianjuta_project_backend_new_project (backend, file, NULL); if (!project->project) { /* FIXME: Set err */ g_warning ("project creation failed\n"); return FALSE; } g_signal_connect (G_OBJECT (project->project), "file-changed", G_CALLBACK (on_file_changed), project); g_signal_connect (G_OBJECT (project->project), "node-loaded", G_CALLBACK (on_node_loaded), project); g_signal_connect (G_OBJECT (project->project), "node-changed", G_CALLBACK (on_node_changed), project); project->root = ianjuta_project_get_root (project->project, NULL); /* Export project root shell variable */ g_value_init (&value, G_TYPE_OBJECT); g_value_set_object (&value, project->project); anjuta_shell_add_value (project->plugin->shell, IANJUTA_PROJECT_MANAGER_CURRENT_PROJECT, &value, NULL); g_value_unset(&value); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, ANJUTA_PLUGIN_PROJECT_MANAGER (project->plugin)->project_root_uri); anjuta_shell_add_value (project->plugin->shell, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI, &value, NULL); g_value_unset(&value); ianjuta_project_load_node (project->project, project->root, NULL); return TRUE; }
static void ifile_open (IAnjutaFile *ifile, GFile* file, GError **err) { AnjutaProjectImportPlugin* plugin = ANJUTA_PLUGIN_PROJECT_IMPORT (ifile); gchar *mime_type; g_return_if_fail (G_IS_FILE (file)); mime_type = anjuta_util_get_file_mime_type (file); if (g_strcmp0 (mime_type,"application/x-anjuta-old") == 0) { /* Automatically import old Anjuta project */ gchar *ext, *project_name; GFile *dir; ProjectImportDialog* pi; AnjutaPluginManager *plugin_manager; dir = g_file_get_parent (file); project_name = g_file_get_basename (file); ext = strrchr (project_name, '.'); if (ext) *ext = '\0'; plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (plugin)->shell, NULL); pi = project_import_dialog_new (plugin_manager, project_name, dir); g_signal_connect (pi, "response", G_CALLBACK (import_dialog_response), plugin); gtk_widget_show (GTK_WIDGET (pi)); g_object_unref (dir); g_free (project_name); } else if (g_strcmp0 (mime_type,"inode/directory") == 0) { GFileEnumerator *dir; dir = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, NULL); if (dir) { /* Look for anjuta project file in the directory */ GFileInfo *info; for (info = g_file_enumerator_next_file (dir, NULL, NULL); info != NULL; info = g_file_enumerator_next_file (dir, NULL, NULL)) { gchar *mime_type = anjuta_util_get_file_info_mime_type (info); if (g_strcmp0 (mime_type, "application/x-anjuta") == 0) { /* Open the first anjuta project file */ IAnjutaFileLoader *loader; loader = anjuta_shell_get_interface(ANJUTA_PLUGIN (plugin)->shell, IAnjutaFileLoader, NULL); if (loader != NULL) { GFile* project_file = g_file_get_child (file, g_file_info_get_name(info)); ianjuta_file_loader_load(loader, project_file, FALSE, NULL); g_object_unref (project_file); } g_free (mime_type); g_object_unref (info); break; } g_free (mime_type); g_object_unref (info); } if (info == NULL) { /* Else import the directory */ ProjectImportDialog* pi; AnjutaPluginManager *plugin_manager; gchar *basename; plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (plugin)->shell, NULL); basename = g_file_get_basename (file); pi = project_import_dialog_new (plugin_manager, basename, file); g_free (basename); g_signal_connect (pi, "response", G_CALLBACK (import_dialog_response), plugin); gtk_widget_show (GTK_WIDGET (pi)); } g_object_unref (dir); } } g_free (mime_type); }
static gboolean project_import_import_project (AnjutaProjectImportPlugin *import_plugin, ProjectImportDialog *import_dialog, GFile *source_dir) { AnjutaPluginManager *plugin_manager; GList *descs = NULL; GList *desc; AnjutaPluginDescription *backend; gchar *name, *project_file_name; /* Search for all valid project backend */ plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN(import_plugin)->shell, NULL); descs = anjuta_plugin_manager_query (plugin_manager, "Anjuta Plugin", "Interfaces", "IAnjutaProjectBackend", NULL); for (desc = g_list_first (descs); desc != NULL;) { IAnjutaProjectBackend *plugin; gchar *location = NULL; GList *next; backend = (AnjutaPluginDescription *)desc->data; anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Location", &location); plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager, location); g_free (location); next = g_list_next (desc); /* Probe the project directory to find if the backend can handle it */ if (ianjuta_project_backend_probe (plugin, source_dir, NULL) <= 0) { /* Remove invalid backend */ descs = g_list_delete_link (descs, desc); } desc = next; } if (descs == NULL) { backend = NULL; } else if (g_list_next (descs) == NULL) { backend = (AnjutaPluginDescription *)descs->data; } else { /* Several backend are possible, ask the user to select one */ gchar *path = project_import_dialog_get_name (import_dialog); gchar* message = g_strdup_printf (_("Please select a project backend to open %s."), path); g_free (path); backend = anjuta_plugin_manager_select (plugin_manager, _("Open With"), message, descs); g_free (message); } g_list_free (descs); if (backend == NULL) { gchar *path = project_import_dialog_get_name (import_dialog); /* show the dialog since it may be hidden */ gtk_widget_show (GTK_WIDGET (import_dialog)); anjuta_util_dialog_error (GTK_WINDOW (import_dialog), _("Could not find a valid project backend for the " "given directory (%s). Please select a different " "directory, or try upgrading to a newer version of " "Anjuta."), path); g_free (path); return FALSE; } name = project_import_dialog_get_name (import_dialog); project_file_name = g_strconcat (name, ".", "anjuta", NULL); GFile *project_file = g_file_get_child (source_dir, project_file_name); g_free (name); g_free (project_file_name); IAnjutaFileLoader* loader; if (!project_import_generate_file (backend, import_dialog, project_file)) { g_object_unref (project_file); return FALSE; } loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (import_plugin)->shell, IAnjutaFileLoader, NULL); if (!loader) { g_warning("No IAnjutaFileLoader interface! Cannot open project file!"); g_object_unref (project_file); return TRUE; } ianjuta_file_loader_load (loader, project_file, FALSE, NULL); g_object_unref (project_file); return TRUE; }