aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-08-09 09:59:20 +0100
committerConor Curran <conor.curran@canonical.com>2011-08-09 09:59:20 +0100
commit853ad495b863c179792044f1a74e8556d04e32db (patch)
tree8c8ac5869ebb4908f537e05f28db27261dabd180
parent3edbdc147bcf6ce1b94e6156e318728c41abea2a (diff)
downloadayatana-indicator-session-853ad495b863c179792044f1a74e8556d04e32db.tar.gz
ayatana-indicator-session-853ad495b863c179792044f1a74e8556d04e32db.tar.bz2
ayatana-indicator-session-853ad495b863c179792044f1a74e8556d04e32db.zip
and the actual code
-rw-r--r--src/apt-watcher.c20
-rw-r--r--src/indicator-session.c5
-rw-r--r--src/session-dbus.c22
-rw-r--r--src/session-dbus.h2
-rw-r--r--src/session-dbus.xml3
5 files changed, 45 insertions, 7 deletions
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/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>