← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~cjcurran/indicator-session/greetermode-icon into lp:indicator-session

 

Conor Curran has proposed merging lp:~cjcurran/indicator-session/greetermode-icon into lp:indicator-session.

Requested reviews:
  Ted Gould (ted)
Related bugs:
  Bug #838546 in Session Menu: "Greeter power menu has cog icon but no settings"
  https://bugs.launchpad.net/indicator-session/+bug/838546

For more details, see:
https://code.launchpad.net/~cjcurran/indicator-session/greetermode-icon/+merge/73679

in greetermode we should use the old icon for the session menu
-- 
https://code.launchpad.net/~cjcurran/indicator-session/greetermode-icon/+merge/73679
Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== modified file 'src/dbus-shared-names.h'
--- src/dbus-shared-names.h	2011-08-22 14:53:07 +0000
+++ src/dbus-shared-names.h	2011-09-01 15:15:28 +0000
@@ -64,4 +64,6 @@
 #define ICON_DEFAULT              "system-devices-panel"
 #define ICON_RESTART              "system-devices-panel-alert"
 
+#define GREETER_ICON_DEFAULT      "system-shutdown-panel"
+
 #endif /* __DBUS_SHARED_NAMES_H__ */

=== modified file 'src/indicator-session.c'
--- src/indicator-session.c	2011-08-31 13:32:07 +0000
+++ src/indicator-session.c	2011-09-01 15:15:28 +0000
@@ -96,6 +96,7 @@
 static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
 static void user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data);
 static void user_menu_visibility_get_cb (GObject* obj, GAsyncResult* res, gpointer user_data);
+static void greeter_mode_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data);
 
 static void indicator_session_class_init (IndicatorSessionClass *klass);
 static void indicator_session_init       (IndicatorSession *self);
@@ -356,6 +357,15 @@
                      NULL,
                      user_menu_visibility_get_cb,
                      user_data);                               
+  // Is this the greeter mode.
+  g_dbus_proxy_call (self->service_proxy,
+                     "GetGreeterMode",
+                     NULL,
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     NULL,
+                     greeter_mode_get_cb,
+                     user_data);                               
   
   // Fetch the user's real name for the user entry label
   g_dbus_proxy_call (self->service_proxy,
@@ -400,6 +410,26 @@
   return TRUE;
 }
 
+static void
+greeter_mode_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data)
+{
+	IndicatorSession * self = INDICATOR_SESSION(user_data);
+	GError * error = NULL;
+	GVariant * result;
+
+	result = g_dbus_proxy_call_finish(self->service_proxy, res, &error);
+
+	if (error != NULL) {
+    g_warning ("unable to complete GetGreeterMode query");
+    g_error_free (error);
+		return;
+	}
+  gboolean update;
+  g_variant_get (result, "(b)", &update);
+  if (update == TRUE){
+    self->devices.image = indicator_image_helper (GREETER_ICON_DEFAULT);
+  }
+}
 
 static void
 user_real_name_get_cb (GObject * obj, GAsyncResult * res, gpointer user_data)

=== modified file 'src/session-dbus.c'
--- src/session-dbus.c	2011-08-31 12:19:38 +0000
+++ src/session-dbus.c	2011-09-01 15:15:28 +0000
@@ -42,6 +42,7 @@
 	GDBusConnection * bus;
 	GCancellable * bus_cancel;
 	guint dbus_registration;
+  gboolean greeter_mode;
 };
 
 /* GDBus Stuff */
@@ -105,6 +106,7 @@
 	priv->bus_cancel = NULL;
 	priv->dbus_registration = 0;
   priv->user_menu_is_visible = FALSE;
+  priv->greeter_mode = FALSE;
 
 	priv->bus_cancel = g_cancellable_new();
 	g_bus_get(G_BUS_TYPE_SESSION,
@@ -174,6 +176,9 @@
   else if (g_strcmp0 (method, "GetUserMenuVisibility") == 0){
     retval =  g_variant_new ("(b)", priv->user_menu_is_visible);
   }
+  else if (g_strcmp0 (method, "GetGreeterMode") == 0){
+    retval = g_variant_new ("(b)", priv->greeter_mode);
+  }
   else {
     g_warning("Calling method '%s' on the indicator service and it's unknown", method);
 	}
@@ -229,9 +234,12 @@
 }
 
 SessionDbus *
-session_dbus_new (void)
+session_dbus_new (gboolean greeter)
 {
-	return SESSION_DBUS(g_object_new(SESSION_DBUS_TYPE, NULL));
+  SessionDbus* sess = g_object_new(SESSION_DBUS_TYPE, NULL);
+	SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(sess);
+  priv->greeter_mode = greeter;
+	return sess;
 }
 
 void

=== modified file 'src/session-dbus.h'
--- src/session-dbus.h	2011-08-09 08:59:20 +0000
+++ src/session-dbus.h	2011-09-01 15:15:28 +0000
@@ -47,7 +47,7 @@
 };
 
 GType session_dbus_get_type (void);
-SessionDbus * session_dbus_new (void);
+SessionDbus * session_dbus_new (gboolean greeter);
 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);

=== modified file 'src/session-dbus.xml'
--- src/session-dbus.xml	2011-08-31 13:32:07 +0000
+++ src/session-dbus.xml	2011-09-01 15:15:28 +0000
@@ -8,6 +8,9 @@
     <method name="GetUserMenuVisibility">
       <arg name="update" direction="out" type="b"/>
     </method>
+    <method name="GetGreeterMode">
+      <arg name="update" direction="out" type="b"/>
+    </method>
     <signal name="UserRealNameUpdated">
       <arg name="name" type="s"/>
     </signal>

=== modified file 'src/session-service.c'
--- src/session-service.c	2011-08-26 10:17:26 +0000
+++ src/session-service.c	2011-09-01 15:15:28 +0000
@@ -107,10 +107,10 @@
                     INDICATOR_SERVICE_SIGNAL_SHUTDOWN,
                     G_CALLBACK(service_shutdown), NULL);
 
-	session_dbus = session_dbus_new();
-
   greeter_mode = get_greeter_mode();
 
+	session_dbus = session_dbus_new (greeter_mode);
+
   // Devices
   DeviceMenuMgr* device_mgr = device_menu_mgr_new (session_dbus, greeter_mode);
   DbusmenuServer * server = dbusmenu_server_new(INDICATOR_SESSION_DBUS_OBJECT);


Follow ups