gdm r6313 - in trunk: . gui/simple-greeter
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r6313 - in trunk: . gui/simple-greeter
- Date: Mon, 21 Jul 2008 15:52:25 +0000 (UTC)
Author: mccann
Date: Mon Jul 21 15:52:25 2008
New Revision: 6313
URL: http://svn.gnome.org/viewvc/gdm?rev=6313&view=rev
Log:
2008-07-21 William Jon McCann <jmccann redhat com>
* gui/simple-greeter/Makefile.am:
* gui/simple-greeter/gdm-user.c (get_filesystem_type),
(render_icon_from_home):
Fix a couple more issues with the filesystem type
checking.
Modified:
trunk/ChangeLog
trunk/gui/simple-greeter/Makefile.am
trunk/gui/simple-greeter/gdm-user.c
Modified: trunk/gui/simple-greeter/Makefile.am
==============================================================================
--- trunk/gui/simple-greeter/Makefile.am (original)
+++ trunk/gui/simple-greeter/Makefile.am Mon Jul 21 15:52:25 2008
@@ -59,6 +59,7 @@
test-a11y-preferences \
test-greeter-login-window \
test-greeter-panel \
+ test-filesystem-type \
test-language-chooser \
test-languages \
test-sessions \
@@ -159,6 +160,14 @@
$(top_builddir)/common/libgdmcommon.la \
$(NULL)
+test_filesystem_type_SOURCES = \
+ test-filesystem-type.c \
+ $(NULL)
+
+test_filesystem_type_LDADD = \
+ $(COMMON_LIBS) \
+ $(NULL)
+
test_language_chooser_SOURCES = \
test-language-chooser.c \
gdm-cell-renderer-timer.h \
Modified: trunk/gui/simple-greeter/gdm-user.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-user.c (original)
+++ trunk/gui/simple-greeter/gdm-user.c Mon Jul 21 15:52:25 2008
@@ -703,64 +703,71 @@
return TRUE;
}
-static GdkPixbuf *
-render_icon_from_home (GdmUser *user,
- int icon_size)
+static char *
+get_filesystem_type (const char *path)
{
- GdkPixbuf *retval;
- char *path;
GFile *file;
GFileInfo *file_info;
- gboolean is_local;
- gboolean is_autofs;
- gboolean res;
- const char *filesystem_type;
+ GError *error;
+ char *filesystem_type;
- /* special case: look at parent of home to detect autofs
- this is so we don't try to trigger an automount */
- path = g_path_get_dirname (user->home_dir);
file = g_file_new_for_path (path);
+ error = NULL;
file_info = g_file_query_filesystem_info (file,
G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
NULL,
- NULL);
+ &error);
if (file_info == NULL) {
- g_free (path);
+ g_warning ("Unable to query filesystem type: %s", error->message);
+ g_error_free (error);
g_object_unref (file);
return NULL;
}
- filesystem_type = g_file_info_get_attribute_string (file_info,
- G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
- is_autofs = (filesystem_type != NULL && strcmp (filesystem_type, "autofs") == 0);
+
+ filesystem_type = g_strdup (g_file_info_get_attribute_string (file_info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE));
+
g_object_unref (file);
g_object_unref (file_info);
+
+ return filesystem_type;
+}
+
+static GdkPixbuf *
+render_icon_from_home (GdmUser *user,
+ int icon_size)
+{
+ GdkPixbuf *retval;
+ char *path;
+ gboolean is_local;
+ gboolean is_autofs;
+ gboolean res;
+ char *filesystem_type;
+
+ is_local = FALSE;
+
+ /* special case: look at parent of home to detect autofs
+ this is so we don't try to trigger an automount */
+ path = g_path_get_dirname (user->home_dir);
+ filesystem_type = get_filesystem_type (path);
+ is_autofs = (filesystem_type != NULL && strcmp (filesystem_type, "autofs") == 0);
+ g_free (filesystem_type);
g_free (path);
- /* now check that home dir itself is local */
- is_local = TRUE;
- if (! is_autofs) {
- file = g_file_new_for_path (user->home_dir);
- file_info = g_file_query_filesystem_info (file,
- G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
- NULL,
- NULL);
- if (file_info == NULL) {
- g_object_unref (file);
- return NULL;
- }
- filesystem_type = g_file_info_get_attribute_string (file_info,
- G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
- if (filesystem_type != NULL) {
- is_local = ((strcmp (filesystem_type, "nfs") != 0) &&
- (strcmp (filesystem_type, "afs") != 0) &&
- (strcmp (filesystem_type, "autofs") != 0) &&
- (strcmp (filesystem_type, "unknown") != 0) &&
- (strcmp (filesystem_type, "ncpfs") != 0));
- }
- g_object_unref (file_info);
- g_object_unref (file);
+ if (is_autofs) {
+ return NULL;
}
+ /* now check that home dir itself is local */
+ filesystem_type = get_filesystem_type (user->home_dir);
+ is_local = ((filesystem_type != NULL) &&
+ (strcmp (filesystem_type, "nfs") != 0) &&
+ (strcmp (filesystem_type, "afs") != 0) &&
+ (strcmp (filesystem_type, "autofs") != 0) &&
+ (strcmp (filesystem_type, "unknown") != 0) &&
+ (strcmp (filesystem_type, "ncpfs") != 0));
+ g_free (filesystem_type);
+
/* only look at local home directories so we don't try to
read from remote (e.g. NFS) volumes */
if (! is_local) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]