示例#1
0
文件: editor.c 项目: ueno/c-smie
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);
    }
}
示例#2
0
/**
 * gedit_document_set_location:
 * @doc: a #GeditDocument.
 * @location: the new location.
 *
 * Deprecated: 3.14: use gtk_source_file_set_location() instead.
 */
void
gedit_document_set_location (GeditDocument *doc,
			     GFile         *location)
{
	g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
	g_return_if_fail (G_IS_FILE (location));

	gtk_source_file_set_location (doc->priv->file, location);
	gedit_document_set_content_type (doc, NULL);
}
示例#3
0
/**
 * gedit_document_set_location:
 * @doc: a #GeditDocument.
 * @location: the new location.
 *
 * Deprecated: 3.14: use gtk_source_file_set_location() instead.
 */
void
gedit_document_set_location (GeditDocument *doc,
			     GFile         *location)
{
	GeditDocumentPrivate *priv;

	g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
	g_return_if_fail (G_IS_FILE (location));

	priv = gedit_document_get_instance_private (doc);

	gtk_source_file_set_location (priv->file, location);
	set_content_type (doc, NULL);
}
示例#4
0
/**
 * _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;
}
示例#5
0
static void
gtk_source_file_set_property (GObject      *object,
			      guint         prop_id,
			      const GValue *value,
			      GParamSpec   *pspec)
{
	GtkSourceFile *file;

	g_return_if_fail (GTK_SOURCE_IS_FILE (object));

	file = GTK_SOURCE_FILE (object);

	switch (prop_id)
	{
		case PROP_LOCATION:
			gtk_source_file_set_location (file, g_value_get_object (value));
			break;

		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
			break;
	}
}