static void ide_run_manager_do_install_before_run (IdeRunManager *self, GTask *task) { IdeBuildManager *build_manager; IdeContext *context; g_assert (IDE_IS_RUN_MANAGER (self)); g_assert (G_IS_TASK (task)); context = ide_object_get_context (IDE_OBJECT (self)); build_manager = ide_context_get_build_manager (context); /* * First we need to make sure the target is up to date and installed * so that all the dependent resources are available. */ self->busy = TRUE; g_signal_connect_object (task, "notify::completed", G_CALLBACK (ide_run_manager_task_completed), self, G_CONNECT_SWAPPED); ide_build_manager_install_async (build_manager, g_task_get_cancellable (task), ide_run_manager_install_cb, g_object_ref (task)); ide_run_manager_notify_busy (self); }
static void ide_omni_bar_context_set (GtkWidget *widget, IdeContext *context) { IdeOmniBar *self = (IdeOmniBar *)widget; IdeConfigurationManager *config_manager = NULL; IdeBuildManager *build_manager = NULL; GListModel *pausables = NULL; IdeProject *project = NULL; IdeVcs *vcs = NULL; IDE_ENTRY; g_assert (IDE_IS_OMNI_BAR (self)); g_assert (!context || IDE_IS_CONTEXT (context)); ide_omni_bar_update (self); if (context != NULL) { vcs = ide_context_get_vcs (context); build_manager = ide_context_get_build_manager (context); config_manager = ide_context_get_configuration_manager (context); project = ide_context_get_project (context); pausables = _ide_context_get_pausables (context); } dzl_binding_group_set_source (self->build_manager_bindings, build_manager); dzl_signal_group_set_target (self->build_manager_signals, build_manager); dzl_binding_group_set_source (self->config_manager_bindings, config_manager); dzl_signal_group_set_target (self->config_manager_signals, config_manager); dzl_binding_group_set_source (self->project_bindings, project); dzl_binding_group_set_source (self->vcs_bindings, vcs); dzl_list_box_set_model (self->pausables, pausables); if (config_manager != NULL) ide_omni_bar__config_manager__notify_current (self, NULL, config_manager); IDE_EXIT; }
static void ide_omni_bar_next_message (IdeOmniBar *self) { IdeBuildManager *build_manager; const gchar *name; IdeContext *context; g_assert (IDE_IS_OMNI_BAR (self)); if (NULL == (context = ide_widget_get_context (GTK_WIDGET (self)))) return; build_manager = ide_context_get_build_manager (context); name = gtk_stack_get_visible_child_name (self->message_stack); /* * TODO: This isn't the cleanest way to do this. * We need to come up with a strategy for moving between these * in a way that has a "check" function to determine if we can * toggle to the next child. */ if (g_strcmp0 (name, "config") == 0) { /* Only rotate to build result if we have one and we haven't * flapped too many times. */ if (self->did_build && self->seen_count < 2) gtk_stack_set_visible_child_name (self->message_stack, "build"); } else if (!ide_build_manager_get_busy (build_manager)) { self->seen_count++; gtk_stack_set_visible_child_name (self->message_stack, "config"); } }
void ide_workbench_set_context (IdeWorkbench *self, IdeContext *context) { g_autoptr(GSettings) settings = NULL; IdeBuildManager *build_manager; IdeRunManager *run_manager; IdeProject *project; guint delay_msec; IDE_ENTRY; g_return_if_fail (IDE_IS_WORKBENCH (self)); g_return_if_fail (IDE_IS_CONTEXT (context)); g_return_if_fail (self->context == NULL); settings = g_settings_new ("org.gnome.builder"); g_set_object (&self->context, context); project = ide_context_get_project (context); g_object_bind_property_full (project, "name", self, "title", G_BINDING_SYNC_CREATE, transform_title, NULL, NULL, NULL); build_manager = ide_context_get_build_manager (context); gtk_widget_insert_action_group (GTK_WIDGET (self), "build-manager", G_ACTION_GROUP (build_manager)); run_manager = ide_context_get_run_manager (context); gtk_widget_insert_action_group (GTK_WIDGET (self), "run-manager", G_ACTION_GROUP (run_manager)); self->addins = peas_extension_set_new (peas_engine_get_default (), IDE_TYPE_WORKBENCH_ADDIN, NULL); g_signal_connect (self->addins, "extension-added", G_CALLBACK (ide_workbench_addin_added), self); g_signal_connect (self->addins, "extension-removed", G_CALLBACK (ide_workbench_addin_removed), self); peas_extension_set_foreach (self->addins, ide_workbench_addin_added, self); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CONTEXT]); /* * Creating all the addins above is a bit intensive, so give ourselves * just a bit of time to stablize allocations and sizing before * transitioning to the editor. */ delay_msec = self->disable_greeter ? 0 : STABLIZE_DELAY_MSEC; g_timeout_add (delay_msec, stablize_cb, g_object_ref (self)); /* * When restoring, previous buffers may get loaded. This causes new * widgets to be created and added to the workspace. Doing so during * the stack transition results in non-smooth transitions. So instead, * we will delay until the transition has completed. */ if (g_settings_get_boolean (settings, "restore-previous-files")) { guint duration = 0; if (!self->disable_greeter) duration = gtk_stack_get_transition_duration (self->perspectives_stack); g_timeout_add (delay_msec + duration, restore_in_timeout, g_object_ref (context)); } IDE_EXIT; }
static void gbp_flatpak_dependency_updater_update_async (IdeDependencyUpdater *updater, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { GbpFlatpakDependencyUpdater *self = (GbpFlatpakDependencyUpdater *)updater; GbpFlatpakDownloadStage *stage = NULL; g_autoptr(GTask) task = NULL; IdeBuildPipeline *pipeline; IdeBuildManager *manager; IdeContext *context; g_assert (GBP_IS_FLATPAK_DEPENDENCY_UPDATER (self)); g_assert (!cancellable || G_IS_CANCELLABLE (cancellable)); task = g_task_new (self, cancellable, callback, user_data); g_task_set_source_tag (task, gbp_flatpak_dependency_updater_update_async); g_task_set_priority (task, G_PRIORITY_LOW); context = ide_object_get_context (IDE_OBJECT (self)); g_assert (IDE_IS_CONTEXT (context)); manager = ide_context_get_build_manager (context); g_assert (IDE_IS_BUILD_MANAGER (manager)); pipeline = ide_build_manager_get_pipeline (manager); g_assert (!pipeline || IDE_IS_BUILD_PIPELINE (pipeline)); if (pipeline == NULL) { g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "Cannot update flatpak dependencies until build pipeline is initialized"); return; } /* Find the downloads stage and tell it to download updates one time */ ide_build_pipeline_foreach_stage (pipeline, find_download_stage_cb, &stage); if (stage == NULL) { /* Synthesize success if they weren't using flatpak. */ g_task_return_boolean (task, TRUE); return; } gbp_flatpak_download_stage_force_update (stage); /* Ensure downloads and everything past it is invalidated */ ide_build_pipeline_invalidate_phase (pipeline, IDE_BUILD_PHASE_DOWNLOADS); /* Start building all the way up to the project configure so that * the user knows if the updates broke their configuration or anything. */ ide_build_manager_rebuild_async (manager, IDE_BUILD_PHASE_CONFIGURE, NULL, gbp_flatpak_dependency_updater_update_cb, g_steal_pointer (&task)); }