aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-08-10 16:23:32 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-08-10 16:23:32 -0400
commitb5eb255fae2158fde84def56b46fa6c5424f5b84 (patch)
tree70f194a2b29a7f583160c1cd1630bfb373b7cdc2
parent108cec80746510d7f622ad0506a7f3d2a734c3ae (diff)
parentfb32494de9b55663cec088ade6967da349c0cac7 (diff)
downloadayatana-indicator-session-b5eb255fae2158fde84def56b46fa6c5424f5b84.tar.gz
ayatana-indicator-session-b5eb255fae2158fde84def56b46fa6c5424f5b84.tar.bz2
ayatana-indicator-session-b5eb255fae2158fde84def56b46fa6c5424f5b84.zip
Import upstream version 0.3.1
-rw-r--r--ChangeLog144
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac4
-rw-r--r--src/Makefile.am3
-rw-r--r--src/Makefile.in3
-rw-r--r--src/apt-transaction.c2
-rw-r--r--src/apt-watcher.c20
-rw-r--r--src/device-menu-mgr.c211
-rw-r--r--src/device-menu-mgr.h2
-rw-r--r--src/dialog.c6
-rw-r--r--src/display-manager.xml9
-rw-r--r--src/gen-session-dbus.xml.c3
-rw-r--r--src/indicator-session.c5
-rw-r--r--src/sane-rules.h778
-rw-r--r--src/session-dbus.c22
-rw-r--r--src/session-dbus.h2
-rw-r--r--src/session-dbus.xml3
-rw-r--r--src/session-service.c24
-rw-r--r--src/udev-mgr.c420
-rw-r--r--src/udev-mgr.h19
-rw-r--r--src/user-menu-mgr.c20
-rw-r--r--src/users-service-dbus.c47
22 files changed, 1657 insertions, 110 deletions
diff --git a/ChangeLog b/ChangeLog
index bec896c..0de2e43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,149 @@
# Generated by Makefile. Do not edit.
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ bumped for new release
+
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ restart fix
+
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ add the restart to the shutdown dialog
+
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ updated the ignores
+
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ add the new greeter mode
+
+2011-08-03 Michael Terry <michael.terry@canonical.com>
+
+ when used in a greeter, don't show settings links, the user switcher, or log out links
+
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ printer support corrected
+
+2011-08-02 Michael Terry <michael.terry@canonical.com>
+
+ use correct printers command
+
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ merge the gudev work
+
+2011-08-09 Conor Curran <conor.curran@canonical.com>
+
+ segfault found and fixed
+
+2011-08-09 Conor Curran <conor.curran@canonical.com>
+
+ fixed memory leaks
+
+2011-08-05 Conor Curran <conor.curran@canonical.com>
+
+ cater for scsi type 3 and 6 devices
+
+2011-08-04 Conor Curran <conor.curran@canonical.com>
+
+ correct callbacks in place for scanners and webcams
+
+2011-08-04 Conor Curran <conor.curran@canonical.com>
+
+ trace around this seg fault
+
+2011-08-04 Conor Curran <conor.curran@canonical.com>
+
+ destroying hash tables in finalize
+
+2011-08-04 Conor Curran <conor.curran@canonical.com>
+
+ stop leaking tonnes of glists
+
+2011-08-04 Conor Curran <conor.curran@canonical.com>
+
+ duplicate key input error
+
+2011-08-04 Conor Curran <conor.curran@canonical.com>
+
+ add scsi scanner detection support
+
+2011-08-03 Conor Curran <conor.curran@canonical.com>
+
+ refactor of the udev mgr - working nicely
+
+2011-08-03 Conor Curran <conor.curran@canonical.com>
+
+ webcams working nicely
+
+2011-08-02 Conor Curran <conor.curran@canonical.com>
+
+ certain usb webcams sorted
+
+2011-08-01 Conor Curran <conor.curran@canonical.com>
+
+ usb scanners in place
+
+2011-08-01 Conor Curran <conor.curran@canonical.com>
+
+ usb scanner rules almost there
+
+2011-07-29 Conor Curran <conor.curran@canonical.com>
+
+ half way through those usb scanner udev rules
+
+2011-07-27 Conor Curran <conor.curran@canonical.com>
+
+ convenience method added to handle the insertion and startup detection of scanners
+
+2011-07-27 Conor Curran <conor.curran@canonical.com>
+
+ refactor with a more generic utility function
+
+2011-07-27 Conor Curran <conor.curran@canonical.com>
+
+ udev scanner detection working at startup
+
+2011-07-26 Conor Curran <conor.curran@canonical.com>
+
+ pattern established as to how to handle these sane rules
+
+2011-07-26 Conor Curran <conor.curran@canonical.com>
+
+ research trace for devices in udev
+
+2011-07-26 Conor Curran <conor.curran@canonical.com>
+
+ fixed gudev segfault
+
+2011-07-25 Conor Curran <conor.curran@canonical.com>
+
+ the beginnings of the udev work
+
+2011-08-10 Conor Curran <conor.curran@canonical.com>
+
+ merged the lightdb dbus changes and the apt restartrequired awareness
+
+2011-08-09 Conor Curran <conor.curran@canonical.com>
+
+ and the actual code
+
+2011-08-05 Conor Curran <conor.curran@canonical.com>
+
+ watch for the restart flag and change the menuitem's title
+
+2011-08-02 Michael Terry <michael.terry@canonical.com>
+
+ update to use LightDM's new interface
+
+2011-07-28 Michael Terry <michael.terry@canonical.com>
+
+ update interface with LightDM
+
2011-07-22 Conor Curran <conor.curran@canonical.com>
uncomment the disconnect method
diff --git a/configure b/configure
index 091054b..3477e77 100755
--- a/configure
+++ b/configure
@@ -2759,7 +2759,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-session
- VERSION=0.3.0
+ VERSION=0.3.1
cat >>confdefs.h <<_ACEOF
@@ -13155,11 +13155,13 @@ if test -n "$SESSIONSERVICE_CFLAGS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbusmenu-glib-0.4 >= \$DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= \$INDICATOR_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION") 2>&5
ac_status=$?
@@ -13168,6 +13170,7 @@ if test -n "$SESSIONSERVICE_CFLAGS"; then
pkg_cv_SESSIONSERVICE_CFLAGS=`$PKG_CONFIG --cflags "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
@@ -13184,11 +13187,13 @@ if test -n "$SESSIONSERVICE_LIBS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbusmenu-glib-0.4 >= \$DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= \$INDICATOR_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION") 2>&5
ac_status=$?
@@ -13197,6 +13202,7 @@ if test -n "$SESSIONSERVICE_LIBS"; then
pkg_cv_SESSIONSERVICE_LIBS=`$PKG_CONFIG --libs "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
@@ -13222,12 +13228,14 @@ fi
SESSIONSERVICE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>&1`
else
SESSIONSERVICE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>&1`
fi
@@ -13237,6 +13245,7 @@ fi
as_fn_error $? "Package requirements (dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION) were not met:
@@ -13283,11 +13292,13 @@ if test -n "$SESSIONSERVICE_CFLAGS"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbusmenu-glib-0.4 >= \$DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= \$INDICATOR_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION") 2>&5
@@ -13296,6 +13307,7 @@ if test -n "$SESSIONSERVICE_CFLAGS"; then
test $ac_status = 0; }; then
pkg_cv_SESSIONSERVICE_CFLAGS=`$PKG_CONFIG --cflags "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>/dev/null`
@@ -13312,11 +13324,13 @@ if test -n "$SESSIONSERVICE_LIBS"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbusmenu-glib-0.4 >= \$DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= \$INDICATOR_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION") 2>&5
@@ -13325,6 +13339,7 @@ if test -n "$SESSIONSERVICE_LIBS"; then
test $ac_status = 0; }; then
pkg_cv_SESSIONSERVICE_LIBS=`$PKG_CONFIG --libs "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>/dev/null`
@@ -13350,12 +13365,14 @@ fi
if test $_pkg_short_errors_supported = yes; then
SESSIONSERVICE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>&1`
else
SESSIONSERVICE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION" 2>&1`
@@ -13365,6 +13382,7 @@ fi
as_fn_error $? "Package requirements (dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION) were not met:
diff --git a/configure.ac b/configure.ac
index 369f12b..19cc4bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-session, 0.3.0)
+AM_INIT_AUTOMAKE(indicator-session, 0.3.1)
AM_MAINTAINER_MODE
@@ -58,12 +58,14 @@ AS_IF([test "x$with_gtk" = x3],
[PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
dbus-glib-1
+ gudev-1.0
gio-unix-2.0
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION)
],
[test "x$with_gtk" = x2],
[PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
+ gudev-1.0
dbus-glib-1
gio-unix-2.0
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION)
diff --git a/src/Makefile.am b/src/Makefile.am
index 83d12bb..36a1d1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,7 +101,8 @@ indicator_session_service_SOURCES = \
apt-transaction.h \
apt-transaction.c \
udev-mgr.h \
- udev-mgr.c
+ udev-mgr.c \
+ sane-rules.h
indicator_session_service_CFLAGS = \
$(SESSIONSERVICE_CFLAGS) \
$(GCONF_CFLAGS) \
diff --git a/src/Makefile.in b/src/Makefile.in
index 2ef9128..f70131c 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -352,7 +352,8 @@ indicator_session_service_SOURCES = \
apt-transaction.h \
apt-transaction.c \
udev-mgr.h \
- udev-mgr.c
+ udev-mgr.c \
+ sane-rules.h
indicator_session_service_CFLAGS = \
$(SESSIONSERVICE_CFLAGS) \
diff --git a/src/apt-transaction.c b/src/apt-transaction.c
index 78a0ff2..647f4ba 100644
--- a/src/apt-transaction.c
+++ b/src/apt-transaction.c
@@ -185,8 +185,6 @@ apt_transaction_receive_signal (GDBusProxy * proxy,
g_variant_get (value, "(asasasasasasas)", &install,
&reinstall, &remove, &purge, &upgrade, &downgrade,
&keep);
- //g_debug ("Seemed to uppack dependencies without any warnings");
- //g_debug ("Upgrade quantity : %u", g_strv_length(upgrade));
gboolean upgrade_needed = (g_strv_length(upgrade) > 0) ||
(g_strv_length(install) > 0) ||
(g_strv_length(reinstall) > 0) ||
diff --git a/src/apt-watcher.c b/src/apt-watcher.c
index 285eb81..72a63ac 100644
--- a/src/apt-watcher.c
+++ b/src/apt-watcher.c
@@ -266,11 +266,23 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans,
_("Updates Installing…"));
}
else if (state == FINISHED){
- dbusmenu_menuitem_property_set (self->apt_item,
- DBUSMENU_MENUITEM_PROP_LABEL,
- _("Software Up to Date"));
+ GVariant* reboot_result = g_dbus_proxy_get_cached_property (self->proxy,
+ "RebootRequired");
+ gboolean reboot;
+ g_variant_get (reboot_result, "b", &reboot);
+ if (reboot == FALSE){
+ dbusmenu_menuitem_property_set (self->apt_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Software Up to Date"));
+ }
+ else{
+ dbusmenu_menuitem_property_set (self->apt_item,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Reboot Required"));
+ session_dbus_restart_required (self->session_dbus_interface);
+ }
g_object_unref (G_OBJECT(self->current_transaction));
- self->current_transaction = NULL;
+ self->current_transaction = NULL;
}
self->current_state = state;
}
diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c
index 324b3f1..3223cf5 100644
--- a/src/device-menu-mgr.c
+++ b/src/device-menu-mgr.c
@@ -27,7 +27,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "lock-helper.h"
#include "upower-client.h"
#include "apt-watcher.h"
-
+#include "udev-mgr.h"
#define UP_ADDRESS "org.freedesktop.UPower"
#define UP_OBJECT "/org/freedesktop/UPower"
@@ -41,6 +41,7 @@ struct _DeviceMenuMgr
DbusmenuMenuitem* root_item;
SessionDbus* session_dbus_interface;
AptWatcher* apt_watcher;
+ UdevMgr* udev_mgr;
};
static GConfClient *gconf_client = NULL;
@@ -80,8 +81,15 @@ static void machine_sleep_with_context (DeviceMenuMgr* self,
gchar* type);
static void show_system_settings_with_context (DbusmenuMenuitem * mi,
guint timestamp,
- gchar * type);
-
+ gchar * type);
+
+static void device_menu_mgr_show_simple_scan (DbusmenuMenuitem * mi,
+ guint timestamp,
+ gchar * type);
+static void device_menu_mgr_show_cheese (DbusmenuMenuitem * mi,
+ guint timestamp,
+ gchar * type);
+
static void
machine_sleep_from_hibernate (DbusmenuMenuitem * mi,
guint timestamp,
@@ -214,7 +222,6 @@ machine_sleep_with_context (DeviceMenuMgr* self, gchar* type)
screensaver_throttle(type);
lock_if_possible (self);
-
dbus_g_proxy_begin_call(up_main_proxy,
type,
sleep_response,
@@ -441,6 +448,19 @@ show_session_properties (DbusmenuMenuitem * mi,
}
static void
+show_printer_properties (DbusmenuMenuitem * mi,
+ guint timestamp,
+ gchar * type)
+{
+ GError * error = NULL;
+ if (!g_spawn_command_line_async("system-config-printer", &error))
+ {
+ g_warning("Unable to show dialog: %s", error->message);
+ g_error_free(error);
+ }
+}
+
+static void
show_system_settings_with_context (DbusmenuMenuitem * mi,
guint timestamp,
gchar * type)
@@ -460,10 +480,46 @@ show_system_settings_with_context (DbusmenuMenuitem * mi,
g_free(control_centre_command);
}
+// TODO: refactor both of these down to the one method.
+static void device_menu_mgr_show_simple_scan (DbusmenuMenuitem * mi,
+ guint timestamp,
+ gchar * type)
+{
+ GError * error = NULL;
+ if (!g_spawn_command_line_async("simple-scan", &error))
+ {
+ g_warning("Unable to launch simple-scan: %s", error->message);
+ g_error_free(error);
+ if (!g_spawn_command_line_async("software-center simple-scan", &error))
+ {
+ g_warning ("Unable to launch software-centre simple-scan: %s",
+ error->message);
+ g_error_free(error);
+ }
+ }
+}
+
+static void device_menu_mgr_show_cheese (DbusmenuMenuitem * mi,
+ guint timestamp,
+ gchar * type)
+{
+ GError * error = NULL;
+ if (!g_spawn_command_line_async("cheese", &error))
+ {
+ g_warning("Unable to launch cheese: %s", error->message);
+ g_error_free(error);
+ if (!g_spawn_command_line_async("software-center cheese", &error))
+ {
+ g_warning ("Unable to launch software-centre cheese: %s",
+ error->message);
+ g_error_free(error);
+ }
+ }
+}
+
static void
-device_menu_mgr_build_static_items (DeviceMenuMgr* self)
+device_menu_mgr_build_settings_items (DeviceMenuMgr* self)
{
- // Static Setting items
system_settings_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (system_settings_menuitem,
DBUSMENU_MENUITEM_PROP_LABEL,
@@ -520,8 +576,11 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self)
DBUSMENU_MENUITEM_PROP_TYPE,
DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_add_position (self->root_item, separator1, 5);
+}
- // Devices control
+static void
+device_menu_mgr_build_devices_items (DeviceMenuMgr* self)
+{
DbusmenuMenuitem * device_heading = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (device_heading,
DBUSMENU_MENUITEM_PROP_LABEL,
@@ -539,7 +598,7 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self)
_("Printers"));
g_signal_connect (G_OBJECT(printers_menuitem),
DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
- G_CALLBACK(show_system_settings_with_context),
+ G_CALLBACK(show_printer_properties),
"printers");
dbusmenu_menuitem_child_add_position(self->root_item,
printers_menuitem,
@@ -547,15 +606,14 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self)
scanners_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (scanners_menuitem,
DBUSMENU_MENUITEM_PROP_LABEL,
- _("HP Scanners"));
+ _("Scanners"));
g_signal_connect (G_OBJECT(scanners_menuitem),
DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
- G_CALLBACK(show_system_settings_with_context),
- "scanners");
+ G_CALLBACK(device_menu_mgr_show_simple_scan),
+ NULL);
dbusmenu_menuitem_child_add_position (self->root_item,
scanners_menuitem,
8);
- //tmp
dbusmenu_menuitem_property_set_bool (scanners_menuitem,
DBUSMENU_MENUITEM_PROP_VISIBLE,
FALSE);
@@ -563,15 +621,14 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self)
webcam_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (webcam_menuitem,
DBUSMENU_MENUITEM_PROP_LABEL,
- _("HP Webcam"));
+ _("Webcam"));
g_signal_connect (G_OBJECT(webcam_menuitem),
DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
- G_CALLBACK(show_system_settings_with_context),
- "HP Webcam");
+ G_CALLBACK(device_menu_mgr_show_cheese),
+ NULL);
dbusmenu_menuitem_child_add_position (self->root_item,
webcam_menuitem,
10);
- //tmp
dbusmenu_menuitem_property_set_bool (webcam_menuitem,
DBUSMENU_MENUITEM_PROP_VISIBLE,
FALSE);
@@ -581,58 +638,74 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self)
DBUSMENU_MENUITEM_PROP_TYPE,
DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_add_position (self->root_item, separator3, 11);
-
+}
+
+static void
+device_menu_mgr_build_static_items (DeviceMenuMgr* self, gboolean greeter_mode)
+{
+ // Static Setting items
+ if (!greeter_mode) {
+ device_menu_mgr_build_settings_items (self);
+ }
+
+ // Devices control
+ if (!greeter_mode) {
+ device_menu_mgr_build_devices_items (self);
+ }
+
// Session control
- gboolean can_lockscreen;
-
- /* Make sure we have a valid GConf client, and build one
- if needed */
- device_menu_mgr_ensure_gconf_client (self);
- can_lockscreen = !gconf_client_get_bool ( gconf_client,
- LOCKDOWN_KEY_SCREENSAVER,
- NULL);
- /* Lock screen item */
- if (can_lockscreen) {
- lock_menuitem = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set (lock_menuitem,
- DBUSMENU_MENUITEM_PROP_LABEL,
- _("Lock Screen"));
+ if (!greeter_mode) {
+ gboolean can_lockscreen;
+
+ /* Make sure we have a valid GConf client, and build one
+ if needed */
+ device_menu_mgr_ensure_gconf_client (self);
+ can_lockscreen = !gconf_client_get_bool ( gconf_client,
+ LOCKDOWN_KEY_SCREENSAVER,
+ NULL);
+ /* Lock screen item */
+ if (can_lockscreen) {
+ lock_menuitem = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set (lock_menuitem,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Lock Screen"));
+
+ gchar * shortcut = gconf_client_get_string(gconf_client, KEY_LOCK_SCREEN, NULL);
+ if (shortcut != NULL) {
+ g_debug("Lock screen shortcut: %s", shortcut);
+ dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, shortcut);
+ g_free(shortcut);
+ }
+ else {
+ g_debug("Unable to get lock screen shortcut.");
+ }
+
+ g_signal_connect (G_OBJECT(lock_menuitem),
+ DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ G_CALLBACK(lock_screen), NULL);
+ dbusmenu_menuitem_child_append(self->root_item, lock_menuitem);
+ }
+
+ logout_mi = dbusmenu_menuitem_new();
- gchar * shortcut = gconf_client_get_string(gconf_client, KEY_LOCK_SCREEN, NULL);
- if (shortcut != NULL) {
- g_debug("Lock screen shortcut: %s", shortcut);
- dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, shortcut);
- g_free(shortcut);
+ if (supress_confirmations()) {
+ dbusmenu_menuitem_property_set (logout_mi,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Log Out"));
}
else {
- g_debug("Unable to get lock screen shortcut.");
+ dbusmenu_menuitem_property_set (logout_mi,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Log Out\342\200\246"));
}
-
- g_signal_connect (G_OBJECT(lock_menuitem),
+ dbusmenu_menuitem_property_set_bool (logout_mi,
+ DBUSMENU_MENUITEM_PROP_VISIBLE,
+ show_logout());
+ dbusmenu_menuitem_child_append(self->root_item, logout_mi);
+ g_signal_connect( G_OBJECT(logout_mi),
DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
- G_CALLBACK(lock_screen), NULL);
- dbusmenu_menuitem_child_append(self->root_item, lock_menuitem);
- }
-
- logout_mi = dbusmenu_menuitem_new();
-
- if (supress_confirmations()) {
- dbusmenu_menuitem_property_set (logout_mi,
- DBUSMENU_MENUITEM_PROP_LABEL,
- _("Log Out"));
- }
- else {
- dbusmenu_menuitem_property_set (logout_mi,
- DBUSMENU_MENUITEM_PROP_LABEL,
- _("Log Out\342\200\246"));
- }
- dbusmenu_menuitem_property_set_bool (logout_mi,
- DBUSMENU_MENUITEM_PROP_VISIBLE,
- show_logout());
- dbusmenu_menuitem_child_append(self->root_item, logout_mi);
- g_signal_connect( G_OBJECT(logout_mi),
- DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
- G_CALLBACK(show_dialog), "logout");
+ G_CALLBACK(show_dialog), "logout");
+ }
if (can_suspend && allow_suspend) {
suspend_mi = dbusmenu_menuitem_new();
@@ -681,7 +754,9 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self)
restart_shutdown_logout_mi->logout_mi = logout_mi;
restart_shutdown_logout_mi->shutdown_mi = shutdown_mi;
- update_menu_entries(restart_shutdown_logout_mi);
+ update_menu_entries(restart_shutdown_logout_mi);
+ // Time to create the udev mgr and hand it the static relevant items.
+ self->udev_mgr = udev_mgr_new (scanners_menuitem, webcam_menuitem);
}
@@ -787,12 +862,14 @@ device_mgr_get_root_item (DeviceMenuMgr* self)
/*
* Clean Entry Point
*/
-DeviceMenuMgr* device_menu_mgr_new (SessionDbus* session_dbus)
+DeviceMenuMgr* device_menu_mgr_new (SessionDbus* session_dbus, gboolean greeter_mode)
{
DeviceMenuMgr* device_mgr = g_object_new (DEVICE_TYPE_MENU_MGR, NULL);
device_mgr->session_dbus_interface = session_dbus;
- device_menu_mgr_build_static_items (device_mgr);
- device_mgr->apt_watcher = apt_watcher_new (session_dbus,
- software_updates_menuitem);
+ device_menu_mgr_build_static_items (device_mgr, greeter_mode);
+ if (software_updates_menuitem != NULL) {
+ device_mgr->apt_watcher = apt_watcher_new (session_dbus,
+ software_updates_menuitem);
+ }
return device_mgr;
}
diff --git a/src/device-menu-mgr.h b/src/device-menu-mgr.h
index 503b36a..d3c3a5a 100644
--- a/src/device-menu-mgr.h
+++ b/src/device-menu-mgr.h
@@ -44,7 +44,7 @@ struct _DeviceMenuMgrClass
GType device_menu_mgr_get_type (void) G_GNUC_CONST;
-DeviceMenuMgr* device_menu_mgr_new (SessionDbus* session_dbus);
+DeviceMenuMgr* device_menu_mgr_new (SessionDbus* session_dbus, gboolean greeter_mode);
DbusmenuMenuitem* device_mgr_get_root_item (DeviceMenuMgr* self);
diff --git a/src/dialog.c b/src/dialog.c
index d38f8bf..299f954 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -225,6 +225,12 @@ logout_dialog_new (LogoutDialogType type)
button_text, GTK_RESPONSE_OK,
NULL);
}
+
+ if (type == LOGOUT_DIALOG_TYPE_SHUTDOWN){
+ const gchar * restart_text;
+ restart_text = g_dpgettext2 (NULL, "button", button_strings[LOGOUT_DIALOG_TYPE_RESTART]);
+ gtk_dialog_add_button (GTK_DIALOG(dialog), restart_text, GTK_RESPONSE_HELP);
+ }
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
diff --git a/src/display-manager.xml b/src/display-manager.xml
index 004eca1..92f5e05 100644
--- a/src/display-manager.xml
+++ b/src/display-manager.xml
@@ -1,17 +1,20 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
- <interface name="org.freedesktop.DisplayManager">
+ <interface name="org.freedesktop.DisplayManager.Seat">
<!-- Show greeter to allow new login / switch users -->
- <method name="ShowGreeter"/>
+ <method name="SwitchToGreeter"/>
<!-- Switch to a user, starting a new display if required -->
<method name="SwitchToUser">
<arg name="username" direction="in" type="s"/>
+ <arg name="session" direction="in" type="s"/>
</method>
<!-- Switch to the guest user -->
- <method name="SwitchToGuest"/>
+ <method name="SwitchToGuest">
+ <arg name="session" direction="in" type="s"/>
+ </method>
</interface>
</node>
diff --git a/src/gen-session-dbus.xml.c b/src/gen-session-dbus.xml.c
index a945ca7..319f203 100644
--- a/src/gen-session-dbus.xml.c
+++ b/src/gen-session-dbus.xml.c
@@ -18,8 +18,7 @@ const char * _session_dbus =
" <signal name=\"UserMenuIsVisible\">\n"
" <arg name=\"update\" type=\"b\"/>\n"
" </signal>\n"
-" <signal name=\"RestartNeeded\">\n"
-" <arg name=\"name\" type=\"s\"/>\n"
+" <signal name=\"RestartRequired\">\n"
" </signal>\n"
" </interface>\n"
"</node>\n"
diff --git a/src/indicator-session.c b/src/indicator-session.c
index d7155f6..bfe0b75 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -491,6 +491,7 @@ receive_signal (GDBusProxy * proxy,
g_signal_emit_by_name ((gpointer)self,
"entry-added",
&self->users);
+
}
else{
g_signal_emit_by_name ((gpointer)self,
@@ -498,6 +499,10 @@ receive_signal (GDBusProxy * proxy,
&self->users);
}
}
+ else if (g_strcmp0(signal_name, "RebootRequired") == 0) {
+ // TODO waiting on design to give me a name.
+ self->devices.image = indicator_image_helper (ICON_DEFAULT);
+ }
}
diff --git a/src/sane-rules.h b/src/sane-rules.h
new file mode 100644
index 0000000..0b72e52
--- /dev/null
+++ b/src/sane-rules.h
@@ -0,0 +1,778 @@
+void populate_scsi_scanners (GHashTable* scanners)
+{
+ GList* epson = NULL;
+ epson = g_list_append (epson, g_strdup ("GT-9700"));
+ epson = g_list_append (epson, g_strdup ("GT-9800"));
+ epson = g_list_append (epson, g_strdup ("Perfection1200"));
+ epson = g_list_append (epson, g_strdup ("Perfection636"));
+ epson = g_list_append (epson, g_strdup ("SCANNER GT-7000"));
+ g_hash_table_insert (scanners,
+ g_strdup("EPSON"),
+ epson);
+
+
+ GList* hp = NULL;
+ hp = g_list_append (hp, g_strdup ("C1130A"));
+ hp = g_list_append (hp, g_strdup ("C1750A"));
+ hp = g_list_append (hp, g_strdup ("C1790A"));
+ hp = g_list_append (hp, g_strdup ("C2500A"));
+ hp = g_list_append (hp, g_strdup ("C2520A"));
+ hp = g_list_append (hp, g_strdup ("C5110A"));
+ hp = g_list_append (hp, g_strdup ("C6270A"));
+ hp = g_list_append (hp, g_strdup ("C7670A"));
+ g_hash_table_insert (scanners,
+ g_strdup("HP"),
+ hp);
+}
+
+
+
+void populate_usb_scanners (GHashTable* scanners)
+{
+ GList* hp = NULL;
+
+ hp = g_list_append (hp, g_strdup ("0101"));
+ hp = g_list_append (hp, g_strdup ("0105"));
+ hp = g_list_append (hp, g_strdup ("0201"));
+ hp = g_list_append (hp, g_strdup ("0205"));
+ hp = g_list_append (hp, g_strdup ("0305"));
+ hp = g_list_append (hp, g_strdup ("0401"));
+ hp = g_list_append (hp, g_strdup ("0405"));
+ hp = g_list_append (hp, g_strdup ("0505"));
+ hp = g_list_append (hp, g_strdup ("0601"));
+ hp = g_list_append (hp, g_strdup ("0605"));
+ hp = g_list_append (hp, g_strdup ("0701"));
+ hp = g_list_append (hp, g_strdup ("0705"));
+ hp = g_list_append (hp, g_strdup ("0801"));
+ hp = g_list_append (hp, g_strdup ("0805"));
+ hp = g_list_append (hp, g_strdup ("0901"));
+ hp = g_list_append (hp, g_strdup ("0a01"));
+ hp = g_list_append (hp, g_strdup ("0b01"));
+ hp = g_list_append (hp, g_strdup ("1005"));
+ hp = g_list_append (hp, g_strdup ("1105"));
+ hp = g_list_append (hp, g_strdup ("1205"));
+ hp = g_list_append (hp, g_strdup ("1305"));
+ hp = g_list_append (hp, g_strdup ("1405"));
+ hp = g_list_append (hp, g_strdup ("1705"));
+ hp = g_list_append (hp, g_strdup ("1805"));
+ hp = g_list_append (hp, g_strdup ("2005"));
+ hp = g_list_append (hp, g_strdup ("2205"));
+ hp = g_list_append (hp, g_strdup ("2305"));
+ hp = g_list_append (hp, g_strdup ("2405"));
+ hp = g_list_append (hp, g_strdup ("2605"));
+ hp = g_list_append (hp, g_strdup ("2805"));
+ hp = g_list_append (hp, g_strdup ("3805"));
+ hp = g_list_append (hp, g_strdup ("3905"));
+ hp = g_list_append (hp, g_strdup ("3B17"));
+ hp = g_list_append (hp, g_strdup ("4105"));
+ hp = g_list_append (hp, g_strdup ("4205"));
+ hp = g_list_append (hp, g_strdup ("4305"));
+ hp = g_list_append (hp, g_strdup ("4505"));
+ hp = g_list_append (hp, g_strdup ("4605"));
+ hp = g_list_append (hp, g_strdup ("5617"));
+ hp = g_list_append (hp, g_strdup ("5717"));
+
+ g_hash_table_insert (scanners,
+ g_strdup("03f0"),
+ hp);
+
+ GList* mustek_2 = NULL;
+ mustek_2 = g_list_append (mustek_2, g_strdup ("1000"));
+ mustek_2 = g_list_append (mustek_2, g_strdup ("1001"));
+ g_hash_table_insert (scanners,
+ g_strdup("0400"),
+ mustek_2);
+
+ GList* kodak = NULL;
+ kodak = g_list_append (kodak, g_strdup ("6001"));
+ kodak = g_list_append (kodak, g_strdup ("6002"));
+ kodak = g_list_append (kodak, g_strdup ("6003"));
+ kodak = g_list_append (kodak, g_strdup ("6004"));
+ kodak = g_list_append (kodak, g_strdup ("6005"));
+ g_hash_table_insert (scanners,
+ g_strdup("040a"),
+ kodak);
+
+ GList* creative = NULL;
+
+ creative = g_list_append (creative, g_strdup ("4007"));
+
+ g_hash_table_insert (scanners,
+ g_strdup("041e"),
+ creative);
+
+ GList* lexmark = NULL;
+
+ lexmark = g_list_append (lexmark, g_strdup("002d"));
+ lexmark = g_list_append (lexmark, g_strdup("0060"));
+ lexmark = g_list_append (lexmark, g_strdup("007c"));
+ lexmark = g_list_append (lexmark, g_strdup("007d"));
+
+ g_hash_table_insert (scanners,
+ g_strdup("043d"),
+ lexmark);
+
+
+ GList* genius = NULL;
+ genius = g_list_append (genius, g_strdup("2004"));
+ genius = g_list_append (genius, g_strdup("2007"));
+ genius = g_list_append (genius, g_strdup("2008"));
+ genius = g_list_append (genius, g_strdup("2009"));
+ genius = g_list_append (genius, g_strdup("2011"));
+ genius = g_list_append (genius, g_strdup("2013"));
+ genius = g_list_append (genius, g_strdup("2014"));
+ genius = g_list_append (genius, g_strdup("2015"));
+ genius = g_list_append (genius, g_strdup("2016"));
+ genius = g_list_append (genius, g_strdup("2017"));
+ genius = g_list_append (genius, g_strdup("201a"));
+ genius = g_list_append (genius, g_strdup("201b"));
+ genius = g_list_append (genius, g_strdup("201d"));
+ genius = g_list_append (genius, g_strdup("201e"));
+ genius = g_list_append (genius, g_strdup("201f"));
+ genius = g_list_append (genius, g_strdup("20c1"));
+ g_hash_table_insert (scanners,
+ g_strdup("0458"),
+ genius);
+
+ GList* medion = NULL;
+ medion = g_list_append (medion, g_strdup("0377"));
+ g_hash_table_insert (scanners,
+ g_strdup("0461"),
+ medion);
+
+ GList* trust = NULL;
+ trust = g_list_append (trust, g_strdup("1000"));
+ trust = g_list_append (trust, g_strdup("1002"));
+ g_hash_table_insert (scanners,
+ g_strdup("047b"),
+ trust);
+
+ GList* kyocera = NULL;
+ kyocera = g_list_append (kyocera, g_strdup("0335"));
+ g_hash_table_insert (scanners,
+ g_strdup("0482"),
+ kyocera);
+
+ GList* compaq = NULL;
+ compaq = g_list_append (compaq, g_strdup("001a"));
+ g_hash_table_insert (scanners,
+ g_strdup("049f"),
+ compaq);
+ GList* benq = NULL;
+ benq = g_list_append (benq, g_strdup("1a20"));
+ benq = g_list_append (benq, g_strdup("1a2a"));
+ benq = g_list_append (benq, g_strdup("2022"));
+ benq = g_list_append (benq, g_strdup("2040"));
+ benq = g_list_append (benq, g_strdup("2060"));
+ benq = g_list_append (benq, g_strdup("207e"));
+ benq = g_list_append (benq, g_strdup("20b0"));
+ benq = g_list_append (benq, g_strdup("20be"));
+ benq = g_list_append (benq, g_strdup("20c0"));
+ benq = g_list_append (benq, g_strdup("20de"));
+ benq = g_list_append (benq, g_strdup("20f8"));
+ benq = g_list_append (benq, g_strdup("20fc"));
+ benq = g_list_append (benq, g_strdup("20fe"));
+ benq = g_list_append (benq, g_strdup("2137"));
+ benq = g_list_append (benq, g_strdup("2211"));
+ g_hash_table_insert (scanners,
+ g_strdup("04a5"),
+ benq);
+
+ GList* visioneer = NULL;
+ visioneer = g_list_append (visioneer, g_strdup("0229"));
+ visioneer = g_list_append (visioneer, g_strdup("0390"));
+ visioneer = g_list_append (visioneer, g_strdup("0420"));
+ visioneer = g_list_append (visioneer, g_strdup("0421"));
+ visioneer = g_list_append (visioneer, g_strdup("0422"));
+ visioneer = g_list_append (visioneer, g_strdup("0423"));
+ visioneer = g_list_append (visioneer, g_strdup("0424"));
+ visioneer = g_list_append (visioneer, g_strdup("0426"));
+ visioneer = g_list_append (visioneer, g_strdup("0427"));
+ visioneer = g_list_append (visioneer, g_strdup("0444"));
+ visioneer = g_list_append (visioneer, g_strdup("0446"));
+ visioneer = g_list_append (visioneer, g_strdup("0447"));
+ visioneer = g_list_append (visioneer, g_strdup("0448"));
+ visioneer = g_list_append (visioneer, g_strdup("0449"));
+ visioneer = g_list_append (visioneer, g_strdup("044c"));
+ visioneer = g_list_append (visioneer, g_strdup("0474"));
+ visioneer = g_list_append (visioneer, g_strdup("0475"));
+ visioneer = g_list_append (visioneer, g_strdup("0477"));
+ visioneer = g_list_append (visioneer, g_strdup("0478"));
+ visioneer = g_list_append (visioneer, g_strdup("0479"));
+ visioneer = g_list_append (visioneer, g_strdup("047a"));
+ visioneer = g_list_append (visioneer, g_strdup("047b"));
+ visioneer = g_list_append (visioneer, g_strdup("047c"));
+ visioneer = g_list_append (visioneer, g_strdup("048c"));
+ visioneer = g_list_append (visioneer, g_strdup("048d"));
+ visioneer = g_list_append (visioneer, g_strdup("048e"));
+ visioneer = g_list_append (visioneer, g_strdup("048f"));
+ visioneer = g_list_append (visioneer, g_strdup("0490"));
+ visioneer = g_list_append (visioneer, g_strdup("0491"));
+ visioneer = g_list_append (visioneer, g_strdup("0492"));
+ visioneer = g_list_append (visioneer, g_strdup("0493"));
+ visioneer = g_list_append (visioneer, g_strdup("0494"));
+ visioneer = g_list_append (visioneer, g_strdup("0495"));
+ visioneer = g_list_append (visioneer, g_strdup("0497"));
+ visioneer = g_list_append (visioneer, g_strdup("0498"));
+ visioneer = g_list_append (visioneer, g_strdup("0499"));
+ visioneer = g_list_append (visioneer, g_strdup("049a"));
+ visioneer = g_list_append (visioneer, g_strdup("049b"));
+ visioneer = g_list_append (visioneer, g_strdup("049c"));
+ visioneer = g_list_append (visioneer, g_strdup("049d"));
+ visioneer = g_list_append (visioneer, g_strdup("04a7"));
+ visioneer = g_list_append (visioneer, g_strdup("04ac"));
+ g_hash_table_insert (scanners,
+ g_strdup("04a7"),
+ visioneer);
+ GList* canon = NULL;
+ canon = g_list_append (canon, g_strdup("1601"));
+ canon = g_list_append (canon, g_strdup("1602"));
+ canon = g_list_append (canon, g_strdup("1603"));
+ canon = g_list_append (canon, g_strdup("1604"));
+ canon = g_list_append (canon, g_strdup("1606"));
+ canon = g_list_append (canon, g_strdup("1607"));
+ canon = g_list_append (canon, g_strdup("1608"));
+ canon = g_list_append (canon, g_strdup("1609"));
+ canon = g_list_append (canon, g_strdup("160a"));
+ canon = g_list_append (canon, g_strdup("160b"));
+ canon = g_list_append (canon, g_strdup("1706"));
+ canon = g_list_append (canon, g_strdup("1707"));
+ canon = g_list_append (canon, g_strdup("1708"));
+ canon = g_list_append (canon, g_strdup("1709"));
+ canon = g_list_append (canon, g_strdup("170a"));
+ canon = g_list_append (canon, g_strdup("170b"));
+ canon = g_list_append (canon, g_strdup("170c"));
+ canon = g_list_append (canon, g_strdup("170d"));
+ canon = g_list_append (canon, g_strdup("170e"));
+ canon = g_list_append (canon, g_strdup("1712"));
+ canon = g_list_append (canon, g_strdup("1713"));
+ canon = g_list_append (canon, g_strdup("1714"));
+ canon = g_list_append (canon, g_strdup("1715"));
+ canon = g_list_append (canon, g_strdup("1716"));
+ canon = g_list_append (canon, g_strdup("1717"));
+ canon = g_list_append (canon, g_strdup("1718"));
+ canon = g_list_append (canon, g_strdup("1719"));
+ canon = g_list_append (canon, g_strdup("171a"));
+ canon = g_list_append (canon, g_strdup("171b"));
+ canon = g_list_append (canon, g_strdup("171c"));
+ canon = g_list_append (canon, g_strdup("1721"));
+ canon = g_list_append (canon, g_strdup("1722"));
+ canon = g_list_append (canon, g_strdup("1723"));
+ canon = g_list_append (canon, g_strdup("1724"));
+ canon = g_list_append (canon, g_strdup("1725"));
+ canon = g_list_append (canon, g_strdup("1726"));
+ canon = g_list_append (canon, g_strdup("1727"));
+ canon = g_list_append (canon, g_strdup("1728"));
+ canon = g_list_append (canon, g_strdup("1729"));
+ canon = g_list_append (canon, g_strdup("172b"));
+ canon = g_list_append (canon, g_strdup("172c"));
+ canon = g_list_append (canon, g_strdup("172d"));
+ canon = g_list_append (canon, g_strdup("172e"));
+ canon = g_list_append (canon, g_strdup("172f"));
+ canon = g_list_append (canon, g_strdup("1730"));
+ canon = g_list_append (canon, g_strdup("1731"));
+ canon = g_list_append (canon, g_strdup("1732"));
+ canon = g_list_append (canon, g_strdup("1733"));
+ canon = g_list_append (canon, g_strdup("1734"));
+ canon = g_list_append (canon, g_strdup("1735"));
+ canon = g_list_append (canon, g_strdup("1736"));
+ canon = g_list_append (canon, g_strdup("173a"));
+ canon = g_list_append (canon, g_strdup("173b"));
+ canon = g_list_append (canon, g_strdup("173c"));
+ canon = g_list_append (canon, g_strdup("173d"));
+ canon = g_list_append (canon, g_strdup("173e"));
+ canon = g_list_append (canon, g_strdup("173f"));
+ canon = g_list_append (canon, g_strdup("1740"));
+ canon = g_list_append (canon, g_strdup("1741"));
+ canon = g_list_append (canon, g_strdup("1742"));
+ canon = g_list_append (canon, g_strdup("1901"));
+ canon = g_list_append (canon, g_strdup("1904"));
+ canon = g_list_append (canon, g_strdup("1905"));
+ canon = g_list_append (canon, g_strdup("1909"));
+ canon = g_list_append (canon, g_strdup("190a"));
+ canon = g_list_append (canon, g_strdup("2204"));
+ canon = g_list_append (canon, g_strdup("2206"));
+ canon = g_list_append (canon, g_strdup("2207"));
+ canon = g_list_append (canon, g_strdup("2208"));
+ canon = g_list_append (canon, g_strdup("220d"));
+ canon = g_list_append (canon, g_strdup("220e"));
+ canon = g_list_append (canon, g_strdup("2213"));
+ canon = g_list_append (canon, g_strdup("221c"));
+ canon = g_list_append (canon, g_strdup("2220"));
+ canon = g_list_append (canon, g_strdup("2222"));
+ canon = g_list_append (canon, g_strdup("262f"));
+ canon = g_list_append (canon, g_strdup("2630"));
+ canon = g_list_append (canon, g_strdup("263c"));
+ canon = g_list_append (canon, g_strdup("263d"));
+ canon = g_list_append (canon, g_strdup("263e"));
+ canon = g_list_append (canon, g_strdup("263f"));
+ canon = g_list_append (canon, g_strdup("264c"));
+ canon = g_list_append (canon, g_strdup("264d"));
+ canon = g_list_append (canon, g_strdup("264e"));
+ canon = g_list_append (canon, g_strdup("264f"));
+ canon = g_list_append (canon, g_strdup("2659"));
+ canon = g_list_append (canon, g_strdup("265d"));
+ canon = g_list_append (canon, g_strdup("265e"));
+ canon = g_list_append (canon, g_strdup("265f"));
+ canon = g_list_append (canon, g_strdup("2660"));
+ canon = g_list_append (canon, g_strdup("2684"));
+ canon = g_list_append (canon, g_strdup("2686"));
+ canon = g_list_append (canon, g_strdup("26a3"));
+ canon = g_list_append (canon, g_strdup("26b0"));
+ canon = g_list_append (canon, g_strdup("26b4"));
+ canon = g_list_append (canon, g_strdup("26b5"));
+ canon = g_list_append (canon, g_strdup("26ec"));
+ canon = g_list_append (canon, g_strdup("26ed"));
+ canon = g_list_append (canon, g_strdup("26ee"));
+ g_hash_table_insert (scanners,
+ g_strdup("04a9"),
+ canon);
+
+ GList* nikon = NULL;
+ nikon = g_list_append (nikon, g_strdup ("4000"));
+ nikon = g_list_append (nikon, g_strdup ("4001"));
+ nikon = g_list_append (nikon, g_strdup ("4002"));
+ g_hash_table_insert (scanners,
+ g_strdup("04b0"),
+ nikon);
+
+ GList* epson = NULL;
+
+ // for testing (its a printer not a scanner!)
+ //epson = g_list_append (epson, g_strdup ("0001"));
+
+ epson = g_list_append (epson, g_strdup("0101"));
+ epson = g_list_append (epson, g_strdup("0103"));
+ epson = g_list_append (epson, g_strdup("0104"));
+ epson = g_list_append (epson, g_strdup("0105"));
+ epson = g_list_append (epson, g_strdup("0106"));
+ epson = g_list_append (epson, g_strdup("0107"));
+ epson = g_list_append (epson, g_strdup("0109"));
+ epson = g_list_append (epson, g_strdup("010a"));
+ epson = g_list_append (epson, g_strdup("010b"));
+ epson = g_list_append (epson, g_strdup("010c"));
+ epson = g_list_append (epson, g_strdup("010e"));
+ epson = g_list_append (epson, g_strdup("010f"));
+ epson = g_list_append (epson, g_strdup("0110"));
+ epson = g_list_append (epson, g_strdup("0112"));
+ epson = g_list_append (epson, g_strdup("0114"));
+ epson = g_list_append (epson, g_strdup("011b"));
+ epson = g_list_append (epson, g_strdup("011c"));
+ epson = g_list_append (epson, g_strdup("011d"));
+ epson = g_list_append (epson, g_strdup("011e"));
+ epson = g_list_append (epson, g_strdup("011f"));
+ epson = g_list_append (epson, g_strdup("0120"));
+ epson = g_list_append (epson, g_strdup("0121"));
+ epson = g_list_append (epson, g_strdup("0122"));
+ epson = g_list_append (epson, g_strdup("0126"));
+ epson = g_list_append (epson, g_strdup("0128"));
+ epson = g_list_append (epson, g_strdup("0129"));
+ epson = g_list_append (epson, g_strdup("012a"));
+ epson = g_list_append (epson, g_strdup("012b"));
+ epson = g_list_append (epson, g_strdup("012c"));
+ epson = g_list_append (epson, g_strdup("0135"));
+ epson = g_list_append (epson, g_strdup("0801"));
+ epson = g_list_append (epson, g_strdup("0802"));
+ epson = g_list_append (epson, g_strdup("0805"));
+ epson = g_list_append (epson, g_strdup("0806"));
+ epson = g_list_append (epson, g_strdup("0807"));
+ epson = g_list_append (epson, g_strdup("0808"));
+ epson = g_list_append (epson, g_strdup("080c"));
+ epson = g_list_append (epson, g_strdup("080d"));
+ epson = g_list_append (epson, g_strdup("080e"));
+ epson = g_list_append (epson, g_strdup("080f"));
+ epson = g_list_append (epson, g_strdup("0810"));
+ epson = g_list_append (epson, g_strdup("0811"));
+ epson = g_list_append (epson, g_strdup("0813"));
+ epson = g_list_append (epson, g_strdup("0814"));
+ epson = g_list_append (epson, g_strdup("0815"));
+ epson = g_list_append (epson, g_strdup("0817"));
+ epson = g_list_append (epson, g_strdup("0818"));
+ epson = g_list_append (epson, g_strdup("0819"));
+ epson = g_list_append (epson, g_strdup("081a"));
+ epson = g_list_append (epson, g_strdup("081c"));
+ epson = g_list_append (epson, g_strdup("081d"));
+ epson = g_list_append (epson, g_strdup("081f"));
+ epson = g_list_append (epson, g_strdup("0820"));
+ epson = g_list_append (epson, g_strdup("0827"));
+ epson = g_list_append (epson, g_strdup("0828"));
+ epson = g_list_append (epson, g_strdup("0829"));
+ epson = g_list_append (epson, g_strdup("082a"));
+ epson = g_list_append (epson, g_strdup("082b"));
+ epson = g_list_append (epson, g_strdup("082e"));
+ epson = g_list_append (epson, g_strdup("082f"));
+ epson = g_list_append (epson, g_strdup("0830"));
+ epson = g_list_append (epson, g_strdup("0833"));
+ epson = g_list_append (epson, g_strdup("0834"));
+ epson = g_list_append (epson, g_strdup("0835"));
+ epson = g_list_append (epson, g_strdup("0836"));
+ epson = g_list_append (epson, g_strdup("0837"));
+ epson = g_list_append (epson, g_strdup("0838"));
+ epson = g_list_append (epson, g_strdup("0839"));
+ epson = g_list_append (epson, g_strdup("083a"));
+ epson = g_list_append (epson, g_strdup("083c"));
+ epson = g_list_append (epson, g_strdup("0841"));
+ epson = g_list_append (epson, g_strdup("0843"));
+ epson = g_list_append (epson, g_strdup("0844"));
+ epson = g_list_append (epson, g_strdup("0846"));
+ epson = g_list_append (epson, g_strdup("0847"));
+ epson = g_list_append (epson, g_strdup("0848"));
+ epson = g_list_append (epson, g_strdup("0849"));
+ epson = g_list_append (epson, g_strdup("084a"));
+ epson = g_list_append (epson, g_strdup("084c"));
+ epson = g_list_append (epson, g_strdup("084d"));
+ epson = g_list_append (epson, g_strdup("084f"));
+ epson = g_list_append (epson, g_strdup("0851"));
+ epson = g_list_append (epson, g_strdup("0854"));
+ epson = g_list_append (epson, g_strdup("0856"));
+ g_hash_table_insert (scanners,
+ g_strdup("04b8"),
+ epson);
+
+ GList* fujitsu = NULL;
+ fujitsu = g_list_append (fujitsu, g_strdup ("1029"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1041"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1042"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1078"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1095"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1096"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1097"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10ad"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10ae"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10af"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10c7"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10cf"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10e0"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10e1"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10e2"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10e6"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10e7"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10ef"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10f2"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("10fe"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1135"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("114a"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("114d"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("114e"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("114f"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1150"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1155"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1156"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("116f"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1174"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1175"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1176"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1177"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("1178"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("117f"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("119d"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("119e"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("119f"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11a0"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11a2"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11ed"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11ee"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11ef"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11f1"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11f2"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11f3"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11f4"));
+ fujitsu = g_list_append (fujitsu, g_strdup ("11fc"));
+ g_hash_table_insert (scanners,
+ g_strdup("04c5"),
+ fujitsu);
+ GList* konica = NULL;
+ konica = g_list_append (konica, g_strdup ("0722"));
+ g_hash_table_insert (scanners,
+ g_strdup("04c8"),
+ konica);
+ GList* panasonic = NULL;
+ panasonic = g_list_append (panasonic, g_strdup ("1000"));
+ panasonic = g_list_append (panasonic, g_strdup ("1001"));
+ panasonic = g_list_append (panasonic, g_strdup ("1006"));
+ panasonic = g_list_append (panasonic, g_strdup ("1007"));
+ panasonic = g_list_append (panasonic, g_strdup ("1009"));
+ panasonic = g_list_append (panasonic, g_strdup ("100a"));
+ panasonic = g_list_append (panasonic, g_strdup ("100f"));
+ panasonic = g_list_append (panasonic, g_strdup ("1010"));
+ g_hash_table_insert (scanners,
+ g_strdup("04da"),
+ panasonic);
+
+ GList* samsung = NULL;
+
+ samsung = g_list_append (samsung, g_strdup ("341b"));
+ samsung = g_list_append (samsung, g_strdup ("341f"));
+ samsung = g_list_append (samsung, g_strdup ("3426"));
+ samsung = g_list_append (samsung, g_strdup ("342a"));
+ samsung = g_list_append (samsung, g_strdup ("342b"));
+ samsung = g_list_append (samsung, g_strdup ("342c"));
+ samsung = g_list_append (samsung, g_strdup ("3433"));
+ samsung = g_list_append (samsung, g_strdup ("3434"));
+ samsung = g_list_append (samsung, g_strdup ("343c"));
+ samsung = g_list_append (samsung, g_strdup ("3434"));
+ g_hash_table_insert (scanners,
+ g_strdup("04e8"),
+ samsung);
+
+ GList* pentax = NULL;
+ pentax = g_list_append (pentax, g_strdup ("2038"));
+ g_hash_table_insert (scanners,
+ g_strdup("04f9"),
+ pentax);
+
+ GList* apitek = NULL;
+ apitek = g_list_append (apitek, g_strdup ("0202"));
+ g_hash_table_insert (scanners,
+ g_strdup("0553"),
+ apitek);
+
+ GList* mustek = NULL;
+ mustek = g_list_append (mustek, g_strdup ("0001"));
+ mustek = g_list_append (mustek, g_strdup ("0002"));
+ mustek = g_list_append (mustek, g_strdup ("0006"));
+ mustek = g_list_append (mustek, g_strdup ("0008"));
+ mustek = g_list_append (mustek, g_strdup ("0010"));
+ mustek = g_list_append (mustek, g_strdup ("0210"));
+ mustek = g_list_append (mustek, g_strdup ("0218"));
+ mustek = g_list_append (mustek, g_strdup ("0219"));
+ mustek = g_list_append (mustek, g_strdup ("021a"));
+ mustek = g_list_append (mustek, g_strdup ("021b"));
+ mustek = g_list_append (mustek, g_strdup ("021c"));
+ mustek = g_list_append (mustek, g_strdup ("021d"));
+ mustek = g_list_append (mustek, g_strdup ("021e"));
+ mustek = g_list_append (mustek, g_strdup ("021f"));
+ mustek = g_list_append (mustek, g_strdup ("0409"));
+ g_hash_table_insert (scanners,
+ g_strdup("055f"),
+ mustek);
+ GList* artec = NULL;
+ artec = g_list_append (artec, g_strdup ("4002"));
+ artec = g_list_append (artec, g_strdup ("4003"));
+ artec = g_list_append (artec, g_strdup ("4004"));
+ artec = g_list_append (artec, g_strdup ("4005"));
+ artec = g_list_append (artec, g_strdup ("4006"));
+ artec = g_list_append (artec, g_strdup ("4007"));
+ artec = g_list_append (artec, g_strdup ("4009"));
+ artec = g_list_append (artec, g_strdup ("4010"));
+ artec = g_list_append (artec, g_strdup ("4011"));
+ g_hash_table_insert (scanners,
+ g_strdup("05d8"),
+ artec);
+
+ GList* microtek = NULL;
+ microtek = g_list_append (microtek, g_strdup ("0099"));
+ microtek = g_list_append (microtek, g_strdup ("009a"));
+ microtek = g_list_append (microtek, g_strdup ("00a3"));
+ microtek = g_list_append (microtek, g_strdup ("00b6"));
+ microtek = g_list_append (microtek, g_strdup ("30cf"));
+ microtek = g_list_append (microtek, g_strdup ("30d4"));
+ microtek = g_list_append (microtek, g_strdup ("40b3"));
+ microtek = g_list_append (microtek, g_strdup ("40b8"));
+ microtek = g_list_append (microtek, g_strdup ("40ca"));
+ microtek = g_list_append (microtek, g_strdup ("40cb"));
+ microtek = g_list_append (microtek, g_strdup ("40dd"));
+ microtek = g_list_append (microtek, g_strdup ("40ff"));
+ microtek = g_list_append (microtek, g_strdup ("80a3"));
+ g_hash_table_insert (scanners,
+ g_strdup("05da"),
+ microtek);
+
+ GList* avision = NULL;
+ avision = g_list_append (avision, g_strdup ("0268"));
+ avision = g_list_append (avision, g_strdup ("026a"));
+ avision = g_list_append (avision, g_strdup ("0a13"));
+ avision = g_list_append (avision, g_strdup ("0a15"));
+ avision = g_list_append (avision, g_strdup ("0a16"));
+ avision = g_list_append (avision, g_strdup ("0a18"));
+ avision = g_list_append (avision, g_strdup ("0a19"));
+ avision = g_list_append (avision, g_strdup ("0a23"));
+ avision = g_list_append (avision, g_strdup ("0a24"));
+ avision = g_list_append (avision, g_strdup ("0a25"));
+ avision = g_list_append (avision, g_strdup ("0a27"));
+ avision = g_list_append (avision, g_strdup ("0a2a"));
+ avision = g_list_append (avision, g_strdup ("0a2b"));
+ avision = g_list_append (avision, g_strdup ("0a2c"));
+ avision = g_list_append (avision, g_strdup ("0a2d"));
+ avision = g_list_append (avision, g_strdup ("0a2e"));
+ avision = g_list_append (avision, g_strdup ("0a2f"));
+ avision = g_list_append (avision, g_strdup ("0a33"));
+ avision = g_list_append (avision, g_strdup ("0a3a"));
+ avision = g_list_append (avision, g_strdup ("0a3c"));
+ avision = g_list_append (avision, g_strdup ("0a40"));
+ avision = g_list_append (avision, g_strdup ("0a41"));
+ avision = g_list_append (avision, g_strdup ("0a45"));
+ avision = g_list_append (avision, g_strdup ("0a4d"));
+ avision = g_list_append (avision, g_strdup ("0a4e"));
+ avision = g_list_append (avision, g_strdup ("0a4f"));
+ avision = g_list_append (avision, g_strdup ("0a5e"));
+ avision = g_list_append (avision, g_strdup ("0a61"));
+ avision = g_list_append (avision, g_strdup ("0a65"));
+ avision = g_list_append (avision, g_strdup ("0a66"));
+ avision = g_list_append (avision, g_strdup ("0a68"));
+ avision = g_list_append (avision, g_strdup ("0a82"));
+ avision = g_list_append (avision, g_strdup ("0a84"));
+ avision = g_list_append (avision, g_strdup ("0a93"));
+ avision = g_list_append (avision, g_strdup ("0a94"));
+ avision = g_list_append (avision, g_strdup ("0aa1"));
+ avision = g_list_append (avision, g_strdup ("1a35"));
+ g_hash_table_insert (scanners,
+ g_strdup("0638"),
+ avision);
+ GList* minolta = NULL;
+ minolta = g_list_append (minolta, g_strdup ("4004"));
+ minolta = g_list_append (minolta, g_strdup ("400d"));
+ minolta = g_list_append (minolta, g_strdup ("400e"));
+ g_hash_table_insert (scanners,
+ g_strdup("0686"),
+ minolta);
+
+ GList* agfa = NULL;
+ agfa = g_list_append (agfa, g_strdup ("0001"));
+ agfa = g_list_append (agfa, g_strdup ("0002"));
+ agfa = g_list_append (agfa, g_strdup ("0100"));
+ agfa = g_list_append (agfa, g_strdup ("2061"));
+ agfa = g_list_append (agfa, g_strdup ("208d"));
+ agfa = g_list_append (agfa, g_strdup ("208f"));
+ agfa = g_list_append (agfa, g_strdup ("2091"));
+ agfa = g_list_append (agfa, g_strdup ("2093"));
+ agfa = g_list_append (agfa, g_strdup ("2095"));
+ agfa = g_list_append (agfa, g_strdup ("2097"));
+ agfa = g_list_append (agfa, g_strdup ("20fd"));
+ agfa = g_list_append (agfa, g_strdup ("20ff"));
+ g_hash_table_insert (scanners,
+ g_strdup("06bd"),
+ minolta);
+
+ GList* umax_2 = NULL;
+ umax_2 = g_list_append (umax_2, g_strdup ("0020"));
+ g_hash_table_insert (scanners,
+ g_strdup("06dc"),
+ umax_2);
+
+ GList* plustek = NULL;
+
+ plustek = g_list_append (plustek, g_strdup ("0001"));
+ plustek = g_list_append (plustek, g_strdup ("0010"));
+ plustek = g_list_append (plustek, g_strdup ("0011"));
+ plustek = g_list_append (plustek, g_strdup ("0013"));
+ plustek = g_list_append (plustek, g_strdup ("0015"));
+ plustek = g_list_append (plustek, g_strdup ("0017"));
+ plustek = g_list_append (plustek, g_strdup ("0400"));
+ plustek = g_list_append (plustek, g_strdup ("0401"));
+ plustek = g_list_append (plustek, g_strdup ("0402"));
+ plustek = g_list_append (plustek, g_strdup ("0403"));
+ plustek = g_list_append (plustek, g_strdup ("040b"));
+ plustek = g_list_append (plustek, g_strdup ("040e"));
+ plustek = g_list_append (plustek, g_strdup ("0412"));
+ plustek = g_list_append (plustek, g_strdup ("0413"));
+ plustek = g_list_append (plustek, g_strdup ("0422"));
+ plustek = g_list_append (plustek, g_strdup ("0454"));
+ plustek = g_list_append (plustek, g_strdup ("045f"));
+ plustek = g_list_append (plustek, g_strdup ("0462"));
+ plustek = g_list_append (plustek, g_strdup ("0900"));
+ g_hash_table_insert (scanners,
+ g_strdup("07b3"),
+ plustek);
+
+ GList* corex = NULL;
+ corex = g_list_append (corex, g_strdup ("0002"));
+ corex = g_list_append (corex, g_strdup ("0005"));
+ g_hash_table_insert (scanners,
+ g_strdup("08f0"),
+ corex);
+
+ GList* xerox = NULL;
+ xerox = g_list_append (xerox, g_strdup ("3d5d"));
+ xerox = g_list_append (xerox, g_strdup ("3da4"));
+ xerox = g_list_append (xerox, g_strdup ("420c"));
+ xerox = g_list_append (xerox, g_strdup ("4265"));
+ xerox = g_list_append (xerox, g_strdup ("4293"));
+ xerox = g_list_append (xerox, g_strdup ("4294"));
+ g_hash_table_insert (scanners,
+ g_strdup("0924"),
+ xerox);
+
+ GList* pentax_2 = NULL;
+ pentax_2 = g_list_append (pentax_2, g_strdup ("3210"));
+ g_hash_table_insert (scanners,
+ g_strdup("0a17"),
+ pentax_2);
+
+ GList* portable = NULL;
+ portable = g_list_append (portable, g_strdup ("1000"));
+ g_hash_table_insert (scanners,
+ g_strdup("0a53"),
+ portable);
+
+ GList* syscan = NULL;
+ syscan = g_list_append (syscan, g_strdup ("4600"));
+ syscan = g_list_append (syscan, g_strdup ("4802"));
+ syscan = g_list_append (syscan, g_strdup ("4803"));
+ syscan = g_list_append (syscan, g_strdup ("480c"));
+ syscan = g_list_append (syscan, g_strdup ("4810"));
+ syscan = g_list_append (syscan, g_strdup ("6620"));
+ g_hash_table_insert (scanners,
+ g_strdup("0a82"),
+ syscan);
+
+ GList* canon_2 = NULL;
+ canon_2 = g_list_append (canon_2, g_strdup ("160c"));
+ canon_2 = g_list_append (canon_2, g_strdup ("160f"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1614"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1617"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1618"));
+ canon_2 = g_list_append (canon_2, g_strdup ("161a"));
+ canon_2 = g_list_append (canon_2, g_strdup ("161b"));
+ canon_2 = g_list_append (canon_2, g_strdup ("161d"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1620"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1622"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1623"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1624"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1626"));
+ canon_2 = g_list_append (canon_2, g_strdup ("162b"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1638"));
+ canon_2 = g_list_append (canon_2, g_strdup ("1639"));
+ g_hash_table_insert (scanners,
+ g_strdup("1083"),
+ canon_2);
+
+ GList* digital = NULL;
+ digital = g_list_append (digital, g_strdup ("0001"));
+ g_hash_table_insert (scanners,
+ g_strdup("1183"),
+ digital);
+
+ GList* konica_2 = NULL;
+ konica_2 = g_list_append (konica_2, g_strdup ("2089"));
+ g_hash_table_insert (scanners,
+ g_strdup("132b"),
+ konica_2);
+
+ GList* umax = NULL;
+ umax = g_list_append (umax, g_strdup ("0010"));
+ umax = g_list_append (umax, g_strdup ("0030"));
+ umax = g_list_append (umax, g_strdup ("0050"));
+ umax = g_list_append (umax, g_strdup ("0060"));
+ umax = g_list_append (umax, g_strdup ("0070"));
+ umax = g_list_append (umax, g_strdup ("0130"));
+ umax = g_list_append (umax, g_strdup ("0160"));
+ umax = g_list_append (umax, g_strdup ("0230"));
+ g_hash_table_insert (scanners,
+ g_strdup("1606"),
+ umax);
+
+ GList* docketport = NULL;
+ docketport = g_list_append (docketport, g_strdup ("4810"));
+ g_hash_table_insert (scanners,
+ g_strdup("1dcc"),
+ docketport);
+
+ GList* dell = NULL;
+ dell = g_list_append (dell, g_strdup ("5105"));
+ dell = g_list_append (dell, g_strdup ("5124"));
+ dell = g_list_append (dell, g_strdup ("5250"));
+ g_hash_table_insert (scanners,
+ g_strdup("413c"),
+ dell);
+}
diff --git a/src/session-dbus.c b/src/session-dbus.c
index 9aa75ef..1cf73ac 100644
--- a/src/session-dbus.c
+++ b/src/session-dbus.c
@@ -293,3 +293,25 @@ session_dbus_set_user_menu_visibility (SessionDbus* session,
}
}
}
+
+void session_dbus_restart_required (SessionDbus* session)
+{
+ SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session);
+ GError * error = NULL;
+
+ if (priv->bus != NULL) {
+ g_dbus_connection_emit_signal (priv->bus,
+ NULL,
+ INDICATOR_SESSION_SERVICE_DBUS_OBJECT,
+ INDICATOR_SESSION_SERVICE_DBUS_IFACE,
+ "RebootRequired",
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ g_warning("Unable to send reboot-required signal: %s", error->message);
+ g_error_free(error);
+ }
+ }
+
+}
diff --git a/src/session-dbus.h b/src/session-dbus.h
index 45ebae2..4dc340a 100644
--- a/src/session-dbus.h
+++ b/src/session-dbus.h
@@ -51,7 +51,7 @@ SessionDbus * session_dbus_new (void);
void session_dbus_set_name (SessionDbus * session, const gchar * name);
void session_dbus_set_users_real_name (SessionDbus * session, const gchar * name);
void session_dbus_set_user_menu_visibility (SessionDbus* session, gboolean visible);
-
+void session_dbus_restart_required (SessionDbus* session);
G_END_DECLS
#endif
diff --git a/src/session-dbus.xml b/src/session-dbus.xml
index c42aca8..fd1859f 100644
--- a/src/session-dbus.xml
+++ b/src/session-dbus.xml
@@ -17,8 +17,7 @@
<signal name="UserMenuIsVisible">
<arg name="update" type="b"/>
</signal>
- <signal name="RestartNeeded">
- <arg name="name" type="s"/>
+ <signal name="RestartRequired">
</signal>
</interface>
</node>
diff --git a/src/session-service.c b/src/session-service.c
index bb473e9..fa212fd 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -78,11 +78,21 @@ service_shutdown (IndicatorService * service, gpointer user_data)
return;
}
+static gboolean
+get_greeter_mode (void)
+{
+ const gchar *var;
+ var = g_getenv("INDICATOR_GREETER_MODE");
+ return (g_strcmp0(var, "1") == 0);
+}
+
/* Main, is well, main. It brings everything up and throws
us into the mainloop of no return. */
int
main (int argc, char ** argv)
{
+ gboolean greeter_mode;
+
g_type_init();
/* Setting up i18n and gettext. Apparently, we need
@@ -99,15 +109,19 @@ main (int argc, char ** argv)
session_dbus = session_dbus_new();
+ greeter_mode = get_greeter_mode();
+
// Devices
- DeviceMenuMgr* device_mgr = device_menu_mgr_new (session_dbus);
+ DeviceMenuMgr* device_mgr = device_menu_mgr_new (session_dbus, greeter_mode);
DbusmenuServer * server = dbusmenu_server_new(INDICATOR_SESSION_DBUS_OBJECT);
dbusmenu_server_set_root(server, device_mgr_get_root_item (device_mgr));
- // Users
- UserMenuMgr* user_mgr = user_menu_mgr_new (session_dbus);
- DbusmenuServer* users_server = dbusmenu_server_new (INDICATOR_USERS_DBUS_OBJECT);
- dbusmenu_server_set_root (users_server, user_mgr_get_root_item (user_mgr));
+ if (!greeter_mode) {
+ // Users
+ UserMenuMgr* user_mgr = user_menu_mgr_new (session_dbus);
+ DbusmenuServer* users_server = dbusmenu_server_new (INDICATOR_USERS_DBUS_OBJECT);
+ dbusmenu_server_set_root (users_server, user_mgr_get_root_item (user_mgr));
+ }
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);
diff --git a/src/udev-mgr.c b/src/udev-mgr.c
index 6575ca5..e3328ec 100644
--- a/src/udev-mgr.c
+++ b/src/udev-mgr.c
@@ -17,22 +17,120 @@ You should have received a copy of the GNU General Public License along
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 "udev-mgr.h"
+#include "sane-rules.h"
+
+static void udevice_mgr_device_list_iterator (gpointer data,
+ gpointer userdata);
+static void udev_mgr_uevent_cb (GUdevClient *client,
+ gchar *action,
+ GUdevDevice *device,
+ gpointer user_data);
+static void udev_mgr_update_menuitems (UdevMgr* self);
+static void udev_mgr_check_if_usb_device_is_supported (UdevMgr* self,
+ GUdevDevice *device,
+ UdevMgrDeviceAction action);
+static void udev_mgr_handle_webcam (UdevMgr* self,
+ GUdevDevice* device,
+ UdevMgrDeviceAction action);
+static void udev_mgr_handle_scsi_device (UdevMgr* self,
+ GUdevDevice* device,
+ UdevMgrDeviceAction action);
+
+static void udev_mgr_cleanup_lists(gpointer data, gpointer self);
+static void udev_mgr_cleanup_entries(gpointer data, gpointer self);
+
+
+static void debug_device (UdevMgr* self,
+ GUdevDevice* device,
+ UdevMgrDeviceAction action);
+
+
+struct _UdevMgr
+{
+ GObject parent_instance;
+ DbusmenuMenuitem* scanner_item;
+ DbusmenuMenuitem* webcam_item;
+ GUdevClient* client;
+ GHashTable* supported_usb_scanners;
+ GHashTable* supported_scsi_scanners;
+ GHashTable* scanners_present;
+ GHashTable* webcams_present;
+};
+
+const char *subsystems[3] = {"usb", "scsi", "video4linux"};
+const gchar* usb_subsystem = "usb";
+const gchar* scsi_subsystem = "scsi";
+const gchar* video4linux_subsystem = "video4linux";
G_DEFINE_TYPE (UdevMgr, udev_mgr, G_TYPE_OBJECT);
static void
-udev_mgr_init (UdevMgr *object)
+udev_mgr_init (UdevMgr* self)
{
- /* TODO: Add initialization code here */
+ self->client = NULL;
+ self->supported_usb_scanners = NULL;
+ self->scanners_present = NULL;
+ self->webcams_present = NULL;
+ self->client = g_udev_client_new (subsystems);
+ self->supported_usb_scanners = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ (GDestroyNotify)udev_mgr_cleanup_lists);
+ self->supported_scsi_scanners = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ (GDestroyNotify)udev_mgr_cleanup_lists);
+ self->scanners_present = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
+ self->webcams_present = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
+
+ // load into memory all supported scanners ...
+ populate_usb_scanners (self->supported_usb_scanners);
+ populate_scsi_scanners (self->supported_scsi_scanners);
+ g_signal_connect (G_OBJECT (self->client),
+ "uevent",
+ G_CALLBACK (udev_mgr_uevent_cb),
+ self);
}
static void
-udev_mgr_finalize (GObject *object)
+udev_mgr_cleanup_lists(gpointer data, gpointer self)
{
- /* TODO: Add deinitalization code here */
+ GList* scanners = (GList*)data;
+ g_list_foreach (scanners, udev_mgr_cleanup_entries, NULL);
+ g_list_free(scanners);
+}
+
+static void
+udev_mgr_cleanup_entries(gpointer data, gpointer self)
+{
+ gchar* entry = (gchar*)data;
+ g_free(entry);
+}
+static void
+udev_mgr_finalize (GObject *object)
+{
+ UdevMgr* self = UDEV_MGR (object);
+ g_hash_table_destroy (self->supported_scsi_scanners);
+ g_hash_table_destroy (self->supported_usb_scanners);
+ g_hash_table_destroy (self->scanners_present);
+ g_hash_table_destroy (self->webcams_present);
G_OBJECT_CLASS (udev_mgr_parent_class)->finalize (object);
}
@@ -40,7 +138,319 @@ static void
udev_mgr_class_init (UdevMgrClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
-
object_class->finalize = udev_mgr_finalize;
}
+static void
+udevice_mgr_device_list_iterator (gpointer data, gpointer userdata)
+{
+ g_return_if_fail (G_UDEV_IS_DEVICE (data));
+ g_return_if_fail (UDEV_IS_MGR (userdata));
+
+ UdevMgr* self = UDEV_MGR (userdata);
+
+ GUdevDevice* device = G_UDEV_DEVICE (data);
+
+ const gchar* subsystem = NULL;
+ subsystem = g_udev_device_get_subsystem (device);
+
+ if (g_strcmp0 (subsystem, "usb") == 0){
+ udev_mgr_check_if_usb_device_is_supported (self, device, ADD);
+ }
+ else if (g_strcmp0 (subsystem, "video4linux") == 0){
+ udev_mgr_handle_webcam (self, device, ADD);
+ }
+ else if (g_strcmp0 (subsystem, "scsi") == 0){
+ udev_mgr_handle_scsi_device (self, device, ADD);
+ }
+
+ g_object_unref (device);
+}
+
+
+static void udev_mgr_update_menuitems (UdevMgr* self)
+{
+ dbusmenu_menuitem_property_set_bool (self->scanner_item,
+ DBUSMENU_MENUITEM_PROP_VISIBLE,
+ g_hash_table_size (self->scanners_present) > 0);
+
+ dbusmenu_menuitem_property_set_bool (self->webcam_item,
+ DBUSMENU_MENUITEM_PROP_VISIBLE,
+ g_hash_table_size (self->webcams_present) > 0);
+
+}
+
+static void udev_mgr_uevent_cb (GUdevClient *client,
+ gchar *action,
+ GUdevDevice *device,
+ gpointer user_data)
+{
+ g_return_if_fail (UDEV_IS_MGR (user_data));
+ UdevMgr* self = UDEV_MGR (user_data);
+ g_return_if_fail (device != NULL);
+
+ g_debug ("just received a UEVENT with an action : %s", action);
+
+ UdevMgrDeviceAction udev_mgr_action = ADD;
+
+ if (g_strcmp0 (action, "remove") == 0){
+ udev_mgr_action = REMOVE;
+ }
+
+ const gchar* subsystem = NULL;
+ subsystem = g_udev_device_get_subsystem (device);
+
+ if (g_strcmp0 (subsystem, "usb") == 0){
+ udev_mgr_check_if_usb_device_is_supported (self,
+ device,
+ udev_mgr_action);
+ }
+ else if (g_strcmp0 (subsystem, "video4linux") == 0){
+ udev_mgr_handle_webcam (self, device, udev_mgr_action);
+ }
+ else if (g_strcmp0 (subsystem, "scsi") == 0){
+ udev_mgr_handle_scsi_device (self, device, udev_mgr_action);
+ }
+}
+
+
+static void
+udev_mgr_handle_webcam (UdevMgr* self,
+ GUdevDevice* device,
+ UdevMgrDeviceAction action)
+{
+ if (FALSE)
+ debug_device (self, device, action);
+
+ const gchar* vendor;
+ const gchar* product;
+
+ vendor = g_udev_device_get_property (device, "ID_VENDOR_ID");
+ product = g_udev_device_get_property (device, "ID_MODEL_ID");
+
+ 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");
+ return;
+ }
+ g_hash_table_remove (self->webcams_present,
+ product);
+
+ }
+ 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;
+ }
+ g_hash_table_insert (self->webcams_present,
+ g_strdup (product),
+ g_strdup (vendor));
+ }
+ udev_mgr_update_menuitems (self);
+}
+
+static void
+debug_device (UdevMgr* self,
+ GUdevDevice* device,
+ UdevMgrDeviceAction action)
+{
+ const gchar* vendor;
+ const gchar* product;
+ const gchar* number;
+ const gchar* name;
+
+ vendor = g_udev_device_get_property (device, "ID_VENDOR_ID");
+ 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_strdup(vendor),
+ g_strdup(product),
+ g_strdup(number),
+ g_strdup(name));
+
+ const gchar *const *list;
+ const gchar *const *iter;
+ char propstr[500];
+ guint32 namelen = 0, i;
+
+ list = g_udev_device_get_property_keys(device);
+
+ for (iter = list; iter && *iter; iter++) {
+ if (strlen(*iter) > namelen)
+ namelen = strlen(*iter);
+ }
+ namelen++;
+
+ for (iter = list; iter && *iter; iter++) {
+ strcpy(propstr, *iter);
+ strcat(propstr, ":");
+ for (i = 0; i < namelen - strlen(*iter); i++)
+ strcat(propstr, " ");
+ strcat(propstr, g_udev_device_get_property(device, *iter));
+ g_debug("%s", propstr);
+ }
+}
+
+static void udev_mgr_handle_scsi_device (UdevMgr* self,
+ GUdevDevice* device,
+ UdevMgrDeviceAction action)
+{
+ const gchar* type = NULL;
+ type = g_udev_device_get_property (device, "TYPE");
+ // apparently anything thats type 3 and SCSI is a Scanner
+ if (g_strcmp0 (type, "6") == 0){
+ gchar* random_scanner_name = g_strdup_printf("%p--scanner", self);
+ g_hash_table_insert (self->scanners_present,
+ random_scanner_name,
+ g_strdup("Scanner"));
+ udev_mgr_update_menuitems (self);
+ return;
+ }
+
+ // We only care about type 3 for the special cases below
+ if (g_strcmp0 (type, "3") != 0){
+ return;
+ }
+
+ const gchar* vendor = NULL;
+ vendor = g_udev_device_get_property (device, "VENDOR");
+
+ if (vendor == NULL)
+ return;
+
+ GList* vendor_list = NULL;
+ vendor_list = g_hash_table_lookup (self->supported_scsi_scanners,
+ (gpointer)vendor);
+ if (vendor_list == NULL)
+ return;
+
+ const gchar* model_id = NULL;
+ model_id = g_udev_device_get_property (device, "MODEL");
+
+ if (model_id == NULL)
+ return;
+
+ GList* model_entry = NULL;
+ model_entry = g_list_find_custom (vendor_list,
+ model_id,
+ (GCompareFunc)g_strcmp0);
+
+ if (model_entry != NULL){
+ if (action == REMOVE){
+ if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) == NULL){
+ g_warning ("Got an REMOVE event on a scanner device but we dont have that device in our scanners cache");
+ }
+ else{
+ g_hash_table_remove (self->scanners_present, vendor);
+ }
+ }
+ else{
+ if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) != NULL){
+ g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache");
+ }
+ else{
+ g_hash_table_insert (self->scanners_present,
+ g_strdup(vendor),
+ g_strdup(model_id));
+ }
+ }
+ udev_mgr_update_menuitems (self);
+ }
+}
+
+static void
+udev_mgr_check_if_usb_device_is_supported (UdevMgr* self,
+ GUdevDevice *device,
+ UdevMgrDeviceAction action)
+{
+ const gchar* vendor = NULL;
+ debug_device (self, device, action);
+
+ vendor = g_udev_device_get_property (device, "ID_VENDOR_ID");
+
+ if (vendor == NULL)
+ return;
+
+ //g_debug ("vendor = %s", vendor);
+
+ GList* vendor_list = NULL;
+ vendor_list = g_hash_table_lookup (self->supported_usb_scanners,
+ (gpointer)vendor);
+ if (vendor_list == NULL)
+ return;
+
+ const gchar* model_id = NULL;
+ model_id = g_udev_device_get_property (device, "ID_MODEL_ID");
+
+ if (model_id == NULL)
+ return;
+
+ GList* model_entry = NULL;
+ model_entry = g_list_find_custom(vendor_list, model_id, (GCompareFunc)g_strcmp0);
+
+ if (model_entry != NULL){
+ if (action == REMOVE){
+ if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) == NULL){
+ g_warning ("Got an REMOVE event on a scanner device but we dont have that device in our scanners cache");
+ }
+ else{
+ g_hash_table_remove (self->scanners_present, vendor);
+ }
+ }
+ else{
+ if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) != NULL){
+ g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache");
+ }
+ else{
+ g_hash_table_insert (self->scanners_present,
+ g_strdup(vendor),
+ g_strdup(model_id));
+ }
+ }
+ udev_mgr_update_menuitems (self);
+ }
+}
+
+UdevMgr* udev_mgr_new (DbusmenuMenuitem* scanner,
+ DbusmenuMenuitem* webcam)
+{
+ UdevMgr* mgr = g_object_new (UDEV_TYPE_MGR, NULL);
+ mgr->scanner_item = scanner;
+ mgr->webcam_item = webcam;
+
+ // Check for USB devices
+ GList* usb_devices_available = NULL;
+ usb_devices_available = g_udev_client_query_by_subsystem (mgr->client,
+ usb_subsystem);
+ if (usb_devices_available != NULL){
+ g_list_foreach (usb_devices_available,
+ udevice_mgr_device_list_iterator,
+ mgr);
+
+ g_list_free (usb_devices_available);
+ }
+ // Check for webcams
+ GList* video_devices_available = NULL;
+ video_devices_available = g_udev_client_query_by_subsystem (mgr->client,
+ video4linux_subsystem);
+ if (video_devices_available != NULL){
+ g_list_foreach (video_devices_available,
+ udevice_mgr_device_list_iterator,
+ mgr);
+
+ g_list_free (video_devices_available);
+ }
+ // Check for SCSI devices
+ GList* scsi_devices_available = NULL;
+ scsi_devices_available = g_udev_client_query_by_subsystem (mgr->client,
+ scsi_subsystem);
+ if (scsi_devices_available != NULL){
+ g_list_foreach (scsi_devices_available,
+ udevice_mgr_device_list_iterator,
+ mgr);
+ g_list_free (scsi_devices_available);
+ }
+ return mgr;
+}
diff --git a/src/udev-mgr.h b/src/udev-mgr.h
index 1c5ae73..5119803 100644
--- a/src/udev-mgr.h
+++ b/src/udev-mgr.h
@@ -21,6 +21,14 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define _UDEV_MGR_H_
#include <glib-object.h>
+#include <libdbusmenu-glib/client.h>
+
+#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+#include <libdbusmenu-gtk3/menuitem.h>
+#else
+#include <libdbusmenu-gtk/menuitem.h>
+#endif
G_BEGIN_DECLS
@@ -39,12 +47,15 @@ struct _UdevMgrClass
GObjectClass parent_class;
};
-struct _UdevMgr
-{
- GObject parent_instance;
-};
GType udev_mgr_get_type (void) G_GNUC_CONST;
+UdevMgr* udev_mgr_new (DbusmenuMenuitem* scanner_item,
+ DbusmenuMenuitem* webcam_item);
+
+typedef enum {
+ ADD,
+ REMOVE
+}UdevMgrDeviceAction;
G_END_DECLS
diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c
index 611bcc7..bf3b77f 100644
--- a/src/user-menu-mgr.c
+++ b/src/user-menu-mgr.c
@@ -149,10 +149,9 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self)
for (u = users; u != NULL; u = g_list_next (u)) {
user = u->data;
+ g_debug ("%p: %s", user, user->real_name);
user->service = self->users_dbus_interface;
- g_debug ("%i %s", (gint)user->uid, user->user_name);
-
if (g_strcmp0(user->user_name, "guest") == 0) {
/* Check to see if the guest has sessions and so therefore should
get a check mark. */
@@ -171,13 +170,26 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self)
if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) {
mi = dbusmenu_menuitem_new ();
- dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_TYPE, USER_ITEM_TYPE);
+ dbusmenu_menuitem_property_set (mi,
+ DBUSMENU_MENUITEM_PROP_TYPE,
+ USER_ITEM_TYPE);
if (user->real_name_conflict) {
gchar * conflictedname = g_strdup_printf("%s (%s)", user->real_name, user->user_name);
dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, conflictedname);
g_free(conflictedname);
} else {
- dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, user->real_name);
+ //g_debug ("%i %s", (gint)user->uid, user->real_name);
+ //g_debug ("users uid = %i", (gint)user->uid);
+ //g_debug ("users real name = %s", user->real_name);
+ if (user == NULL){
+ g_debug ("USER pointer is NULL");
+ return;
+ }
+ g_debug ("%p: %s", user, user->real_name);
+
+ dbusmenu_menuitem_property_set (mi,
+ USER_ITEM_PROP_NAME,
+ user->real_name);
}
dbusmenu_menuitem_property_set_bool (mi,
USER_ITEM_PROP_LOGGED_IN,
diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c
index 087378c..83edaa3 100644
--- a/src/users-service-dbus.c
+++ b/src/users-service-dbus.c
@@ -195,15 +195,50 @@ static void
create_display_manager_proxy (UsersServiceDbus *self)
{
UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
+ DBusGProxy *dm_proxy = NULL;
+ GError *error = NULL;
+ const gchar *cookie = NULL;
+ gchar *seat = NULL;
+
+ cookie = g_getenv ("XDG_SESSION_COOKIE");
+ if (cookie == NULL || cookie[0] == 0)
+ {
+ g_warning ("Failed to get DisplayManager proxy: XDG_SESSION_COOKIE undefined.");
+ return;
+ }
+
+ dm_proxy = dbus_g_proxy_new_for_name (priv->system_bus,
+ "org.freedesktop.DisplayManager",
+ "/org/freedesktop/DisplayManager",
+ "org.freedesktop.DisplayManager");
+
+ if (!dm_proxy)
+ {
+ g_warning ("Failed to get DisplayManager proxy.");
+ return;
+ }
+
+ /* Now request the proper seat */
+ if (!dbus_g_proxy_call (dm_proxy, "GetSeatForCookie", &error,
+ G_TYPE_STRING, cookie, G_TYPE_INVALID,
+ DBUS_TYPE_G_OBJECT_PATH, &seat, G_TYPE_INVALID))
+ {
+ g_warning ("Failed to get DisplayManager seat proxy: %s", error->message);
+ g_object_unref (dm_proxy);
+ g_error_free (error);
+ return;
+ }
+ g_object_unref (dm_proxy);
priv->display_manager_proxy = dbus_g_proxy_new_for_name (priv->system_bus,
"org.freedesktop.DisplayManager",
- "/org/freedesktop/DisplayManager",
- "org.freedesktop.DisplayManager");
+ seat,
+ "org.freedesktop.DisplayManager.Seat");
+ g_free (seat);
if (!priv->display_manager_proxy)
{
- g_warning ("Failed to get DisplayManager proxy.");
+ g_warning ("Failed to get DisplayManager seat proxy.");
return;
}
}
@@ -780,7 +815,7 @@ users_service_dbus_show_greeter (UsersServiceDbus *self)
{
g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
- return org_freedesktop_DisplayManager_show_greeter(priv->display_manager_proxy, NULL);
+ return org_freedesktop_DisplayManager_Seat_switch_to_greeter(priv->display_manager_proxy, NULL);
}
/* Activates the guest account if it can. */
@@ -789,7 +824,7 @@ users_service_dbus_activate_guest_session (UsersServiceDbus *self)
{
g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
- return org_freedesktop_DisplayManager_switch_to_guest(priv->display_manager_proxy, NULL);
+ return org_freedesktop_DisplayManager_Seat_switch_to_guest(priv->display_manager_proxy, "", NULL);
}
/* Activates a specific user */
@@ -799,7 +834,7 @@ users_service_dbus_activate_user_session (UsersServiceDbus *self,
{
g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
- return org_freedesktop_DisplayManager_switch_to_user(priv->display_manager_proxy, user->user_name, NULL);
+ return org_freedesktop_DisplayManager_Seat_switch_to_user(priv->display_manager_proxy, user->user_name, "", NULL);
}
gboolean