[easytag/wip/core-refactoring: 6/6] Simplify et_browser_show_rename_directory_dialog()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/core-refactoring: 6/6] Simplify et_browser_show_rename_directory_dialog()
- Date: Mon, 11 Jan 2016 07:36:32 +0000 (UTC)
commit 265f89dc70cc40379e0a73973b3be4d654e103f6
Author: David King <amigadave amigadave com>
Date: Fri Jan 1 10:13:34 2016 +0000
Simplify et_browser_show_rename_directory_dialog()
Use g_filename_display_basename() to simplify the logic to extract the
basename and convert to UTF-8 for display.
src/browser.c | 23 +++--------------------
1 files changed, 3 insertions(+), 20 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 0b11e15..fa2ec6f 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -4040,7 +4040,6 @@ et_browser_show_rename_directory_dialog (EtBrowser *self)
gchar *directory_parent = NULL;
gchar *directory_name = NULL;
gchar *directory_name_utf8 = NULL;
- gchar *address = NULL;
gchar *string;
priv = et_browser_get_instance_private (self);
@@ -4056,28 +4055,12 @@ et_browser_show_rename_directory_dialog (EtBrowser *self)
if (et_str_empty (directory_parent))
{
- g_free(directory_parent);
+ g_free (directory_parent);
return;
}
- // Remove the last '/' in the path if it exists
- if (strlen(directory_parent)>1 && directory_parent[strlen(directory_parent)-1]==G_DIR_SEPARATOR)
- directory_parent[strlen(directory_parent)-1]=0;
- // Get name of the directory to rename (without path)
- address = strrchr(directory_parent,G_DIR_SEPARATOR);
- if (!address) return;
- directory_name = g_strdup(address+1);
- *(address+1) = 0;
-
- if (et_str_empty (directory_name))
- {
- g_free(directory_name);
- g_free(directory_parent);
- return;
- }
-
- /* FIXME: Use g_filename_display_basename() to simplify the code above? */
- directory_name_utf8 = g_filename_display_name (directory_name);
+ directory_name = g_path_get_basename (directory_parent);
+ directory_name_utf8 = g_filename_display_basename (directory_parent);
builder = gtk_builder_new_from_resource ("/org/gnome/EasyTAG/browser_dialogs.ui");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]