diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-08-10 18:01:29 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-08-10 18:01:29 +0100 |
commit | 357374acb2a641a9c5d70cb6149293a0a07770f3 (patch) | |
tree | 8c8ac5869ebb4908f537e05f28db27261dabd180 /src | |
parent | a1a7357b58d182e077ebfe8fb11c083e5eb18839 (diff) | |
parent | 853ad495b863c179792044f1a74e8556d04e32db (diff) | |
download | ayatana-indicator-session-357374acb2a641a9c5d70cb6149293a0a07770f3.tar.gz ayatana-indicator-session-357374acb2a641a9c5d70cb6149293a0a07770f3.tar.bz2 ayatana-indicator-session-357374acb2a641a9c5d70cb6149293a0a07770f3.zip |
merged the lightdb dbus changes and the apt restartrequired awareness
Diffstat (limited to 'src')
-rw-r--r-- | src/apt-transaction.c | 2 | ||||
-rw-r--r-- | src/apt-watcher.c | 20 | ||||
-rw-r--r-- | src/display-manager.xml | 9 | ||||
-rw-r--r-- | src/indicator-session.c | 5 | ||||
-rw-r--r-- | src/session-dbus.c | 22 | ||||
-rw-r--r-- | src/session-dbus.h | 2 | ||||
-rw-r--r-- | src/session-dbus.xml | 3 | ||||
-rw-r--r-- | src/users-service-dbus.c | 47 |
8 files changed, 92 insertions, 18 deletions
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/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/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/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/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 |