void ide_application_load_addins (IdeApplication *self) { g_return_if_fail (IDE_IS_APPLICATION (self)); self->addins = peas_extension_set_new (peas_engine_get_default (), IDE_TYPE_APPLICATION_ADDIN, NULL); g_signal_connect_object (self->addins, "extension-added", G_CALLBACK (ide_application_addin_added), self, 0); g_signal_connect_object (self->addins, "extension-removed", G_CALLBACK (ide_application_addin_removed), self, 0); peas_extension_set_foreach (self->addins, ide_application_addin_added, self); }
static void irc_application_load_plugins (IrcApplication *self) { IrcApplicationPrivate *priv = irc_application_get_instance_private (IRC_APPLICATION(self)); PeasEngine *engine = peas_engine_get_default(); peas_engine_enable_loader (engine, "python3"); g_autofree char *custom_path = get_custom_plugin_dir (); if (custom_path) { peas_engine_add_search_path (engine, custom_path, NULL); } else { g_autofree char *plugin_path = g_build_filename (LIBDIR, "irc", NULL); g_autofree char *user_plugin_path = g_build_filename (g_get_home_dir (), ".local", "lib", "irc", NULL); peas_engine_add_search_path (engine, user_plugin_path, NULL); peas_engine_add_search_path (engine, plugin_path, NULL); } priv->extensions = peas_extension_set_new (engine, PEAS_TYPE_ACTIVATABLE, "object", self, NULL); g_settings_bind (priv->settings, "enabled-plugins", engine, "loaded-plugins", G_SETTINGS_BIND_DEFAULT); peas_extension_set_foreach (priv->extensions, on_extension_added, self); g_signal_connect (priv->extensions, "extension-added", G_CALLBACK(on_extension_added), self); g_signal_connect (priv->extensions, "extension-removed", G_CALLBACK(on_extension_removed), self); }
static void ide_editor_view_load_addins (IdeEditorView *self) { PeasEngine *engine; g_assert (IDE_IS_EDITOR_VIEW (self)); g_assert (self->extensions == NULL); engine = peas_engine_get_default (); self->extensions = peas_extension_set_new (engine, IDE_TYPE_EDITOR_VIEW_ADDIN, NULL); g_signal_connect_object (self->extensions, "extension-added", G_CALLBACK (ide_editor_view__extension_added), self, 0); g_signal_connect_object (self->extensions, "extension-removed", G_CALLBACK (ide_editor_view__extension_removed), self, 0); peas_extension_set_foreach (self->extensions, ide_editor_view__extension_added, self); }
static void ide_frame_constructed (GObject *object) { IdeFrame *self = (IdeFrame *)object; IdeFramePrivate *priv = ide_frame_get_instance_private (self); g_assert (IDE_IS_FRAME (self)); G_OBJECT_CLASS (ide_frame_parent_class)->constructed (object); priv->addins = peas_extension_set_new (peas_engine_get_default (), IDE_TYPE_FRAME_ADDIN, NULL); g_signal_connect (priv->addins, "extension-added", G_CALLBACK (ide_frame_addin_added), self); g_signal_connect (priv->addins, "extension-removed", G_CALLBACK (ide_frame_addin_removed), self); peas_extension_set_foreach (priv->addins, ide_frame_addin_added, self); gtk_widget_add_events (GTK_WIDGET (priv->event_box), GDK_TOUCH_MASK); priv->pan = g_object_new (GTK_TYPE_GESTURE_PAN, "widget", priv->event_box, "orientation", GTK_ORIENTATION_HORIZONTAL, "n-points", 3, NULL); g_signal_connect_swapped (priv->pan, "begin", G_CALLBACK (ide_frame_pan_begin), self); g_signal_connect_swapped (priv->pan, "update", G_CALLBACK (ide_frame_pan_update), self); g_signal_connect_swapped (priv->pan, "end", G_CALLBACK (ide_frame_pan_end), self); gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->pan), GTK_PHASE_BUBBLE); /* * FIXME: Our priv->pan gesture does not activate unless we add another * dummy gesture. I currently have no idea why that is. * * https://bugzilla.gnome.org/show_bug.cgi?id=788914 */ priv->dummy = gtk_gesture_rotate_new (GTK_WIDGET (priv->event_box)); gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->dummy), GTK_PHASE_BUBBLE); }
void ide_workbench_set_context (IdeWorkbench *self, IdeContext *context) { g_autoptr(GSettings) settings = NULL; IdeProject *project; guint duration; 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); 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); /* * Creating all the addins above is a bit intenstive, so give ourselves * just a bit of time to stablize allocations and sizing before * transitioning to the editor. */ g_timeout_add (STABLIZE_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")) { duration = gtk_stack_get_transition_duration (self->top_stack); g_timeout_add (STABLIZE_DELAY_MSEC + duration, restore_in_timeout, g_object_ref (context)); } }
static void ide_frame_notify_visible_child (IdeFrame *self, GParamSpec *pspec, GtkStack *stack) { IdeFramePrivate *priv = ide_frame_get_instance_private (self); GtkWidget *visible_child; g_assert (IDE_IS_FRAME (self)); g_assert (GTK_IS_STACK (stack)); if (gtk_widget_in_destruction (GTK_WIDGET (self))) return; if ((visible_child = gtk_stack_get_visible_child (priv->stack))) { if (gtk_widget_in_destruction (visible_child)) visible_child = NULL; } /* * Mux/Proxy actions to our level so that they also be activated * from the header bar without any weirdness by the View. */ dzl_gtk_widget_mux_action_groups (GTK_WIDGET (self), visible_child, "IDE_FRAME_MUXED_ACTION"); /* Update our bindings targets */ dzl_binding_group_set_source (priv->bindings, visible_child); dzl_signal_group_set_target (priv->signals, visible_child); /* Show either the empty state, failed state, or actual page */ if (visible_child != NULL && ide_page_get_failed (IDE_PAGE (visible_child))) gtk_stack_set_visible_child (priv->top_stack, GTK_WIDGET (priv->failed_state)); else if (visible_child != NULL) gtk_stack_set_visible_child (priv->top_stack, GTK_WIDGET (priv->stack)); else gtk_stack_set_visible_child (priv->top_stack, GTK_WIDGET (priv->empty_placeholder)); /* Allow the header to update settings */ _ide_frame_header_update (priv->header, IDE_PAGE (visible_child)); /* Ensure action state is up to date */ _ide_frame_update_actions (self); if (priv->addins != NULL) peas_extension_set_foreach (priv->addins, ide_frame_notify_addin_of_page, visible_child); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_VISIBLE_CHILD]); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_HAS_VIEW]); }
static PeasExtensionSet * liferea_auth_get_extension_set (void) { if (!extensions) { extensions = peas_extension_set_new (PEAS_ENGINE (liferea_plugins_engine_get_default ()), LIFEREA_AUTH_ACTIVATABLE_TYPE, NULL); g_signal_connect (extensions, "extension-added", G_CALLBACK (on_extension_added), NULL); g_signal_connect (extensions, "extension-removed", G_CALLBACK (on_extension_removed), NULL); peas_extension_set_foreach (extensions, on_extension_added, NULL); } return extensions; }
static void consort_shell_init (ConsortShell *object) { ConsortShellPrivate *priv = CONSORT_SHELL_GET_PRIVATE (object); struct desktop *desktop; /* Set up the PeasEngine */ priv->engine = peas_engine_get_default (); priv->extensions = peas_extension_set_new (peas_engine_get_default (), PEAS_TYPE_ACTIVATABLE, "object", object, NULL); peas_engine_add_search_path (priv->engine, CONSORT_SHELL_PLUGIN_DATA_DIR, CONSORT_SHELL_PLUGIN_DIR); peas_engine_enable_loader (priv->engine, "python3"); /* Plugin manager */ priv->plugin_manager = peas_gtk_plugin_manager_new (priv->engine); priv->plugin_window = plugin_window_create (priv); gtk_window_set_title (priv->plugin_window, "Consort2 Plugin Manager"); gtk_widget_show_all (priv->plugin_window); /* Preload any plugins */ peas_extension_set_foreach (priv->extensions, (PeasExtensionSetForeachFunc) on_extension_added, object); g_signal_connect (priv->extensions, "extension-added", G_CALLBACK (on_extension_added), object); g_signal_connect (priv->extensions, "extension-removed", G_CALLBACK (on_extension_removed), object); desktop = malloc(sizeof *desktop); desktop->output = NULL; desktop->shell = NULL; desktop->gdk_display = gdk_display_get_default(); desktop->display = gdk_wayland_display_get_wl_display(desktop->gdk_display); if (desktop->display == NULL) { fprintf(stderr, "failed to get display: %m\n"); return -1; } desktop->registry = wl_display_get_registry(desktop->display); wl_registry_add_listener(desktop->registry, ®istry_listener, desktop); /* Wait until we have been notified about the compositor and shell * objects */ while (!desktop->output || !desktop->shell) wl_display_roundtrip (desktop->display); priv->desktop = desktop; }
static void ide_primary_workspace_actions_update_dependencies (GSimpleAction *action, GVariant *param, gpointer user_data) { IdePrimaryWorkspace *self = user_data; g_autoptr(PeasExtensionSet) set = NULL; g_autoptr(IdeNotification) notif = NULL; g_autoptr(IdeTask) task = NULL; UpdateDependencies *state; IdeContext *context; g_assert (IDE_IS_MAIN_THREAD ()); g_assert (G_IS_SIMPLE_ACTION (action)); g_assert (IDE_IS_PRIMARY_WORKSPACE (self)); context = ide_widget_get_context (GTK_WIDGET (self)); notif = ide_notification_new (); ide_notification_set_title (notif, _("Updating Dependencies…")); ide_notification_set_body (notif, _("Builder is updating your projects configured dependencies.")); ide_notification_set_icon_name (notif, "software-update-available-symbolic"); ide_notification_set_has_progress (notif, TRUE); ide_notification_set_progress_is_imprecise (notif, TRUE); ide_notification_attach (notif, IDE_OBJECT (context)); state = g_slice_new0 (UpdateDependencies); state->n_active = 0; state->notif = g_object_ref (notif); task = ide_task_new (self, NULL, NULL, NULL); ide_task_set_source_tag (task, ide_primary_workspace_actions_update_dependencies); ide_task_set_task_data (task, state, update_dependencies_free); set = peas_extension_set_new (peas_engine_get_default (), IDE_TYPE_DEPENDENCY_UPDATER, NULL); peas_extension_set_foreach (set, ide_primary_workspace_actions_update_dependencies_cb, task); if (state->n_active == 0) ide_task_return_boolean (task, TRUE); }
static void ide_recent_projects_init (IdeRecentProjects *self) { PeasExtensionSet *set; PeasEngine *engine; self->projects = g_sequence_new (g_object_unref); self->miners = g_ptr_array_new_with_free_func (g_object_unref); self->cancellable = g_cancellable_new (); self->recent_uris = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); self->file_uri = g_build_filename (g_get_user_data_dir (), ide_get_program_name (), IDE_RECENT_PROJECTS_BOOKMARK_FILENAME, NULL); engine = peas_engine_get_default (); set = peas_extension_set_new (engine, IDE_TYPE_PROJECT_MINER, NULL); peas_extension_set_foreach (set, foreach_miner_func, self); g_clear_object (&set); }
static void ide_editor_view__buffer_notify_language (IdeEditorView *self, GParamSpec *pspec, IdeBuffer *document) { g_assert (IDE_IS_EDITOR_VIEW (self)); g_assert (IDE_IS_BUFFER (document)); if (self->extensions != NULL) { GtkSourceLanguage *language; const gchar *language_id; language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (document)); language_id = language ? gtk_source_language_get_id (language) : NULL; peas_extension_set_foreach (self->extensions, notify_language_foreach, (gchar *)language_id); } }
static void ide_editor_perspective_hierarchy_changed (GtkWidget *widget, GtkWidget *old_toplevel) { IdeEditorPerspective *self = (IdeEditorPerspective *)widget; g_assert (IDE_IS_EDITOR_PERSPECTIVE (self)); g_assert (!old_toplevel || GTK_IS_WIDGET (old_toplevel)); if (self->addins == NULL) { GtkWidget *toplevel; /* * If we just got a new toplevel and it is a workbench, * and we have not yet created our addins, do so now. */ toplevel = gtk_widget_get_ancestor (widget, IDE_TYPE_WORKBENCH); if (toplevel != NULL) { self->addins = peas_extension_set_new (peas_engine_get_default (), IDE_TYPE_EDITOR_ADDIN, NULL); g_signal_connect (self->addins, "extension-added", G_CALLBACK (ide_editor_perspective_addin_added), self); g_signal_connect (self->addins, "extension-removed", G_CALLBACK (ide_editor_perspective_addin_removed), self); peas_extension_set_foreach (self->addins, ide_editor_perspective_addin_added, self); } } }
static void ide_editor_perspective_notify_current_view (IdeEditorPerspective *self, GParamSpec *pspec, IdeLayoutGrid *grid) { IdeLayoutView *view; g_assert (IDE_IS_EDITOR_PERSPECTIVE (self)); g_assert (pspec != NULL); g_assert (IDE_IS_LAYOUT_GRID (grid)); view = ide_layout_grid_get_current_view (grid); if (IDE_IS_EDITOR_VIEW (view)) ide_editor_properties_set_view (self->properties, IDE_EDITOR_VIEW (view)); else ide_editor_properties_set_view (self->properties, NULL); peas_extension_set_foreach (self->addins, ide_editor_perspective_addins_view_set, view); }
static void gb_editor_view_constructed (GObject *object) { GbEditorView *self = (GbEditorView *)object; PeasEngine *engine; G_OBJECT_CLASS (gb_editor_view_parent_class)->constructed (object); engine = peas_engine_get_default (); self->extensions = peas_extension_set_new (engine, GB_TYPE_EDITOR_VIEW_ADDIN, NULL); g_signal_connect_object (self->extensions, "extension-added", G_CALLBACK (gb_editor_view__extension_added), self, G_CONNECT_SWAPPED); g_signal_connect_object (self->extensions, "extension-added", G_CALLBACK (gb_editor_view__extension_removed), self, G_CONNECT_SWAPPED); peas_extension_set_foreach (self->extensions, (PeasExtensionSetForeachFunc)gb_editor_view__extension_added, self); }
static void gedit_app_startup (GApplication *application) { GeditAppPrivate *priv; GtkCssProvider *css_provider; GtkSourceStyleSchemeManager *manager; const gchar *dir; gchar *icon_dir; #ifndef ENABLE_GVFS_METADATA const gchar *cache_dir; gchar *metadata_filename; #endif priv = gedit_app_get_instance_private (GEDIT_APP (application)); G_APPLICATION_CLASS (gedit_app_parent_class)->startup (application); /* Setup debugging */ gedit_debug_init (); gedit_debug_message (DEBUG_APP, "Startup"); gedit_debug_message (DEBUG_APP, "Set icon"); dir = gedit_dirs_get_gedit_data_dir (); icon_dir = g_build_filename (dir, "icons", NULL); gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), icon_dir); g_free (icon_dir); setup_theme_extensions (GEDIT_APP (application)); #ifndef ENABLE_GVFS_METADATA cache_dir = gedit_dirs_get_user_cache_dir (); metadata_filename = g_build_filename (cache_dir, "gedit-metadata.xml", NULL); gedit_metadata_manager_init (metadata_filename); g_free (metadata_filename); #endif /* Load settings */ priv->settings = gedit_settings_new (); priv->ui_settings = g_settings_new ("org.gnome.gedit.preferences.ui"); priv->window_settings = g_settings_new ("org.gnome.gedit.state.window"); /* initial lockdown state */ priv->lockdown = gedit_settings_get_lockdown (GEDIT_SETTINGS (priv->settings)); g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application); /* menus */ priv->window_menu = gtk_application_get_menubar (GTK_APPLICATION (application)); if (priv->window_menu == NULL) { priv->window_menu = get_menu_model (GEDIT_APP (application), "gear-menu"); } else { g_object_ref (priv->window_menu); } priv->notebook_menu = get_menu_model (GEDIT_APP (application), "notebook-menu"); priv->tab_width_menu = get_menu_model (GEDIT_APP (application), "tab-width-menu"); priv->line_col_menu = get_menu_model (GEDIT_APP (application), "line-col-menu"); /* Accelerators */ add_accelerator (GTK_APPLICATION (application), "app.new-window", "<Primary>N"); add_accelerator (GTK_APPLICATION (application), "app.quit", "<Primary>Q"); add_accelerator (GTK_APPLICATION (application), "app.help", "F1"); add_accelerator (GTK_APPLICATION (application), "win.gear-menu", "F10"); add_accelerator (GTK_APPLICATION (application), "win.open", "<Primary>O"); add_accelerator (GTK_APPLICATION (application), "win.save", "<Primary>S"); add_accelerator (GTK_APPLICATION (application), "win.save-as", "<Primary><Shift>S"); add_accelerator (GTK_APPLICATION (application), "win.save-all", "<Primary><Shift>L"); add_accelerator (GTK_APPLICATION (application), "win.new-tab", "<Primary>T"); add_accelerator (GTK_APPLICATION (application), "win.reopen-closed-tab", "<Primary><Shift>T"); add_accelerator (GTK_APPLICATION (application), "win.close", "<Primary>W"); add_accelerator (GTK_APPLICATION (application), "win.close-all", "<Primary><Shift>W"); add_accelerator (GTK_APPLICATION (application), "win.print", "<Primary>P"); add_accelerator (GTK_APPLICATION (application), "win.find", "<Primary>F"); add_accelerator (GTK_APPLICATION (application), "win.find-next", "<Primary>G"); add_accelerator (GTK_APPLICATION (application), "win.find-prev", "<Primary><Shift>G"); add_accelerator (GTK_APPLICATION (application), "win.replace", "<Primary>H"); add_accelerator (GTK_APPLICATION (application), "win.clear-highlight", "<Primary><Shift>K"); add_accelerator (GTK_APPLICATION (application), "win.goto-line", "<Primary>I"); add_accelerator (GTK_APPLICATION (application), "win.focus-active-view", "Escape"); add_accelerator (GTK_APPLICATION (application), "win.side-panel", "F9"); add_accelerator (GTK_APPLICATION (application), "win.bottom-panel", "<Primary>F9"); add_accelerator (GTK_APPLICATION (application), "win.fullscreen", "F11"); add_accelerator (GTK_APPLICATION (application), "win.new-tab-group", "<Primary><Alt>N"); add_accelerator (GTK_APPLICATION (application), "win.previous-tab-group", "<Primary><Shift><Alt>Page_Up"); add_accelerator (GTK_APPLICATION (application), "win.next-tab-group", "<Primary><Shift><Alt>Page_Down"); add_accelerator (GTK_APPLICATION (application), "win.previous-document", "<Primary><Alt>Page_Up"); add_accelerator (GTK_APPLICATION (application), "win.next-document", "<Primary><Alt>Page_Down"); load_accels (); /* Load custom css */ g_object_unref (load_css_from_resource ("gedit-style.css", TRUE)); css_provider = load_css_from_resource ("gedit-style-os.css", FALSE); g_clear_object (&css_provider); /* * We use the default gtksourceview style scheme manager so that plugins * can obtain it easily without a gedit specific api, but we need to * add our search path at startup before the manager is actually used. */ manager = gtk_source_style_scheme_manager_get_default (); gtk_source_style_scheme_manager_append_search_path (manager, gedit_dirs_get_user_styles_dir ()); priv->engine = gedit_plugins_engine_get_default (); priv->extensions = peas_extension_set_new (PEAS_ENGINE (priv->engine), GEDIT_TYPE_APP_ACTIVATABLE, "app", GEDIT_APP (application), NULL); g_signal_connect (priv->extensions, "extension-added", G_CALLBACK (extension_added), application); g_signal_connect (priv->extensions, "extension-removed", G_CALLBACK (extension_removed), application); peas_extension_set_foreach (priv->extensions, (PeasExtensionSetForeachFunc) extension_added, application); }
static void pragha_application_startup (GApplication *application) { PraghaApplication *pragha = PRAGHA_APPLICATION (application); PraghaToolbar *toolbar; PraghaPlaylist *playlist; const GBindingFlags binding_flags = G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL; G_APPLICATION_CLASS (pragha_application_parent_class)->startup (application); /* Allocate memory for simple structures */ pragha->preferences = pragha_preferences_get(); pragha->cdbase = pragha_database_get(); if (pragha_database_start_successfully(pragha->cdbase) == FALSE) { g_error("Unable to init music dbase"); } pragha->enum_map = pragha_music_enum_get (); g_signal_connect (pragha->enum_map, "enum-removed", G_CALLBACK(pragha_enum_map_removed_handler), pragha); #ifdef HAVE_LIBPEAS pragha->peas_engine = peas_engine_get_default (); peas_engine_add_search_path (pragha->peas_engine, LIBPLUGINDIR, USRPLUGINDIR); pragha->peas_exten_set = peas_extension_set_new (pragha->peas_engine, PEAS_TYPE_ACTIVATABLE, "object", pragha, NULL); peas_extension_set_foreach (pragha->peas_exten_set, (PeasExtensionSetForeachFunc) on_extension_added, NULL); g_signal_connect (pragha->peas_exten_set, "extension-added", G_CALLBACK (on_extension_added), NULL); g_signal_connect (pragha->peas_exten_set, "extension-removed", G_CALLBACK (on_extension_removed), NULL); #endif pragha->art_cache = pragha_art_cache_get (); g_signal_connect (pragha->art_cache, "cache-changed", G_CALLBACK(pragha_art_cache_changed_handler), pragha); pragha->backend = pragha_backend_new (); g_signal_connect (pragha->backend, "finished", G_CALLBACK(pragha_backend_finished_song), pragha); g_signal_connect (pragha->backend, "tags-changed", G_CALLBACK(pragha_backend_tags_changed), pragha); g_signal_connect (pragha->backend, "error", G_CALLBACK(gui_backend_error_show_dialog_cb), pragha); g_signal_connect (pragha->backend, "error", G_CALLBACK(gui_backend_error_update_current_playlist_cb), pragha); g_signal_connect (pragha->backend, "notify::state", G_CALLBACK (pragha_menubar_update_playback_state_cb), pragha); /* * Collect widgets and construct the window. */ pragha_application_construct_window (pragha); /* Connect Signals and Bindings. */ toolbar = pragha->toolbar; g_signal_connect_swapped (toolbar, "prev", G_CALLBACK(pragha_playback_prev_track), pragha); g_signal_connect_swapped (toolbar, "play", G_CALLBACK(pragha_playback_play_pause_resume), pragha); g_signal_connect_swapped (toolbar, "stop", G_CALLBACK(pragha_playback_stop), pragha); g_signal_connect_swapped (toolbar, "next", G_CALLBACK(pragha_playback_next_track), pragha); g_signal_connect (toolbar, "unfull-activated", G_CALLBACK(pragha_window_unfullscreen), pragha); g_signal_connect (toolbar, "album-art-activated", G_CALLBACK(pragha_playback_show_current_album_art), pragha); g_signal_connect (toolbar, "track-info-activated", G_CALLBACK(pragha_playback_edit_current_track), pragha); g_signal_connect (toolbar, "track-progress-activated", G_CALLBACK(pragha_playback_seek_fraction), pragha); playlist = pragha->playlist; g_signal_connect (playlist, "playlist-set-track", G_CALLBACK(pragha_playback_set_playlist_track), pragha); g_signal_connect (playlist, "playlist-change-tags", G_CALLBACK(pragha_playlist_update_change_tags), pragha); g_signal_connect (playlist, "playlist-changed", G_CALLBACK(pragha_playlist_update_statusbar_playtime), pragha); pragha_playlist_update_statusbar_playtime (playlist, pragha); g_signal_connect (pragha->library, "library-append-playlist", G_CALLBACK(pragha_library_pane_append_tracks), pragha); g_signal_connect (pragha->library, "library-replace-playlist", G_CALLBACK(pragha_library_pane_replace_tracks), pragha); g_signal_connect (pragha->library, "library-replace-playlist-and-play", G_CALLBACK(pragha_library_pane_replace_tracks_and_play), pragha); g_signal_connect (G_OBJECT(pragha->mainwindow), "window-state-event", G_CALLBACK(pragha_toolbar_window_state_event), toolbar); g_signal_connect (G_OBJECT(toolbar), "notify::timer-remaining-mode", G_CALLBACK(pragha_toolbar_show_ramaning_time_cb), pragha->backend); g_signal_connect (pragha->backend, "notify::state", G_CALLBACK(pragha_toolbar_playback_state_cb), toolbar); g_signal_connect (pragha->backend, "tick", G_CALLBACK(pragha_toolbar_update_playback_progress), toolbar); g_signal_connect (pragha->backend, "buffering", G_CALLBACK(pragha_toolbar_update_buffering_cb), toolbar); g_signal_connect (pragha->backend, "notify::state", G_CALLBACK (update_current_playlist_view_playback_state_cb), pragha->playlist); g_object_bind_property (pragha->backend, "volume", toolbar, "volume", binding_flags); g_object_bind_property (pragha->preferences, "timer-remaining-mode", toolbar, "timer-remaining-mode", binding_flags); pragha->sidebar2_binding = g_object_bind_property (pragha->preferences, "secondary-lateral-panel", pragha->sidebar2, "visible", binding_flags); pragha->setting_dialog = pragha_preferences_dialog_new (pragha); #ifdef HAVE_LIBPEAS pragha_plugins_activate_saved (pragha); #endif /* Finally fill the library and the playlist */ pragha_init_gui_state (pragha); }
void ide_workbench_set_visible_perspective (IdeWorkbench *self, IdePerspective *perspective) { g_autofree gchar *id = NULL; GActionGroup *actions = NULL; const gchar *current_id; GtkWidget *titlebar; guint restore_duration = 0; g_return_if_fail (IDE_IS_WORKBENCH (self)); g_return_if_fail (IDE_IS_PERSPECTIVE (perspective)); /* * If we can detect that this is the first transition to the editor, * and that our window is not yet displayed, we can avoid the transition * duration altogether. This is handy when first opening a window with * a project loaded, as used by self->disable_greeter. */ if (self->disable_greeter && IDE_IS_EDITOR_PERSPECTIVE (perspective) && !self->did_initial_editor_transition) { self->did_initial_editor_transition = TRUE; restore_duration = gtk_stack_get_transition_duration (self->perspectives_stack); gtk_stack_set_transition_duration (self->perspectives_stack, 0); } current_id = gtk_stack_get_visible_child_name (self->perspectives_stack); id = ide_perspective_get_id (perspective); if (!ide_str_equal0 (current_id, id)) gtk_stack_set_visible_child_name (self->perspectives_stack, id); titlebar = gtk_stack_get_child_by_name (self->header_stack, id); if (titlebar != NULL) gtk_stack_set_visible_child (self->header_stack, titlebar); else gtk_stack_set_visible_child (self->header_stack, GTK_WIDGET (self->header_bar)); actions = ide_perspective_get_actions (perspective); gtk_widget_insert_action_group (GTK_WIDGET (self), "perspective", actions); /* * If we are transitioning to the editor the first time, we can * remove the early perspectives (greeter, etc). */ if (IDE_IS_EDITOR_PERSPECTIVE (perspective)) remove_early_perspectives (self); gtk_widget_set_visible (GTK_WIDGET (self->perspective_menu_button), !ide_perspective_is_early (perspective)); if (self->addins != NULL) peas_extension_set_foreach (self->addins, ide_workbench_notify_perspective_set, perspective); g_clear_object (&actions); if (restore_duration != 0) gtk_stack_set_transition_duration (self->perspectives_stack, restore_duration); /* Notify the application to possibly update actions such * as the preferences state. */ ide_application_actions_update (IDE_APPLICATION_DEFAULT); }
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; }
void liferea_auth_info_query (const gchar *authId) { peas_extension_set_foreach (liferea_auth_get_extension_set (), liferea_auth_info_query_foreach, (gpointer)authId); }
void liferea_auth_info_store (gpointer user_data) { peas_extension_set_foreach (liferea_auth_get_extension_set (), liferea_auth_info_store_foreach, user_data); }