static void gedit_document_finalize (GObject *object) { GeditDocument *doc = GEDIT_DOCUMENT (object); gedit_debug (DEBUG_DOCUMENT); if (doc->priv->untitled_number > 0) { release_untitled_number (doc->priv->untitled_number); } g_free (doc->priv->content_type); g_free (doc->priv->short_name); G_OBJECT_CLASS (gedit_document_parent_class)->finalize (object); }
static void gedit_document_finalize (GObject *object) { GeditDocumentPrivate *priv; gedit_debug (DEBUG_DOCUMENT); priv = gedit_document_get_instance_private (GEDIT_DOCUMENT (object)); if (priv->untitled_number > 0) { release_untitled_number (priv->untitled_number); } g_free (priv->content_type); g_free (priv->short_name); G_OBJECT_CLASS (gedit_document_parent_class)->finalize (object); }
static void on_location_changed (GtkSourceFile *file, GParamSpec *pspec, GeditDocument *doc) { GeditDocumentPrivate *priv; GFile *location; gedit_debug (DEBUG_DOCUMENT); priv = gedit_document_get_instance_private (doc); location = gtk_source_file_get_location (file); if (location != NULL && priv->untitled_number > 0) { release_untitled_number (priv->untitled_number); priv->untitled_number = 0; } if (priv->short_name == NULL) { g_object_notify (G_OBJECT (doc), "shortname"); } /* Load metadata for this location: we load sync since metadata is * always local so it should be fast and we need the information * right after the location was set. */ if (priv->use_gvfs_metadata && location != NULL) { GError *error = NULL; if (priv->metadata_info != NULL) { g_object_unref (priv->metadata_info); } priv->metadata_info = g_file_query_info (location, METADATA_QUERY, G_FILE_QUERY_INFO_NONE, NULL, &error); if (error != NULL) { /* Do not complain about metadata if we are opening a * non existing file. */ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_ISDIR) && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOTDIR) && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { g_warning ("%s", error->message); } g_error_free (error); } } }
static void on_location_changed (GtkSourceFile *file, GParamSpec *pspec, GeditDocument *doc) { GFile *location; gedit_debug (DEBUG_DOCUMENT); location = gtk_source_file_get_location (file); if (location != NULL && doc->priv->untitled_number > 0) { release_untitled_number (doc->priv->untitled_number); doc->priv->untitled_number = 0; } if (doc->priv->short_name == NULL) { g_object_notify (G_OBJECT (doc), "shortname"); } #ifdef ENABLE_GVFS_METADATA /* load metadata for this location: we load sync since metadata is * always local so it should be fast and we need the information * right after the location was set. */ if (location != NULL) { GError *error = NULL; if (doc->priv->metadata_info != NULL) { g_object_unref (doc->priv->metadata_info); } doc->priv->metadata_info = g_file_query_info (location, METADATA_QUERY, G_FILE_QUERY_INFO_NONE, NULL, &error); if (error != NULL) { /* TODO document why the warning is not displayed in * certain cases. */ if (error->domain != G_FILE_ERROR || (error->code != G_FILE_ERROR_ISDIR && error->code != G_FILE_ERROR_NOTDIR && error->code != G_FILE_ERROR_NOENT)) { g_warning ("%s", error->message); } g_error_free (error); } } #endif }