[gdm/gnome-2-30] move local user monitoring code to its own function
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/gnome-2-30] move local user monitoring code to its own function
- Date: Fri, 11 Jun 2010 01:51:14 +0000 (UTC)
commit 91cc21e688f85a65f6d3dfb2b5f05405f1b0d7d1
Author: Ray Strode <rstrode redhat com>
Date: Tue Mar 16 00:20:38 2010 -0400
move local user monitoring code to its own function
It was open coded in _init before.
https://bugzilla.gnome.org/show_bug.cgi?id=610179
gui/simple-greeter/gdm-user-manager.c | 91 ++++++++++++++++++---------------
1 files changed, 50 insertions(+), 41 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
index c5b85a3..68f0738 100644
--- a/gui/simple-greeter/gdm-user-manager.c
+++ b/gui/simple-greeter/gdm-user-manager.c
@@ -1559,6 +1559,55 @@ gdm_user_manager_get_property (GObject *object,
}
static void
+monitor_local_users (GdmUserManager *manager)
+{
+ GFile *file;
+ GError *error;
+
+ g_debug ("Monitoring local users");
+
+ /* /etc/shells */
+ manager->priv->shells = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
+ reload_shells (manager);
+ file = g_file_new_for_path (_PATH_SHELLS);
+ error = NULL;
+ manager->priv->shells_monitor = g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &error);
+ if (manager->priv->shells_monitor != NULL) {
+ g_signal_connect (manager->priv->shells_monitor,
+ "changed",
+ G_CALLBACK (on_shells_monitor_changed),
+ manager);
+ } else {
+ g_warning ("Unable to monitor %s: %s", _PATH_SHELLS, error->message);
+ g_error_free (error);
+ }
+ g_object_unref (file);
+
+ /* /etc/passwd */
+ file = g_file_new_for_path (PATH_PASSWD);
+ manager->priv->passwd_monitor = g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &error);
+ if (manager->priv->passwd_monitor != NULL) {
+ g_signal_connect (manager->priv->passwd_monitor,
+ "changed",
+ G_CALLBACK (on_passwd_monitor_changed),
+ manager);
+ } else {
+ g_warning ("Unable to monitor %s: %s", PATH_PASSWD, error->message);
+ g_error_free (error);
+ }
+ g_object_unref (file);
+}
+
+static void
gdm_user_manager_class_init (GdmUserManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1637,8 +1686,6 @@ gdm_set_string_list (char *value, GSList **retval)
static void
gdm_user_manager_init (GdmUserManager *manager)
{
- GFile *file;
- GError *error;
char *temp;
gboolean res;
@@ -1671,45 +1718,7 @@ gdm_user_manager_init (GdmUserManager *manager)
(GDestroyNotify) g_object_run_dispose);
if (manager->priv->include_all == TRUE) {
- /* /etc/shells */
- manager->priv->shells = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- NULL);
- reload_shells (manager);
- file = g_file_new_for_path (_PATH_SHELLS);
- error = NULL;
- manager->priv->shells_monitor = g_file_monitor_file (file,
- G_FILE_MONITOR_NONE,
- NULL,
- &error);
- if (manager->priv->shells_monitor != NULL) {
- g_signal_connect (manager->priv->shells_monitor,
- "changed",
- G_CALLBACK (on_shells_monitor_changed),
- manager);
- } else {
- g_warning ("Unable to monitor %s: %s", _PATH_SHELLS, error->message);
- g_error_free (error);
- }
- g_object_unref (file);
-
- /* /etc/passwd */
- file = g_file_new_for_path (PATH_PASSWD);
- manager->priv->passwd_monitor = g_file_monitor_file (file,
- G_FILE_MONITOR_NONE,
- NULL,
- &error);
- if (manager->priv->passwd_monitor != NULL) {
- g_signal_connect (manager->priv->passwd_monitor,
- "changed",
- G_CALLBACK (on_passwd_monitor_changed),
- manager);
- } else {
- g_warning ("Unable to monitor %s: %s", PATH_PASSWD, error->message);
- g_error_free (error);
- }
- g_object_unref (file);
+ monitor_local_users (manager);
}
get_seat_proxy (manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]