gedit r6359 - in trunk: . gedit
- From: jessevdk svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6359 - in trunk: . gedit
- Date: Thu, 7 Aug 2008 21:03:11 +0000 (UTC)
Author: jessevdk
Date: Thu Aug 7 21:03:11 2008
New Revision: 6359
URL: http://svn.gnome.org/viewvc/gedit?rev=6359&view=rev
Log:
* gedit/gedit-utils.c: don't do an expensive stat in
basename_for_display for remote files
Modified:
trunk/ChangeLog
trunk/gedit/gedit-utils.c
Modified: trunk/gedit/gedit-utils.c
==============================================================================
--- trunk/gedit/gedit-utils.c (original)
+++ trunk/gedit/gedit-utils.c Thu Aug 7 21:03:11 2008
@@ -1170,35 +1170,38 @@
{
gchar *name;
GFile *gfile;
- GFileInfo *info;
gchar *hn;
g_return_val_if_fail (uri != NULL, NULL);
gfile = g_file_new_for_uri (uri);
- /* First, try to query the display name */
- info = g_file_query_info (gfile,
- G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
- G_FILE_QUERY_INFO_NONE,
- NULL,
- NULL);
-
- if (info)
- {
- /* Simply get the display name to use as the basename */
- name = g_strdup (g_file_info_get_display_name (info));
- g_object_unref (info);
- }
- else if (g_file_has_uri_scheme (gfile, "file"))
+ /* First, try to query the display name, but only on local files */
+ if (g_file_has_uri_scheme (gfile, "file"))
{
- /* This is a local file, and therefore we will use
- * g_filename_display_basename on the local path */
- gchar *local_path;
+ GFileInfo *info;
+ info = g_file_query_info (gfile,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+
+ if (info)
+ {
+ /* Simply get the display name to use as the basename */
+ name = g_strdup (g_file_info_get_display_name (info));
+ g_object_unref (info);
+ }
+ else
+ {
+ /* This is a local file, and therefore we will use
+ * g_filename_display_basename on the local path */
+ gchar *local_path;
- local_path = g_file_get_path (gfile);
- name = g_filename_display_basename (local_path);
- g_free (local_path);
+ local_path = g_file_get_path (gfile);
+ name = g_filename_display_basename (local_path);
+ g_free (local_path);
+ }
}
else if (gedit_utils_file_has_parent (gfile) || !gedit_utils_decode_uri (uri, NULL, NULL, &hn, NULL, NULL))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]