static void directory_load_callback (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, GList *list, guint entries_read, gpointer callback_data) { CallbackData *data; GnomeVFSFileInfo *info; GnomeVFSURI *parent_uri; GnomeVFSURI *uri; GList *node; guint i; data = (CallbackData *)callback_data; if (!measure_speed) { printf ("Directory load callback: %s, %d entries, callback_data `%s'\n", gnome_vfs_result_to_string (result), entries_read, (gchar *) data->parent_uri); } parent_uri = gnome_vfs_uri_new (data->parent_uri); for (i = 0, node = list; i < entries_read && node != NULL; i++, node = node->next) { info = node->data; if (!measure_speed) { printf (" File `%s'%s (%s, %s), " "size %"GNOME_VFS_SIZE_FORMAT_STR", mode %04o\n", info->name, (info->flags & GNOME_VFS_FILE_FLAGS_SYMLINK) ? " [link]" : "", type_to_string (info->type), gnome_vfs_file_info_get_mime_type (info), info->size, info->permissions); fflush (stdout); } if (read_files) { if ((info->type & GNOME_VFS_FILE_TYPE_REGULAR) != 0) { uri = gnome_vfs_uri_append_file_name (parent_uri, info->name); test_read_file_async (uri); gnome_vfs_uri_unref (uri); } if (!measure_speed) { printf ("reading a bit of %s\n", info->name); } } } data->num_entries_read += entries_read; gnome_vfs_uri_unref (parent_uri); if (result != GNOME_VFS_OK) { if (--async_task_counter == 0) { g_main_loop_quit (main_loop); } } }
static void gst_gnome_vfs_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstGnomeVFSSrc *src; src = GST_GNOME_VFS_SRC (object); switch (prop_id) { case ARG_LOCATION:{ const gchar *new_location; /* the element must be stopped or paused in order to do this */ if (GST_STATE (src) == GST_STATE_PLAYING || GST_STATE (src) == GST_STATE_PAUSED) break; if (src->uri) { gnome_vfs_uri_unref (src->uri); src->uri = NULL; } if (src->uri_name) { g_free (src->uri_name); src->uri_name = NULL; } new_location = g_value_get_string (value); if (new_location) { src->uri_name = gst_gnome_vfs_location_to_uri_string (new_location); src->uri = gnome_vfs_uri_new (src->uri_name); } break; } case ARG_HANDLE: if (GST_STATE (src) == GST_STATE_NULL || GST_STATE (src) == GST_STATE_READY) { if (src->uri) { gnome_vfs_uri_unref (src->uri); src->uri = NULL; } if (src->uri_name) { g_free (src->uri_name); src->uri_name = NULL; } src->handle = g_value_get_boxed (value); } break; case ARG_IRADIO_MODE: src->iradio_mode = g_value_get_boolean (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static gboolean setup_directory_structure (const gchar *theme_name, GError **error) { gchar *dir, *theme_name_dir; GnomeVFSURI *uri; gboolean retval = TRUE; theme_name_dir = str_remove_slash (theme_name); dir = g_build_filename (g_get_home_dir (), ".themes", NULL); uri = gnome_vfs_uri_new (dir); if (!gnome_vfs_uri_exists (uri)) gnome_vfs_make_directory_for_uri (uri, 0775); gnome_vfs_uri_unref (uri); g_free (dir); dir = g_build_filename (g_get_home_dir (), ".themes", theme_name_dir, NULL); uri = gnome_vfs_uri_new (dir); if (!gnome_vfs_uri_exists (uri)) gnome_vfs_make_directory_for_uri (uri, 0775); gnome_vfs_uri_unref (uri); g_free (dir); dir = g_build_filename (g_get_home_dir (), ".themes", theme_name_dir, "index.theme", NULL); g_free (theme_name_dir); uri = gnome_vfs_uri_new (dir); g_free (dir); if (gnome_vfs_uri_exists (uri)) { GtkDialog *dialog; GtkWidget *button; gint response; dialog = (GtkDialog *) gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, _("The theme already exists. Would you like to replace it?")); button = gtk_dialog_add_button (dialog, _("_Overwrite"), GTK_RESPONSE_ACCEPT); gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_BUTTON)); response = gtk_dialog_run (dialog); gtk_widget_destroy (GTK_WIDGET (dialog)); retval = (response != GTK_RESPONSE_CANCEL); } gnome_vfs_uri_unref (uri); return retval; }
static gboolean _downloadmanager_begin_download(download_t* pDownload) { GList *pSrcList = NULL, *pDestList = NULL; g_assert(pDownload != NULL); //g_print("downloader: beginning download of %s\n", pDownload->pszRemoteFilePath); g_assert(pDownload->pszLocalFilePath == NULL); gint nHandle = g_file_open_tmp(TEMP_FILE_TEMPLATE, &(pDownload->pszLocalFilePath), NULL); if(nHandle == -1) { g_warning("downloader: failed to create a temporary file\n"); return FALSE; } g_assert(pDownload->pszLocalFilePath != NULL); close(nHandle); // we don't use the file here. gnome-vfs overwrites it. //g_print("downloader: using temp file '%s'\n", pDownload->pszLocalFilePath); GnomeVFSURI* pSrcURI = gnome_vfs_uri_new(pDownload->pszRemoteFilePath); pSrcList = g_list_prepend(pSrcList, pSrcURI); GnomeVFSURI* pDestURI = gnome_vfs_uri_new(pDownload->pszLocalFilePath); pDestList = g_list_prepend(pDestList, pDestURI); GnomeVFSResult res = gnome_vfs_async_xfer(&(pDownload->pGnomeVFSHandle), pSrcList, pDestList, GNOME_VFS_XFER_DEFAULT, GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, // overwrite the tmp file we just made. GNOME_VFS_PRIORITY_MIN, (GnomeVFSAsyncXferProgressCallback)_downloadmanager_gnome_vfs_progress_callback, (gpointer)pDownload, // callback userdata NULL, NULL); gnome_vfs_uri_unref(pSrcURI); gnome_vfs_uri_unref(pDestURI); g_list_free(pSrcList); g_list_free(pDestList); if(res != GNOME_VFS_OK) { // return the download_t to a 'pending' state g_free(pDownload->pszLocalFilePath); pDownload->pszLocalFilePath = NULL; g_assert(pDownload->pGnomeVFSHandle == NULL); return FALSE; } g_assert(pDownload->pGnomeVFSHandle != NULL); return TRUE; }
/** * gnome_vfs_async_create: * @handle_return: pointer to a pointer to a #GnomeVFSHandle object. * @text_uri: string representing the uri to create. * @open_mode: mode to leave the file opened in after creation (or %GNOME_VFS_OPEN_MODE_NONE * to leave the file closed after creation). * @exclusive: whether the file should be created in "exclusive" mode: * i.e. if this flag is nonzero, operation will fail if a file with the * same name already exists. * @perm: bitmap representing the permissions for the newly created file * (Unix style). * @priority: a value from %GNOME_VFS_PRIORITY_MIN to %GNOME_VFS_PRIORITY_MAX (normally * should be %GNOME_VFS_PRIORITY_DEFAULT) indicating the priority to assign this job * in allocating threads from the thread pool. * @callback: function to be called when the operation is complete. * @callback_data: data to pass to @callback. * * Create a file at @uri according to mode @open_mode, with permissions @perm (in * the standard UNIX packed bit permissions format). When the create has been completed * @callback will be called with the result code and @callback_data. */ void gnome_vfs_async_create (GnomeVFSAsyncHandle **handle_return, const gchar *text_uri, GnomeVFSOpenMode open_mode, gboolean exclusive, guint perm, int priority, GnomeVFSAsyncOpenCallback callback, gpointer callback_data) { GnomeVFSURI *uri; g_return_if_fail (handle_return != NULL); g_return_if_fail (text_uri != NULL); g_return_if_fail (callback != NULL); g_return_if_fail (priority >= GNOME_VFS_PRIORITY_MIN); g_return_if_fail (priority <= GNOME_VFS_PRIORITY_MAX); uri = gnome_vfs_uri_new (text_uri); *handle_return = async_create (uri, open_mode, exclusive, perm, priority, callback, callback_data); if (uri != NULL) { gnome_vfs_uri_unref (uri); } }
void lister_view_from_tree_view (GtkTreeView *tree_view) { GtkTreePath *path = NULL; GtkTreeIter iter; GfmRowData *row_data = NULL; GnomeVFSURI *uri = NULL; GtkTreeModel *model; g_return_if_fail (tree_view != NULL); gtk_tree_view_get_cursor (tree_view, &path, NULL); model = gtk_tree_view_get_model (tree_view); if (!model) goto done; if (!gtk_tree_model_get_iter (model, &iter, path)) goto done; gtk_tree_model_get (model, &iter, GFM_COLUMN_DATA, &row_data, -1); if (!row_data) goto done; uri = gnome_vfs_uri_append_file_name (panels_data[get_panel_id(tree_view)].uri_wdir, row_data->info->name); if (!uri) goto done; lister_view_uri (uri, row_data->info->mime_type); done: if (path) gtk_tree_path_free (path); if (row_data) gfm_row_data_free (row_data); if (uri) gnome_vfs_uri_unref (uri); }
static CongDependencyNode *make_cong_node_from_website_content(WebsiteContent *content, GenerateWebsiteWorkspace *workspace) { CongDependencyNodeTransformWebsiteContent *new_node; CongDependencyNode *src_file; GnomeVFSURI *dst_uri; GnomeVFSURI *src_uri; g_assert(content); g_assert(workspace); g_message("making CongDependencyNode for %s", content->src_page); dst_uri = content_make_dst_uri(content, workspace); src_uri = content_make_src_uri(content, workspace); new_node = g_new0(CongDependencyNodeTransformWebsiteContent,1); construct_dependency_node_from_file(CONG_DEPENDENCY_NODE_FROM_FILE(new_node), &klass_transform_website_content, dst_uri); new_node->workspace = workspace; new_node->src_uri = src_uri; src_file = cong_dependency_node_new_from_file(src_uri); cong_dependency_node_add_dependency(CONG_DEPENDENCY_NODE(new_node), src_file); /* FIXME: should add dependency on the XSL file as well, really */ /* FIXME: should add dependency on the autolayout.xml file too */ gnome_vfs_uri_unref(dst_uri); return CONG_DEPENDENCY_NODE(new_node); }
/** * gnome_vfs_async_load_directory: * @handle_return: when the function returns, will point to a handle for * the async operation. * @text_uri: string representing the uri of the directory to be loaded. * @options: packed boolean type providing control over various details * of the get_file_info operation. * @items_per_notification: number of files to process in a row before calling @callback * @priority: a value from %GNOME_VFS_PRIORITY_MIN to %GNOME_VFS_PRIORITY_MAX (normally * should be %GNOME_VFS_PRIORITY_DEFAULT) indicating the priority to assign to this job * in allocating threads from the thread pool. * @callback: function to be called when the operation is complete. * @callback_data: data to pass to @callback. * * Read the contents of the directory at @text_uri, passing back #GnomeVFSFileInfo * structs about each file in the directory to @callback. @items_per_notification * files will be processed between each call to @callback. */ void gnome_vfs_async_load_directory (GnomeVFSAsyncHandle **handle_return, const gchar *text_uri, GnomeVFSFileInfoOptions options, guint items_per_notification, int priority, GnomeVFSAsyncDirectoryLoadCallback callback, gpointer callback_data) { GnomeVFSURI *uri; g_return_if_fail (handle_return != NULL); g_return_if_fail (text_uri != NULL); g_return_if_fail (callback != NULL); g_return_if_fail (priority >= GNOME_VFS_PRIORITY_MIN); g_return_if_fail (priority <= GNOME_VFS_PRIORITY_MAX); uri = gnome_vfs_uri_new (text_uri); *handle_return = async_load_directory (uri, options, items_per_notification, priority, callback, callback_data); if (uri != NULL) { gnome_vfs_uri_unref (uri); } }
// Pulling nearly all of gnomevfs just to copy a file. *sigh*. static GnomeVFSResult copy_file(const char * source_uri, const char * dest_uri) { GnomeVFSURI* src = gnome_vfs_uri_new(source_uri); GnomeVFSURI* dst = gnome_vfs_uri_new(dest_uri); GnomeVFSResult res; res = gnome_vfs_xfer_uri(src, dst, GNOME_VFS_XFER_TARGET_DEFAULT_PERMS, GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, NULL, NULL); gnome_vfs_uri_unref(src); gnome_vfs_uri_unref(dst); return res; }
/** * gnome_vfs_find_directory_result_free: * @result: a #GnomeVFSFindDirectoryResult. * * Unrefs the inner uri object and frees the memory * allocated for @result. * * Since: 2.12 */ void gnome_vfs_find_directory_result_free (GnomeVFSFindDirectoryResult* result) { g_return_if_fail (result != NULL); gnome_vfs_uri_unref (result->uri); result->uri = NULL; g_free (result); }
static GnomeVFSResult finish_operation (const OperationSettings *settings, GnomeVFSResult result, GnomeVFSURI **uri, GnomeVFSURI **saved_uri) { if (uri != NULL) { gnome_vfs_uri_unref (*uri); *uri = *saved_uri; } if (settings->override_result) { return settings->overridden_result_value; } return result; }
static GnomeVFSResult do_monitor_cancel (GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle) { GnomeVFSURI *uri; uri = (GnomeVFSURI *) method_handle; //G_LOCK (monitor_list); monitor_list = g_list_remove (monitor_list, uri); //G_UNLOCK (monitor_list); gnome_vfs_uri_unref (uri); return GNOME_VFS_OK; }
static GObject * panel_ditem_editor_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { GObject *obj; PanelDItemEditor *dialog; GnomeVFSURI *vfs_uri; gboolean loaded; obj = G_OBJECT_CLASS (panel_ditem_editor_parent_class)->constructor (type, n_construct_properties, construct_properties); dialog = PANEL_DITEM_EDITOR (obj); if (dialog->priv->key_file) { panel_ditem_editor_key_file_loaded (dialog); dialog->priv->new_file = FALSE; dialog->priv->free_key_file = FALSE; loaded = TRUE; } else { dialog->priv->key_file = panel_util_key_file_new_desktop (); dialog->priv->free_key_file = TRUE; loaded = FALSE; } if (!loaded && dialog->priv->uri) { vfs_uri = gnome_vfs_uri_new (dialog->priv->uri); if (gnome_vfs_uri_exists (vfs_uri)) { //FIXME what if there's an error? panel_ditem_editor_load_uri (dialog, NULL); dialog->priv->new_file = FALSE; } else { dialog->priv->new_file = TRUE; } gnome_vfs_uri_unref (vfs_uri); } else { dialog->priv->new_file = !loaded; } dialog->priv->dirty = FALSE; panel_ditem_editor_setup_ui (dialog); return obj; }
char * mn_vfs_uri_extract_short_name (const char *text_uri) { GnomeVFSURI *uri; char *name; g_return_val_if_fail(text_uri != NULL, NULL); uri = gnome_vfs_uri_new(text_uri); if (! uri) return NULL; name = gnome_vfs_uri_extract_short_name(uri); gnome_vfs_uri_unref(uri); return name; }
/** * file_exists_and_readable: * @filename: a #const gchar * with a file path * * tests if the file exists, and if it is readable, the last * check is not reliable, it does not check all the groups you are * in, so change this function before you rely on that check! * * this function is Gnome-VFS aware, so it will work on URI's * * Return value: gboolean, TRUE if readable, else FALSE **/ gboolean file_exists_and_readable(const gchar * filename) { gchar *ondiskencoding; /* not sure the purpose of returning true here by default so I changed it to false. */ /* gboolean retval=TRUE; */ gboolean retval = FALSE; #ifdef WIN32 if (strchr(filename,'/')==filename) filename++; #endif /* WIN32 */ #ifdef DEVELOPMENT g_assert(filename); #endif if (!filename || strlen(filename) < 2) { DEBUG_MSG("file_exists_and_readable, strlen(filename) < 2 or no filename!!!!\n"); return FALSE; } DEBUG_MSG("file_exists_and_readable, filename(%p)=\"%s\", strlen(filename)=%d\n", filename, filename, strlen(filename)); ondiskencoding = get_filename_on_disk_encoding(filename); DEBUG_MSG("file_exists_and_readable, ondiskencoding='%s'\n",ondiskencoding); #ifdef HAVE_GNOME_VFS { GnomeVFSURI* uri; uri = gnome_vfs_uri_new(ondiskencoding); retval = gnome_vfs_uri_exists(uri); DEBUG_MSG("gnome_vfs_uri has path %s\n",gnome_vfs_uri_get_path(uri)); gnome_vfs_uri_unref(uri); DEBUG_MSG("file_exists_and_readable, return %d for %s\n",retval,filename); } #else /* HAVE_GNOME_VFS */ { #ifdef WIN32 struct _stat naamstat; errno = 0; retval = ((_stat(ondiskencoding, &naamstat) == 0) && (errno == 0)); #else /* NOT WIN32 */ struct stat naamstat; errno = 0; retval = ((stat(ondiskencoding, &naamstat) == 0) && (errno == 0)); #endif DEBUG_MSG("file_exists_and_readable, retval=%d (ernno=%d) for\n %s\n",retval,errno,ondiskencoding); } #endif /* HAVE_GNOME_VFS */ g_free(ondiskencoding); return retval; }
static void gst_gnome_vfs_sink_finalize (GObject * obj) { GstGnomeVFSSink *sink = GST_GNOME_VFS_SINK (obj); if (sink->uri) { gnome_vfs_uri_unref (sink->uri); sink->uri = NULL; } if (sink->uri_name) { g_free (sink->uri_name); sink->uri_name = NULL; } G_OBJECT_CLASS (parent_class)->finalize (obj); }
void la_track_unref(LaTrack * self) { if (--self->refcount > 0) return; if (self->uri) g_free(self->uri); if (self->title) g_free(self->title); if (self->genre) g_free(self->genre); if (self->artist) g_free(self->artist); if (self->album) g_free(self->album); if (self->track) g_free(self->track); if (self->year) g_free(self->year); if (self->comment) g_free(self->comment); if (self->icon) g_free(self->icon); if (self->size_str) g_free(self->size_str); if (self->time_str) g_free(self->time_str); if (self->date_str) g_free(self->date_str); if (self->rating_str) g_free(self->rating_str); if (self->quality_str) g_free(self->quality_str); if (self->summary_str) g_free(self->summary_str); if (self->vfs_uri) gnome_vfs_uri_unref(self->vfs_uri); if (self->vfs_info) gnome_vfs_file_info_unref(self->vfs_info); g_free(self); }
gboolean launcher_application_validate(struct launcher *launcher, const char *text_uri) { GnomeVFSURI *uri; g_return_val_if_fail(launcher, FALSE); g_return_val_if_fail(launcher==&launcher_application, FALSE); g_return_val_if_fail(text_uri!=NULL, FALSE); uri=gnome_vfs_uri_new(text_uri); if(uri) { gboolean retval=gnome_vfs_uri_exists(uri); gnome_vfs_uri_unref(uri); return retval; } else { return FALSE; } }
int main(int argc, char **argv) { GdkPixbuf *pixbuf; GnomeThemeMetaInfo *theme; GnomeVFSURI *uri; g_thread_init (NULL); theme_thumbnail_factory_init (argc, argv); if (argc != 3) { g_printerr ("usage: gnome-theme-thumbnailer theme output-image\n"); return 1; } if (!gnome_vfs_init ()) { g_printerr ("could not initialise gnome-vfs\n"); return 1; } uri = gnome_vfs_uri_new (argv[1]); theme = gnome_theme_read_meta_theme (uri); gnome_vfs_uri_unref (uri); if (theme) { pixbuf = generate_meta_theme_thumbnail (theme); gnome_theme_meta_info_free (theme); if (pixbuf) { save_pixbuf (pixbuf, argv[2]); gdk_pixbuf_unref (pixbuf); } else { g_printerr ("could not generate thumbnail\n"); return 1; } } else { g_printerr ("usage: gnome-theme-thumbnailer theme output-image\n"); return 1; } return 0; }
static gchar * get_protocols (void) { static const gchar *protocols[] = { "http:", "https:", "ftp:", "sftp:", "ssh:", "smb:", "dav:", "davs:" }; GString *string = g_string_new (NULL); gint i; for (i = 0; i < G_N_ELEMENTS (protocols); i++) { gchar *uri; GnomeVFSURI *vfs_uri; uri = g_strdup_printf ("%s//foo/bar.xcf", protocols[i]); vfs_uri = gnome_vfs_uri_new (uri); if (vfs_uri) { if (string->len > 0) g_string_append_c (string, ','); g_string_append (string, protocols[i]); gnome_vfs_uri_unref (vfs_uri); } g_free (uri); } return g_string_free (string, FALSE); }
GnomeVFSResult _gnome_vfs_monitor_do_add (GnomeVFSMethod *method, GnomeVFSMonitorHandle **handle, GnomeVFSURI *uri, GnomeVFSMonitorType monitor_type, GnomeVFSMonitorCallback callback, gpointer user_data) { GnomeVFSResult result; GnomeVFSMonitorHandle *monitor_handle = g_new0(GnomeVFSMonitorHandle, 1); init_hash_table (); gnome_vfs_uri_ref (uri); monitor_handle->uri = uri; monitor_handle->type = monitor_type; monitor_handle->callback = callback; monitor_handle->user_data = user_data; monitor_handle->pending_callbacks = g_queue_new (); monitor_handle->min_send_at = 0; result = uri->method->monitor_add (uri->method, &monitor_handle->method_handle, uri, monitor_type); if (result != GNOME_VFS_OK) { gnome_vfs_uri_unref (uri); g_free (monitor_handle); monitor_handle = NULL; } else { G_LOCK (handle_hash); g_hash_table_insert (handle_hash, monitor_handle->method_handle, monitor_handle); G_UNLOCK (handle_hash); } *handle = monitor_handle; return result; }
/** * gnome_vfs_async_create_as_channel: * @handle_return: pointer to a pointer to a #GnomeVFSHandle object. * @text_uri: string of the uri to open as a #GIOChannel, creating it as necessary. * @open_mode: open mode i.e. for reading, writing, random, etc. * @exclusive: replace the file if it already exists. * @perm: standard POSIX-style permissions bitmask, permissions of created file. * @priority: a value from %GNOME_VFS_PRIORITY_MIN to %GNOME_VFS_PRIORITY_MAX (normally * should be %GNOME_VFS_PRIORITY_DEFAULT) indicating the priority to assign this job * in allocating threads from the thread pool. * @callback: function to be called when the operation is complete. * @callback_data: data to pass to @callback. * * Open @text_uri as a #GIOChannel, creating it as necessary. Once the channel has * been established @callback will be called with @callback_data, the result of the * operation, and if the result was %GNOME_VFS_OK, a reference to a #GIOChannel pointing * at @text_uri in @open_mode. * * This function has been deprecated due to behaving weirdly which suggests * that it hasn't been used. See bugs #157266, #157265, #157261, #138398 in * the GNOME Bugzilla. If the *_as_channel functions are needed they should be * fixed and undeprecated. */ void gnome_vfs_async_create_as_channel (GnomeVFSAsyncHandle **handle_return, const gchar *text_uri, GnomeVFSOpenMode open_mode, gboolean exclusive, guint perm, int priority, GnomeVFSAsyncOpenAsChannelCallback callback, gpointer callback_data) { GnomeVFSURI *uri; g_return_if_fail (text_uri != NULL); uri = gnome_vfs_uri_new (text_uri); gnome_vfs_async_create_uri_as_channel (handle_return, uri, open_mode, exclusive, perm, priority, callback, callback_data); if (uri != NULL) { gnome_vfs_uri_unref (uri); } }
void peacock_file_set_uri (PeacockFile *file, const gchar *uri) { const gchar *old_uri; g_return_if_fail (file != NULL); g_return_if_fail (PEACOCK_IS_FILE (file)); /* Save old uri to be passed to signal. */ old_uri = (file->priv->uri ? peacock_file_get_uri (file) : NULL); /* Free old URI */ if (file->priv->uri) gnome_vfs_uri_unref (file->priv->uri); file->priv->uri = gnome_vfs_uri_new (uri); /* Emit uri_changed signal. */ g_signal_emit (G_OBJECT (file), peacock_file_signals[URI_CHANGED], 0, old_uri); }
char * cache_get_nautilus_cache_name (const char *path) { char *parent; char *resolved_parent; char *resolved_path = NULL; GnomeVFSResult result; GnomeVFSURI *uri; char *uri_txt; char *retval; parent = remove_level_from_path (path); result = resolve_all_symlinks (parent, &resolved_parent); g_free (parent); if (result == GNOME_VFS_OK) resolved_path = g_strconcat (resolved_parent, "/", file_name_from_path (path), NULL); else resolved_path = g_strdup (path); uri = new_uri_from_path (resolved_path); g_free (resolved_path); g_free (resolved_parent); uri_txt = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); gnome_vfs_uri_unref (uri); if (uri_txt == NULL) return NULL; retval = gnome_thumbnail_path_for_uri (uri_txt, GNOME_THUMBNAIL_SIZE_NORMAL); g_free (uri_txt); return retval; }
/* Called with handle_hash lock held */ static void destroy_monitor_handle (GnomeVFSMonitorHandle *handle) { gboolean res; if (handle->pending_timeout) g_source_remove (handle->pending_timeout); g_queue_foreach (handle->pending_callbacks, (GFunc) free_callback_data, NULL); g_queue_free (handle->pending_callbacks); handle->pending_callbacks = NULL; res = g_hash_table_remove (handle_hash, handle->method_handle); if (!res) { g_warning ("gnome-vfs-monitor.c: A monitor handle was destroyed " "before it was added to the method hash table. This " "is a bug in the application and can cause crashes. " "It is probably a race-condition."); } gnome_vfs_uri_unref (handle->uri); g_free (handle); }
static GnomeVFSURI *content_make_dst_uri(WebsiteContent *content, GenerateWebsiteWorkspace *workspace) { const gchar *dst_dir; GnomeVFSURI *path_uri; GnomeVFSURI *result_uri; g_assert(content); g_assert(workspace); dst_dir = content_get_dir(content); if (dst_dir) { path_uri = gnome_vfs_uri_append_path(workspace->build_uri, dst_dir); } else { path_uri = workspace->build_uri; gnome_vfs_uri_ref(workspace->build_uri); } result_uri = gnome_vfs_uri_append_path(path_uri, content->dst_filename); gnome_vfs_uri_unref(path_uri); return result_uri; }
/** * gnome_vfs_async_open_as_channel: * @handle_return: pointer to a pointer to a #GnomeVFSHandle object. * @text_uri: string of the uri to open as a #GIOChannel. * @open_mode: open mode i.e. for reading, writing, random, etc. * @advised_block_size: the preferred block size for #GIOChannel to read. * @priority: a value from %GNOME_VFS_PRIORITY_MIN to %GNOME_VFS_PRIORITY_MAX (normally * should be %GNOME_VFS_PRIORITY_DEFAULT) indicating the priority to assign this job * in allocating threads from the thread pool. * @callback: function to be called when the operation is complete. * @callback_data: data to pass to @callback. * * Open @text_uri as a #GIOChannel. Once the channel has been established * @callback will be called with @callback_data, the result of the operation, * and if the result was %GNOME_VFS_OK, a reference to a #GIOChannel pointing * at @text_uri in @open_mode. * * This function has been deprecated due to behaving weirdly which suggests * that it hasn't been used. See bugs #157266, #157265, #157261, #138398 in * the GNOME Bugzilla. If the *_as_channel functions are needed they should be * fixed and undeprecated. */ void gnome_vfs_async_open_as_channel (GnomeVFSAsyncHandle **handle_return, const gchar *text_uri, GnomeVFSOpenMode open_mode, guint advised_block_size, int priority, GnomeVFSAsyncOpenAsChannelCallback callback, gpointer callback_data) { GnomeVFSURI *uri; g_return_if_fail (handle_return != NULL); g_return_if_fail (text_uri != NULL); g_return_if_fail (callback != NULL); g_return_if_fail (priority >= GNOME_VFS_PRIORITY_MIN); g_return_if_fail (priority <= GNOME_VFS_PRIORITY_MAX); uri = gnome_vfs_uri_new (text_uri); *handle_return = async_open_as_channel (uri, open_mode, advised_block_size, priority, callback, callback_data); if (uri != NULL) { gnome_vfs_uri_unref (uri); } }
static void gst_gnome_vfs_src_finalize (GObject * object) { GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (object); g_static_mutex_lock (&count_lock); ref_count--; if (ref_count == 0 && vfs_owner) { if (gnome_vfs_initialized () == TRUE) { gnome_vfs_shutdown (); } } g_static_mutex_unlock (&count_lock); if (src->uri) { gnome_vfs_uri_unref (src->uri); src->uri = NULL; } g_free (src->uri_name); src->uri_name = NULL; g_free (src->iradio_name); src->iradio_name = NULL; g_free (src->iradio_genre); src->iradio_genre = NULL; g_free (src->iradio_url); src->iradio_url = NULL; g_free (src->iradio_title); src->iradio_title = NULL; G_OBJECT_CLASS (parent_class)->finalize (object); }
static void file_handle_destroy (FileHandle *handle) { gnome_vfs_uri_unref (handle->uri); g_free (handle); }
static void gst_gnome_vfs_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstGnomeVFSSink *sink; GstState cur_state; sink = GST_GNOME_VFS_SINK (object); gst_element_get_state (GST_ELEMENT (sink), &cur_state, NULL, 0); if (cur_state == GST_STATE_PLAYING || cur_state == GST_STATE_PAUSED) { GST_WARNING_OBJECT (sink, "cannot set property when PAUSED or PLAYING"); return; } GST_OBJECT_LOCK (sink); switch (prop_id) { case ARG_LOCATION: { const gchar *new_location; if (sink->uri) { gnome_vfs_uri_unref (sink->uri); sink->uri = NULL; } if (sink->uri_name) { g_free (sink->uri_name); sink->uri_name = NULL; } new_location = g_value_get_string (value); if (new_location) { sink->uri_name = gst_gnome_vfs_location_to_uri_string (new_location); sink->uri = gnome_vfs_uri_new (sink->uri_name); } break; } case ARG_URI: { if (sink->uri) { gnome_vfs_uri_unref (sink->uri); sink->uri = NULL; } if (sink->uri_name) { g_free (sink->uri_name); sink->uri_name = NULL; } if (g_value_get_boxed (value)) { sink->uri = (GnomeVFSURI *) g_value_dup_boxed (value); sink->uri_name = gnome_vfs_uri_to_string (sink->uri, 0); } break; } case ARG_HANDLE: { if (sink->uri) { gnome_vfs_uri_unref (sink->uri); sink->uri = NULL; } if (sink->uri_name) { g_free (sink->uri_name); sink->uri_name = NULL; } sink->handle = g_value_get_boxed (value); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } GST_OBJECT_UNLOCK (sink); }