From 1987bc1ba09bdda36b0f08b0e179bc0fe59a858f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 09:49:19 +0100 Subject: protect against incorrect webcam detection --- src/udev-mgr.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/udev-mgr.c b/src/udev-mgr.c index edc2262..5f197d6 100644 --- a/src/udev-mgr.c +++ b/src/udev-mgr.c @@ -226,7 +226,11 @@ udev_mgr_handle_webcam (UdevMgr* self, vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); product = g_udev_device_get_property (device, "ID_MODEL_ID"); - + + if (!vendor || !product) { + return; + } + if (action == REMOVE){ if (g_hash_table_lookup (self->webcams_present, product) == NULL){ g_warning ("Got a remove event on a webcam device but we don't have that device in our webcam cache"); @@ -316,18 +320,23 @@ static void udev_mgr_handle_scsi_device (UdevMgr* self, { const gchar* type = NULL; type = g_udev_device_get_property (device, "TYPE"); - // apparently anything thats type 3 and SCSI is a Scanner + + if (!type) { + return; + } + + // apparently anything thats type 6 and SCSI is a Scanner if (g_strcmp0 (type, "6") == 0 && action == ADD){ const gchar* manufacturer = NULL; manufacturer = g_udev_device_get_property (device, "ID_VENDOR"); if (manufacturer != NULL){ - gchar * label = format_device_name(self, manufacturer, _("Scanner"), _("%s Scanner")); + gchar * label = format_device_name(self, manufacturer, _("Scanner"), _("%s Scanner")); dbusmenu_menuitem_property_set (self->scanner_item, DBUSMENU_MENUITEM_PROP_LABEL, label); - g_free(label); + g_free(label); } gchar* random_scanner_name = g_strdup_printf("%p--scanner", self); -- cgit v1.2.3 From 6ce3738b7e6c27f22cb949e2668e9ee47b4ced3f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 16:32:43 +0100 Subject: fixed the guest session panel string --- src/user-menu-mgr.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index 1b404d3..1747a8a 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -168,6 +168,10 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) users_service_dbus_set_guest_item (self->users_dbus_interface, guest_mi); } + else{ + session_dbus_set_users_real_name (self->session_dbus_interface, + _("Guest")); + } GList * users = NULL; users = users_service_dbus_get_user_list (self->users_dbus_interface); @@ -175,8 +179,9 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) gboolean user_menu_is_visible = FALSE; + // question for Ted, how to detect guest session is enabled. if (!greeter_mode){ - user_menu_is_visible = self->user_count > 1 || check_guest_session(); + user_menu_is_visible = TRUE;//self->user_count > 1 || check_guest_session(); } session_dbus_set_user_menu_visibility (self->session_dbus_interface, @@ -192,20 +197,13 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) user->service = self->users_dbus_interface; gboolean current_user = g_strcmp0 (user->user_name, g_get_user_name()) == 0; if (current_user == TRUE){ - if (check_guest_session()){ - g_debug ("about to set the users real name to %s for user %s", - user->real_name, user->user_name); - session_dbus_set_users_real_name (self->session_dbus_interface, user->real_name); - } - else{ - g_debug ("about to set the users real name to GUEST"); - session_dbus_set_users_real_name (self->session_dbus_interface, - _("Guest")); - } + g_debug ("about to set the users real name to %s for user %s", + user->real_name, user->user_name); + session_dbus_set_users_real_name (self->session_dbus_interface, user->real_name); } - if (g_strcmp0(user->user_name, "guest") == 0) { + if (g_str_has_prefix(user->user_name, "guest-") == TRUE) { /* Check to see if the guest has sessions and so therefore should get a check mark. */ dbusmenu_menuitem_property_set_bool (guest_mi, -- cgit v1.2.3 From 267bef38a08ff9d7d401cf5027d1dc2876430ca4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 16:46:28 +0100 Subject: remove broken logic concerned with displaying the user menu --- src/user-menu-mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index 1747a8a..c11e0b9 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -179,9 +179,8 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) gboolean user_menu_is_visible = FALSE; - // question for Ted, how to detect guest session is enabled. if (!greeter_mode){ - user_menu_is_visible = TRUE;//self->user_count > 1 || check_guest_session(); + user_menu_is_visible = TRUE; } session_dbus_set_user_menu_visibility (self->session_dbus_interface, -- cgit v1.2.3 From a26d2f019ecbb67dacae83a07f7526759bb050f9 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 17:17:19 +0100 Subject: remove guest checking in generic user list, the guest user is never included in the user list returned therefore the check is pointless --- src/user-menu-mgr.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src') diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index c11e0b9..a4308dd 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -192,7 +192,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) for (u = users; u != NULL; u = g_list_next (u)) { user = u->data; - //g_debug ("%p: %s", user, user->real_name); + g_debug ("%s: %s", user->user_name, user->real_name); user->service = self->users_dbus_interface; gboolean current_user = g_strcmp0 (user->user_name, g_get_user_name()) == 0; if (current_user == TRUE){ @@ -201,21 +201,6 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) session_dbus_set_users_real_name (self->session_dbus_interface, user->real_name); } - - if (g_str_has_prefix(user->user_name, "guest-") == TRUE) { - /* Check to see if the guest has sessions and so therefore should - get a check mark. */ - dbusmenu_menuitem_property_set_bool (guest_mi, - USER_ITEM_PROP_LOGGED_IN, - user->sessions != NULL); - /* If we're showing user accounts, keep going through the list */ - if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { - continue; - } - /* If not, we can stop here */ - break; - } - if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { mi = dbusmenu_menuitem_new (); dbusmenu_menuitem_property_set (mi, -- cgit v1.2.3