diff options
author | William Jon McCann <jmccann@redhat.com> | 2008-07-21 15:52:25 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2008-07-21 15:52:25 +0000 |
commit | 51c6b49401a9b4a622afcf72ce7ff40d58f707e9 (patch) | |
tree | bd93e07296c8de6f8c09d12a2df1429a97d7080f | |
parent | fb48211375011d6fe83e9bb0bede3a3948760d7d (diff) | |
download | gdm-51c6b49401a9b4a622afcf72ce7ff40d58f707e9.tar.gz |
Fix a couple more issues with the filesystem type checking.
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.
svn path=/trunk/; revision=6313
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gui/simple-greeter/Makefile.am | 9 | ||||
-rw-r--r-- | gui/simple-greeter/gdm-user.c | 87 |
3 files changed, 64 insertions, 40 deletions
@@ -1,5 +1,13 @@ 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. + +2008-07-21 William Jon McCann <jmccann@redhat.com> + * gui/simple-greeter/gdm-simple-greeter.schemas.in: Add recent-languages and recent-layouts to schemas diff --git a/gui/simple-greeter/Makefile.am b/gui/simple-greeter/Makefile.am index ca326cee..464ef0e1 100644 --- a/gui/simple-greeter/Makefile.am +++ b/gui/simple-greeter/Makefile.am @@ -59,6 +59,7 @@ noinst_PROGRAMS = \ test-a11y-preferences \ test-greeter-login-window \ test-greeter-panel \ + test-filesystem-type \ test-language-chooser \ test-languages \ test-sessions \ @@ -159,6 +160,14 @@ test_remote_login_window_LDADD = \ $(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 \ diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c index 678c10a9..e412d820 100644 --- a/gui/simple-greeter/gdm-user.c +++ b/gui/simple-greeter/gdm-user.c @@ -703,64 +703,71 @@ check_user_file (const char *filename, 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) { |