[Cxplorer-cvs 01036] CVS update: libcxp/src

Back to archive index

Yasumichi Akahoshi yasum****@users*****
2005年 4月 16日 (土) 03:54:17 JST


Index: libcxp/src/cxp-utils.c
diff -u libcxp/src/cxp-utils.c:1.5 libcxp/src/cxp-utils.c:1.6
--- libcxp/src/cxp-utils.c:1.5	Wed Apr  6 00:12:50 2005
+++ libcxp/src/cxp-utils.c	Sat Apr 16 03:54:17 2005
@@ -30,6 +30,7 @@
  */
 
 static GList *pixmaps_directories = NULL;	/**< It have directory list. */
+static gchar *fname_filter = NULL;
 
 /**
  * Use this function to set the directory containing installed pixmaps.
@@ -126,6 +127,16 @@
 	return pixbuf;
 }
 
+void cxp_utils_set_filename_filter (const gchar *value)
+{
+	fname_filter = g_strdup (value);
+}
+
+void cxp_utils_free_filename_filter (void)
+{
+	g_free (fname_filter);
+}
+
 /**
  * Gets the last component of the filename converted to UTF-8. If file_name ends
  * with a directory separator it gets the component before the last slash. If 
@@ -138,15 +149,29 @@
  */
 gchar *cxp_path_get_basename_of_utf8 (const gchar * file_name)
 {
-	gchar *gcBasenameLocale;
-	gchar *gcBasenameUtf8;
+	gchar *base_name;
+	gchar *basename_locale = NULL;
+	gchar *basename_utf8;
+	gchar *cmd;
+	gint exit_status;
 
-	gcBasenameLocale = g_path_get_basename (file_name);
-	gcBasenameUtf8 =
-		g_locale_to_utf8 (gcBasenameLocale, -1, NULL, NULL, NULL);
-	g_free (gcBasenameLocale);
+	if (fname_filter == NULL)
+	{
+		basename_locale = g_path_get_basename (file_name);
+	}
+	else
+	{
+		base_name = g_path_get_basename (file_name);
+		cmd = g_strdup_printf ("%s '%s'", fname_filter, base_name);
+		g_spawn_command_line_sync (cmd, &basename_locale, NULL, NULL, NULL);
+		g_free (cmd);
+		g_strchomp (basename_locale);
+	}
+	basename_utf8 =
+		g_locale_to_utf8 (basename_locale, -1, NULL, NULL, NULL);
+	g_free (basename_locale);
 
-	return gcBasenameUtf8;
+	return basename_utf8;
 }
 
 /**


Cxplorer-cvs メーリングリストの案内
Back to archive index