aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-08-25 11:04:58 +0100
committerConor Curran <conor.curran@canonical.com>2011-08-25 11:04:58 +0100
commitf0031ebfeb68b1dcb805416d5f110d476a094452 (patch)
tree48c9c1197366fb30b1ac2e02bf38cb00f539d70f
parente708841644c5be2997a4ff92cad8383a9260e7ed (diff)
parentcbae3e05ba000358ad819566cfb46a847e424400 (diff)
downloadayatana-indicator-session-f0031ebfeb68b1dcb805416d5f110d476a094452.tar.gz
ayatana-indicator-session-f0031ebfeb68b1dcb805416d5f110d476a094452.tar.bz2
ayatana-indicator-session-f0031ebfeb68b1dcb805416d5f110d476a094452.zip
branded attached devices menuitem labels
-rw-r--r--src/apt-watcher.c3
-rw-r--r--src/device-menu-mgr.c30
-rw-r--r--src/udev-mgr.c68
-rw-r--r--src/user-menu-mgr.c25
4 files changed, 88 insertions, 38 deletions
diff --git a/src/apt-watcher.c b/src/apt-watcher.c
index 7d706a0..a4298a8 100644
--- a/src/apt-watcher.c
+++ b/src/apt-watcher.c
@@ -279,6 +279,9 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans,
dbusmenu_menuitem_property_set (self->apt_item,
DBUSMENU_MENUITEM_PROP_LABEL,
_("Reboot Required"));
+ dbusmenu_menuitem_property_set (self->apt_item,
+ DBUSMENU_MENUITEM_PROP_DISPOSITION,
+ DBUSMENU_MENUITEM_DISPOSITION_ALERT);
session_dbus_restart_required (self->session_dbus_interface);
}
g_debug ("Finished with a reboot value of %i", reboot);
diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c
index c298682..523ea8d 100644
--- a/src/device-menu-mgr.c
+++ b/src/device-menu-mgr.c
@@ -49,7 +49,6 @@ static GSettings *keybinding_settings = NULL;
static DbusmenuMenuitem *lock_menuitem = NULL;
static DbusmenuMenuitem *system_settings_menuitem = NULL;
static DbusmenuMenuitem *display_settings_menuitem = NULL;
-static DbusmenuMenuitem *bluetooth_settings_menuitem = NULL;
static DbusmenuMenuitem *login_settings_menuitem = NULL;
static DbusmenuMenuitem *software_updates_menuitem = NULL;
static DbusmenuMenuitem *printers_menuitem = NULL;
@@ -535,17 +534,6 @@ device_menu_mgr_build_settings_items (DeviceMenuMgr* self)
dbusmenu_menuitem_child_add_position(self->root_item,
display_settings_menuitem,
1);
- bluetooth_settings_menuitem = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set (bluetooth_settings_menuitem,
- DBUSMENU_MENUITEM_PROP_LABEL,
- _("Bluetooth…"));
- g_signal_connect (G_OBJECT(bluetooth_settings_menuitem),
- DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
- G_CALLBACK(show_system_settings_with_context), "bluetooth");
- dbusmenu_menuitem_child_add_position(self->root_item,
- bluetooth_settings_menuitem,
- 2);
-
login_settings_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (login_settings_menuitem,
DBUSMENU_MENUITEM_PROP_LABEL,
@@ -556,20 +544,20 @@ device_menu_mgr_build_settings_items (DeviceMenuMgr* self)
"login");
dbusmenu_menuitem_child_add_position(self->root_item,
login_settings_menuitem,
- 3);
+ 2);
software_updates_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (software_updates_menuitem,
DBUSMENU_MENUITEM_PROP_LABEL,
_("Software Up to Date"));
dbusmenu_menuitem_child_add_position(self->root_item,
software_updates_menuitem,
- 4);
+ 3);
DbusmenuMenuitem * separator1 = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (separator1,
DBUSMENU_MENUITEM_PROP_TYPE,
DBUSMENU_CLIENT_TYPES_SEPARATOR);
- dbusmenu_menuitem_child_add_position (self->root_item, separator1, 5);
+ dbusmenu_menuitem_child_add_position (self->root_item, separator1, 4);
}
static void
@@ -584,7 +572,7 @@ device_menu_mgr_build_devices_items (DeviceMenuMgr* self)
FALSE);
dbusmenu_menuitem_child_add_position (self->root_item,
device_heading,
- 6);
+ 5);
printers_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (printers_menuitem,
@@ -596,7 +584,7 @@ device_menu_mgr_build_devices_items (DeviceMenuMgr* self)
"printers");
dbusmenu_menuitem_child_add_position(self->root_item,
printers_menuitem,
- 7);
+ 6);
scanners_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (scanners_menuitem,
DBUSMENU_MENUITEM_PROP_LABEL,
@@ -607,7 +595,7 @@ device_menu_mgr_build_devices_items (DeviceMenuMgr* self)
NULL);
dbusmenu_menuitem_child_add_position (self->root_item,
scanners_menuitem,
- 8);
+ 7);
dbusmenu_menuitem_property_set_bool (scanners_menuitem,
DBUSMENU_MENUITEM_PROP_VISIBLE,
FALSE);
@@ -622,7 +610,7 @@ device_menu_mgr_build_devices_items (DeviceMenuMgr* self)
NULL);
dbusmenu_menuitem_child_add_position (self->root_item,
webcam_menuitem,
- 10);
+ 8);
dbusmenu_menuitem_property_set_bool (webcam_menuitem,
DBUSMENU_MENUITEM_PROP_VISIBLE,
FALSE);
@@ -631,7 +619,7 @@ device_menu_mgr_build_devices_items (DeviceMenuMgr* self)
dbusmenu_menuitem_property_set (separator3,
DBUSMENU_MENUITEM_PROP_TYPE,
DBUSMENU_CLIENT_TYPES_SEPARATOR);
- dbusmenu_menuitem_child_add_position (self->root_item, separator3, 11);
+ dbusmenu_menuitem_child_add_position (self->root_item, separator3, 9);
}
static void
@@ -752,7 +740,6 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self, gboolean greeter_mode)
self->udev_mgr = udev_mgr_new (scanners_menuitem, webcam_menuitem);
}
-
static void
device_menu_mgr_rebuild_items (DeviceMenuMgr* self)
{
@@ -833,7 +820,6 @@ device_menu_mgr_ensure_settings_client (DeviceMenuMgr* self)
keybinding_settings = g_settings_new (KEYBINDING_SCHEMA);
g_signal_connect(lockdown_settings, "changed::" KEY_LOCK_SCREEN, G_CALLBACK(keybinding_changed), self);
}
-
return;
}
diff --git a/src/udev-mgr.c b/src/udev-mgr.c
index f66d862..7e51383 100644
--- a/src/udev-mgr.c
+++ b/src/udev-mgr.c
@@ -19,11 +19,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gudev/gudev.h>
-// TEMP
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
+#include <glib/gi18n.h>
#include "udev-mgr.h"
#include "sane-rules.h"
@@ -235,13 +231,29 @@ udev_mgr_handle_webcam (UdevMgr* self,
}
g_hash_table_remove (self->webcams_present,
product);
-
+ dbusmenu_menuitem_property_set (self->webcam_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Webcams"));
}
else {
if (g_hash_table_lookup (self->webcams_present, product) != NULL){
g_warning ("Got an ADD event on a webcam device but we already have that device in our webcam cache");
return;
}
+
+ const gchar* manufacturer = NULL;
+ manufacturer = g_udev_device_get_property (device, "ID_VENDOR");
+
+ if (manufacturer != NULL){
+ gchar* lowered = g_ascii_strdown (manufacturer, -1);
+ lowered[0] = g_ascii_toupper (lowered[0]);
+ gchar* label = g_strdup_printf(_("%s Webcam"), lowered);
+ g_free (lowered);
+ dbusmenu_menuitem_property_set (self->webcam_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ label);
+ }
+
g_hash_table_insert (self->webcams_present,
g_strdup (product),
g_strdup (vendor));
@@ -254,23 +266,26 @@ debug_device (UdevMgr* self,
GUdevDevice* device,
UdevMgrDeviceAction action)
{
- /*const gchar* vendor;
+ const gchar* vendor;
const gchar* product;
const gchar* number;
const gchar* name;
+ const gchar* manufacturer;
vendor = g_udev_device_get_property (device, "ID_VENDOR_ID");
+ manufacturer = g_udev_device_get_property (device, "ID_VENDOR");
product = g_udev_device_get_property (device, "ID_MODEL_ID");
number = g_udev_device_get_number (device);
name = g_udev_device_get_name (device);
- g_debug ("device vendor id %s , product id of %s , number of %s and name of %s",
+ g_debug ("%s device vendor id %s , product id of %s , number of %s and name of %s",
+ g_strdup(manufacturer),
g_strdup(vendor),
g_strdup(product),
g_strdup(number),
g_strdup(name));
- const gchar *const *list;
+ /*const gchar *const *list;
const gchar *const *iter;
char propstr[500];
guint32 namelen = 0, i;
@@ -290,7 +305,7 @@ debug_device (UdevMgr* self,
strcat(propstr, " ");
strcat(propstr, g_udev_device_get_property(device, *iter));
g_debug("%s", propstr);
- }*/
+ }*/
}
static void udev_mgr_handle_scsi_device (UdevMgr* self,
@@ -344,6 +359,10 @@ static void udev_mgr_handle_scsi_device (UdevMgr* self,
}
else{
g_hash_table_remove (self->scanners_present, vendor);
+ dbusmenu_menuitem_property_set (self->scanner_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Scanners"));
+
}
}
else{
@@ -351,6 +370,18 @@ static void udev_mgr_handle_scsi_device (UdevMgr* self,
g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache");
}
else{
+ const gchar* manufacturer = NULL;
+ manufacturer = g_udev_device_get_property (device, "ID_VENDOR");
+
+ if (manufacturer != NULL){
+ gchar* lowered = g_ascii_strdown (manufacturer, -1);
+ lowered[0] = g_ascii_toupper (lowered[0]);
+ gchar* label = g_strdup_printf(_("%s Scanner"), lowered);
+ g_free (lowered);
+ dbusmenu_menuitem_property_set (self->scanner_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ label);
+ }
g_hash_table_insert (self->scanners_present,
g_strdup(vendor),
g_strdup(model_id));
@@ -397,6 +428,9 @@ udev_mgr_check_if_usb_device_is_supported (UdevMgr* self,
}
else{
g_hash_table_remove (self->scanners_present, vendor);
+ dbusmenu_menuitem_property_set (self->scanner_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Scanners"));
}
}
else{
@@ -404,6 +438,20 @@ udev_mgr_check_if_usb_device_is_supported (UdevMgr* self,
g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache");
}
else{
+ const gchar* manufacturer = NULL;
+
+ manufacturer = g_udev_device_get_property (device, "ID_VENDOR");
+ if (manufacturer != NULL){
+
+ gchar* lowered = g_ascii_strdown (manufacturer, -1);
+ lowered[0] = g_ascii_toupper (lowered[0]);
+ gchar* label = g_strdup_printf(_("%s Scanner"), lowered);
+ g_free (lowered);
+ dbusmenu_menuitem_property_set (self->scanner_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ label);
+ }
+
g_hash_table_insert (self->scanners_present,
g_strdup(vendor),
g_strdup(model_id));
diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c
index f3b1b64..64b29c5 100644
--- a/src/user-menu-mgr.c
+++ b/src/user-menu-mgr.c
@@ -54,7 +54,8 @@ static void activate_online_accounts (DbusmenuMenuitem *mi,
gpointer user_data);
static void activate_user_accounts (DbusmenuMenuitem *mi,
guint timestamp,
- gpointer user_data);
+ gpointer user_data);
+
static void user_menu_mgr_rebuild_items (UserMenuMgr *self,
gboolean greeter_mode);
static gboolean check_new_session ();
@@ -175,7 +176,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode)
gboolean user_menu_is_visible = FALSE;
if (!greeter_mode){
- user_menu_is_visible = self->user_count > 1;
+ user_menu_is_visible = self->user_count > 1 || check_guest_session();
}
session_dbus_set_user_menu_visibility (self->session_dbus_interface,
@@ -238,13 +239,25 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode)
}
gboolean logged_in = g_strcmp0 (user->user_name, g_get_user_name()) == 0;
+
+ g_debug ("user name = %s and g user name = %s",
+ user->user_name,
+ g_get_user_name());
+
dbusmenu_menuitem_property_set_bool (mi,
USER_ITEM_PROP_IS_CURRENT_USER,
logged_in);
if (logged_in == TRUE){
- 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 (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"));
+ }
}
dbusmenu_menuitem_child_append (self->root_item, mi);
@@ -425,7 +438,7 @@ static gboolean
check_guest_session (void)
{
if (geteuid() < 500) {
- /* System users shouldn't have guest account shown. Mosly
+ /* System users shouldn't have guest account shown. Mostly
this would be the case of the guest user itself. */
return FALSE;
}