static void editor_application_open (GApplication *application, GFile **files, gint n_files, const gchar *hint) { gint i; for (i = 0; i < n_files; i++) { EditorApplicationWindow *window; GFile *location = files[i]; GtkSourceFileLoader *loader; window = g_object_new (EDITOR_TYPE_APPLICATION_WINDOW, "application", application, NULL); g_clear_object (&window->file); window->file = gtk_source_file_new (); gtk_source_file_set_location (window->file, location); loader = gtk_source_file_loader_new (window->buffer, window->file); remove_all_marks (window->buffer); gtk_source_file_loader_load_async (loader, G_PRIORITY_DEFAULT, NULL, NULL, NULL, NULL, (GAsyncReadyCallback) load_ready, window); } }
static void gedit_document_init (GeditDocument *doc) { GeditDocumentPrivate *priv; GtkSourceStyleScheme *style_scheme; gedit_debug (DEBUG_DOCUMENT); doc->priv = gedit_document_get_instance_private (doc); priv = doc->priv; priv->editor_settings = g_settings_new ("org.gnome.gedit.preferences.editor"); priv->untitled_number = get_untitled_number (); priv->content_type = get_default_content_type (); priv->readonly = FALSE; priv->language_set_by_user = FALSE; priv->empty_search = TRUE; g_get_current_time (&doc->priv->time_of_last_save_or_load); priv->file = gtk_source_file_new (); g_signal_connect_object (priv->file, "notify::location", G_CALLBACK (on_location_changed), doc, 0); g_settings_bind (priv->editor_settings, GEDIT_SETTINGS_MAX_UNDO_ACTIONS, doc, "max-undo-levels", G_SETTINGS_BIND_GET); g_settings_bind (priv->editor_settings, GEDIT_SETTINGS_BRACKET_MATCHING, doc, "highlight-matching-brackets", G_SETTINGS_BIND_GET); style_scheme = get_default_style_scheme (priv->editor_settings); if (style_scheme != NULL) { gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (doc), style_scheme); } g_signal_connect (doc, "notify::content-type", G_CALLBACK (on_content_type_changed), NULL); }
/** * _ide_file_get_source_file: * @self: (in): A #IdeFile. * * Gets the GtkSourceFile for the #IdeFile. * * Returns: (transfer none): A #GtkSourceFile. */ GtkSourceFile * _ide_file_get_source_file (IdeFile *self) { g_return_val_if_fail (IDE_IS_FILE (self), NULL); if (g_once_init_enter (&self->source_file)) { GtkSourceFile *source_file; source_file = gtk_source_file_new (); gtk_source_file_set_location (source_file, self->file); g_once_init_leave (&self->source_file, source_file); } return self->source_file; }