static void cpp_packages_load_user (CppPackages* packages, gboolean force) { CppJavaPlugin* plugin = ANJUTA_PLUGIN_CPP_JAVA(packages->plugin); AnjutaShell* shell = anjuta_plugin_get_shell (ANJUTA_PLUGIN (plugin)); IAnjutaSymbolManager* sm = anjuta_shell_get_interface (shell, IAnjutaSymbolManager, NULL); gboolean loaded = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (shell), USER_LOADED)); if (!loaded || force) { gchar* packages_str = g_settings_get_string (plugin->settings, PREF_USER_PACKAGES); GStrv pkgs = g_strsplit (packages_str, ";", -1); gchar** package; GList* packages_to_add = NULL; GList* pkg; ianjuta_symbol_manager_deactivate_all (sm, NULL); for (package = pkgs; *package != NULL; package++) { cpp_packages_activate_package (sm, *package, &packages_to_add); } g_strfreev (pkgs); g_free (packages_str); 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_object_set_data (G_OBJECT (shell), USER_LOADED, GINT_TO_POINTER (TRUE)); 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); } } }
void git_ivcs_query_status (IAnjutaVcs *obj, GFile *file, IAnjutaVcsStatusCallback callback, gpointer user_data, GCancellable *cancel, AnjutaAsyncNotify *notify, GError **err) { gchar *path; GitStatusCommand *status_command; path = g_file_get_path (file); status_command = git_status_command_new (path, ~0); g_free (path); g_object_set_data (G_OBJECT (status_command), "user-data", user_data); g_object_set_data_full (G_OBJECT (status_command), "working-directory", g_file_get_path (file), (GDestroyNotify) g_free); g_signal_connect (G_OBJECT (status_command), "data-arrived", G_CALLBACK (on_status_command_data_arrived), callback); g_signal_connect (G_OBJECT (status_command), "command-finished", G_CALLBACK (g_object_unref), NULL); #if 0 if (cancel) { g_signal_connect_swapped (G_OBJECT (cancel), "cancelled", G_CALLBACK (anjuta_command_cancel), status_command); } #endif if (notify) { g_signal_connect_swapped (G_OBJECT (status_command), "command-finished", G_CALLBACK (anjuta_async_notify_notify_finished), notify); } anjuta_command_queue_push (ANJUTA_PLUGIN_GIT (obj)->command_queue, ANJUTA_COMMAND (status_command)); }
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_ok_action_activated (GtkAction *action, GitDeleteBranchesPane *self) { Git *plugin; GtkToggleButton *require_merged_check; GList *selected_local_branches; GList *selected_remote_branches; GitBranchDeleteCommand *local_delete_command; GitBranchDeleteCommand *remote_delete_command; AnjutaCommandQueue *queue; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); require_merged_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "require_merged_check")); selected_local_branches = git_branches_pane_get_selected_local_branches (GIT_BRANCHES_PANE (plugin->branches_pane)); selected_remote_branches = git_branches_pane_get_selected_remote_branches (GIT_BRANCHES_PANE (plugin->branches_pane)); /* The user might not have selected anything */ if (git_branches_pane_count_selected_items (GIT_BRANCHES_PANE (plugin->branches_pane)) > 0) { queue = anjuta_command_queue_new (ANJUTA_COMMAND_QUEUE_EXECUTE_MANUAL); if (selected_local_branches) { local_delete_command = git_branch_delete_command_new (plugin->project_root_directory, selected_local_branches, FALSE, gtk_toggle_button_get_active (require_merged_check)); anjuta_util_glist_strings_free (selected_local_branches); g_signal_connect (G_OBJECT (local_delete_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (local_delete_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_queue_push (queue, ANJUTA_COMMAND (local_delete_command)); } if (selected_remote_branches) { remote_delete_command = git_branch_delete_command_new (plugin->project_root_directory, selected_remote_branches, TRUE, gtk_toggle_button_get_active (require_merged_check)); anjuta_util_glist_strings_free (selected_remote_branches); g_signal_connect (G_OBJECT (remote_delete_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (remote_delete_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_queue_push (queue, ANJUTA_COMMAND (remote_delete_command)); } /* Run the commands */ g_signal_connect (G_OBJECT (queue), "finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_queue_start (queue); } git_pane_remove_from_dock (GIT_PANE (self)); }