From 23c781c2475b144a365eaf50dffb88986899b4c8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 5 Nov 2009 22:38:08 -0500 Subject: Remove redundant URI/filename conversion functions. Use g_filename_to_uri() instead of e_util_filename_to_uri(). Use g_filename_from_uri() instead of e_util_uri_to_filename(). --- doc/reference/shell/eshell-sections.txt | 2 - doc/reference/shell/tmpl/e-util.sgml | 18 --------- doc/reference/shell/tmpl/eshell-unused.sgml | 16 ++++++++ e-util/e-dialog-utils.c | 4 +- e-util/e-util.c | 60 ++--------------------------- e-util/e-util.h | 2 - 6 files changed, 21 insertions(+), 81 deletions(-) diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt index 82a7ca5a06..b69e65f3fd 100644 --- a/doc/reference/shell/eshell-sections.txt +++ b/doc/reference/shell/eshell-sections.txt @@ -572,8 +572,6 @@ e_file_lock_create e_file_lock_destroy e_file_lock_exists e_util_guess_mime_type -e_util_filename_to_uri -e_util_uri_to_filename e_util_read_file e_util_get_category_filter_options e_charset_add_radio_actions diff --git a/doc/reference/shell/tmpl/e-util.sgml b/doc/reference/shell/tmpl/e-util.sgml index 7d2fde14a7..50af7459be 100644 --- a/doc/reference/shell/tmpl/e-util.sgml +++ b/doc/reference/shell/tmpl/e-util.sgml @@ -354,24 +354,6 @@ Miscellaneous Utility Functions @Returns: - - - - - -@filename: -@Returns: - - - - - - - -@uri: -@Returns: - - diff --git a/doc/reference/shell/tmpl/eshell-unused.sgml b/doc/reference/shell/tmpl/eshell-unused.sgml index 4505a66d99..99ad9d4067 100644 --- a/doc/reference/shell/tmpl/eshell-unused.sgml +++ b/doc/reference/shell/tmpl/eshell-unused.sgml @@ -2238,6 +2238,22 @@ intelligent + + + + + +@filename: +@Returns: + + + + + + +@uri: +@Returns: + diff --git a/e-util/e-dialog-utils.c b/e-util/e-dialog-utils.c index 334375c755..952d73f303 100644 --- a/e-util/e-dialog-utils.c +++ b/e-util/e-dialog-utils.c @@ -169,7 +169,7 @@ e_file_can_save(GtkWindow *parent, const gchar *uri) if (!e_file_check_local(uri)) return TRUE; - path = e_util_uri_to_filename (uri); + path = g_filename_from_uri (uri, NULL, NULL); if (!path) return FALSE; @@ -199,7 +199,7 @@ e_file_check_local (const gchar *name) { gchar *uri; - uri = e_util_uri_to_filename (name); + uri = g_filename_to_uri (name, NULL, NULL); if (uri) { g_free(uri); return TRUE; diff --git a/e-util/e-util.c b/e-util/e-util.c index 533b3ef908..bf1f387d15 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1418,7 +1418,7 @@ get_lock_filename (void) } gboolean -e_file_lock_create () +e_file_lock_create (void) { const gchar *fname = get_lock_filename (); gboolean status = FALSE; @@ -1435,7 +1435,7 @@ e_file_lock_create () } void -e_file_lock_destroy () +e_file_lock_destroy (void) { const gchar *fname = get_lock_filename (); @@ -1445,7 +1445,7 @@ e_file_lock_destroy () } gboolean -e_file_lock_exists () +e_file_lock_exists (void) { const gchar *fname = get_lock_filename (); @@ -1507,60 +1507,6 @@ e_util_guess_mime_type (const gchar *filename, gboolean localfile) return mime_type; } -/** - * e_util_filename_to_uri: - * @filename: local file name. - * - * Converts a local file name to a URI. Free the returned string with - * g_free(). - * - * Returns: a newly allocated string or %NULL - **/ -gchar * -e_util_filename_to_uri (const gchar *filename) -{ - GFile *file; - gchar *uri = NULL; - - g_return_val_if_fail (filename != NULL, NULL); - - file = g_file_new_for_path (filename); - - if (file) { - uri = g_file_get_uri (file); - g_object_unref (file); - } - - return uri; -} - -/** - * e_util_uri_to_filename: - * @uri: a URI - * - * Converts a URI to a local file name. %NULL indicates no such - * local file name exists. Free the returned string with g_free(). - * - * Returns: either newly allocated string or %NULL - **/ -gchar * -e_util_uri_to_filename (const gchar *uri) -{ - GFile *file; - gchar *filename = NULL; - - g_return_val_if_fail (uri != NULL, NULL); - - file = g_file_new_for_uri (uri); - - if (file) { - filename = g_file_get_path (file); - g_object_unref (file); - } - - return filename; -} - /** * e_util_read_file: * @filename: File name to read. diff --git a/e-util/e-util.h b/e-util/e-util.h index 16b3373279..88ebaa2af7 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -141,8 +141,6 @@ gboolean e_file_lock_exists (void); gchar * e_util_guess_mime_type (const gchar *filename, gboolean localfile); -gchar * e_util_filename_to_uri (const gchar *filename); -gchar * e_util_uri_to_filename (const gchar *uri); gboolean e_util_read_file (const gchar *filename, gboolean filename_is_uri, -- cgit