aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-05-30 09:19:52 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-05-30 09:19:52 +0200
commit7ce8811a028949e343933d9af74698955d1c637d (patch)
treee590760edaa561c4ef746a7f1b1ba097e37c89da
parent16008bb3a547389a8870692a5af6729420b32120 (diff)
downloadayatana-indicator-session-7ce8811a028949e343933d9af74698955d1c637d.tar.gz
ayatana-indicator-session-7ce8811a028949e343933d9af74698955d1c637d.tar.bz2
ayatana-indicator-session-7ce8811a028949e343933d9af74698955d1c637d.zip
Things are not that simple... Complete previous commit, now switch to org.ayatana.Desktop Dbus session bus name complete.
-rw-r--r--src/backend-dbus/CMakeLists.txt4
-rw-r--r--src/backend-dbus/actions.c48
-rw-r--r--tests/backend-dbus/mock-end-session-dialog.cc2
-rw-r--r--tests/backend-dbus/mock-unity-session.cc18
-rw-r--r--tests/backend-dbus/mock-unity-session.h10
-rw-r--r--tests/backend-dbus/test-actions.cc34
6 files changed, 58 insertions, 58 deletions
diff --git a/src/backend-dbus/CMakeLists.txt b/src/backend-dbus/CMakeLists.txt
index d0d3a35..faa09a9 100644
--- a/src/backend-dbus/CMakeLists.txt
+++ b/src/backend-dbus/CMakeLists.txt
@@ -43,8 +43,8 @@ add_gdbus_codegen (BACKEND_GENERATED_SOURCES dbus-end-session-dialog
org.gnome.SessionManager
${CMAKE_CURRENT_SOURCE_DIR}/org.gnome.SessionManager.EndSessionDialog.xml)
-add_gdbus_codegen (BACKEND_GENERATED_SOURCES unity-session
- com.canonical
+add_gdbus_codegen (BACKEND_GENERATED_SOURCES desktop-session
+ org.ayatana
${CMAKE_CURRENT_SOURCE_DIR}/org.ayatana.Desktop.Session.xml)
set (SOURCES actions.c guest.c users.c backend-dbus.c utils.c)
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c
index 4fec536..96af7b3 100644
--- a/src/backend-dbus/actions.c
+++ b/src/backend-dbus/actions.c
@@ -25,7 +25,7 @@
#include "dbus-webcredentials.h"
#include "gnome-screen-saver.h"
#include "gnome-session-manager.h"
-#include "unity-session.h"
+#include "desktop-session.h"
#include "actions.h"
@@ -44,7 +44,7 @@ struct _IndicatorSessionActionsDbusPriv
GSettings * indicator_settings;
GnomeScreenSaver * screen_saver;
GnomeSessionManager * session_manager;
- UnitySession * unity_session;
+ DesktopSession * desktop_session;
Login1Manager * login1_manager;
GCancellable * login1_manager_cancellable;
Login1Seat * login1_seat;
@@ -199,16 +199,16 @@ on_screensaver_proxy_ready (GObject * o G_GNUC_UNUSED, GAsyncResult * res, gpoin
}
static void
-on_unity_proxy_ready (GObject * o G_GNUC_UNUSED, GAsyncResult * res, gpointer gself)
+on_desktop_proxy_ready (GObject * o G_GNUC_UNUSED, GAsyncResult * res, gpointer gself)
{
GError * err;
- UnitySession * us;
+ DesktopSession * us;
err = NULL;
- us = unity_session_proxy_new_for_bus_finish (res, &err);
+ us = desktop_session_proxy_new_for_bus_finish (res, &err);
if (err == NULL)
{
- INDICATOR_SESSION_ACTIONS_DBUS(gself)->priv->unity_session = us;
+ INDICATOR_SESSION_ACTIONS_DBUS(gself)->priv->desktop_session = us;
}
log_and_clear_error (&err, G_STRLOC, G_STRFUNC);
@@ -521,14 +521,14 @@ logout_now_gnome_session_manager (IndicatorSessionActionsDbus * self)
}
static void
-on_unity_logout_response (GObject * o,
+on_desktop_logout_response (GObject * o,
GAsyncResult * res,
gpointer gself)
{
GError * error;
error = NULL;
- unity_session_call_request_logout_finish (UNITY_SESSION(o), res, &error);
+ desktop_session_call_request_logout_finish (DESKTOP_SESSION(o), res, &error);
if (error != NULL)
{
@@ -543,18 +543,18 @@ on_unity_logout_response (GObject * o,
}
static gboolean
-logout_now_unity (IndicatorSessionActionsDbus * self)
+logout_now_desktop (IndicatorSessionActionsDbus * self)
{
priv_t * p = self->priv;
gboolean called = FALSE;
- if (is_owned_proxy (p->unity_session))
+ if (is_owned_proxy (p->desktop_session))
{
called = TRUE;
- g_debug ("calling unity_session_call_request_logout()");
- unity_session_call_request_logout (p->unity_session,
+ g_debug ("calling desktop_session_call_request_logout()");
+ desktop_session_call_request_logout (p->desktop_session,
p->cancellable,
- on_unity_logout_response,
+ on_desktop_logout_response,
self);
}
@@ -564,7 +564,7 @@ logout_now_unity (IndicatorSessionActionsDbus * self)
static void
logout_now (IndicatorSessionActionsDbus * self)
{
- if (!logout_now_unity(self) && !logout_now_gnome_session_manager(self))
+ if (!logout_now_desktop(self) && !logout_now_gnome_session_manager(self))
{
g_critical("%s can't logout: no Unity nor GNOME session proxy", G_STRFUNC);
}
@@ -649,7 +649,7 @@ on_open_end_session_dialog_ready (GObject * o,
}
static void
-show_unity_end_session_dialog (IndicatorSessionActionsDbus * self, int type)
+show_desktop_end_session_dialog (IndicatorSessionActionsDbus * self, int type)
{
priv_t * p = INDICATOR_SESSION_ACTIONS_DBUS(self)->priv;
gpointer o = p->end_session_dialog;
@@ -723,7 +723,7 @@ my_logout (IndicatorSessionActions * actions)
switch (get_prompt_status (self))
{
case PROMPT_WITH_UNITY:
- show_unity_end_session_dialog (self, END_SESSION_TYPE_LOGOUT);
+ show_desktop_end_session_dialog (self, END_SESSION_TYPE_LOGOUT);
break;
case PROMPT_NONE:
@@ -760,7 +760,7 @@ my_reboot (IndicatorSessionActions * actions)
switch (get_prompt_status (self))
{
case PROMPT_WITH_UNITY:
- show_unity_end_session_dialog (self, END_SESSION_TYPE_REBOOT);
+ show_desktop_end_session_dialog (self, END_SESSION_TYPE_REBOOT);
break;
case PROMPT_NONE:
@@ -789,7 +789,7 @@ my_power_off (IndicatorSessionActions * actions)
case PROMPT_WITH_UNITY:
/* NB: TYPE_REBOOT instead of TYPE_SHUTDOWN because
the latter adds lock & logout options in Unity... */
- show_unity_end_session_dialog (self, END_SESSION_TYPE_REBOOT);
+ show_desktop_end_session_dialog (self, END_SESSION_TYPE_REBOOT);
break;
case PROMPT_WITH_ZENITY:
@@ -895,15 +895,15 @@ lock_current_session (IndicatorSessionActions * self, gboolean immediate)
{
priv_t * p = INDICATOR_SESSION_ACTIONS_DBUS(self)->priv;
- if (is_owned_proxy (p->unity_session))
+ if (is_owned_proxy (p->desktop_session))
{
if (immediate)
{
- unity_session_call_prompt_lock (p->unity_session, p->cancellable, NULL, NULL);
+ desktop_session_call_prompt_lock (p->desktop_session, p->cancellable, NULL, NULL);
}
else
{
- unity_session_call_lock (p->unity_session, p->cancellable, NULL, NULL);
+ desktop_session_call_lock (p->desktop_session, p->cancellable, NULL, NULL);
}
}
else
@@ -1000,7 +1000,7 @@ my_dispose (GObject * o)
g_clear_object (&p->screen_saver);
g_clear_object (&p->session_manager);
- g_clear_object (&p->unity_session);
+ g_clear_object (&p->desktop_session);
set_dm_seat (self, NULL);
set_login1_manager (self, NULL);
set_login1_seat (self, NULL);
@@ -1103,12 +1103,12 @@ indicator_session_actions_dbus_init (IndicatorSessionActionsDbus * self)
on_screensaver_proxy_ready,
self);
- unity_session_proxy_new_for_bus (G_BUS_TYPE_SESSION,
+ desktop_session_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
"org.ayatana.Desktop",
"/org/ayatana/Desktop/Session",
p->cancellable,
- on_unity_proxy_ready,
+ on_desktop_proxy_ready,
self);
gnome_session_manager_proxy_new_for_bus (G_BUS_TYPE_SESSION,
diff --git a/tests/backend-dbus/mock-end-session-dialog.cc b/tests/backend-dbus/mock-end-session-dialog.cc
index 2772423..5e8797f 100644
--- a/tests/backend-dbus/mock-end-session-dialog.cc
+++ b/tests/backend-dbus/mock-end-session-dialog.cc
@@ -39,7 +39,7 @@ MockEndSessionDialog :: handle_open (EndSessionDialog * object,
namespace
{
- const char * const MY_NAME = "com.canonical.Unity";
+ const char * const MY_NAME = "org.ayatana.Desktop";
const char * const MY_PATH = "/org/gnome/SessionManager/EndSessionDialog";
}
diff --git a/tests/backend-dbus/mock-unity-session.cc b/tests/backend-dbus/mock-unity-session.cc
index d32e339..8bc06a3 100644
--- a/tests/backend-dbus/mock-unity-session.cc
+++ b/tests/backend-dbus/mock-unity-session.cc
@@ -21,32 +21,32 @@
gboolean
-MockUnitySession :: handle_lock (UnitySession * us,
+MockUnitySession :: handle_lock (DesktopSession * us,
GDBusMethodInvocation * inv,
gpointer gself)
{
static_cast<MockUnitySession*>(gself)->my_last_action = Lock;
- unity_session_complete_lock (us, inv);
+ desktop_session_complete_lock (us, inv);
return true;
}
gboolean
-MockUnitySession :: handle_prompt_lock (UnitySession * us,
+MockUnitySession :: handle_prompt_lock (DesktopSession * us,
GDBusMethodInvocation * inv,
gpointer gself)
{
static_cast<MockUnitySession*>(gself)->my_last_action = PromptLock;
- unity_session_complete_prompt_lock (us, inv);
+ desktop_session_complete_prompt_lock (us, inv);
return true;
}
gboolean
-MockUnitySession :: handle_request_logout (UnitySession * us,
+MockUnitySession :: handle_request_logout (DesktopSession * us,
GDBusMethodInvocation * inv,
gpointer gself)
{
static_cast<MockUnitySession*>(gself)->my_last_action = RequestLogout;
- unity_session_complete_request_logout (us, inv);
+ desktop_session_complete_request_logout (us, inv);
return true;
}
@@ -56,15 +56,15 @@ MockUnitySession :: handle_request_logout (UnitySession * us,
namespace
{
- const char * const UNITY_SESSION_NAME = "com.canonical.Unity";
- const char * const UNITY_SESSION_PATH = "/com/canonical/Unity/Session";
+ const char * const UNITY_SESSION_NAME = "org.ayatana.Desktop";
+ const char * const UNITY_SESSION_PATH = "/org/ayatana/Desktop/Session";
}
MockUnitySession :: MockUnitySession (GMainLoop * loop,
GDBusConnection * bus_connection):
MockObject (loop, bus_connection, UNITY_SESSION_NAME, UNITY_SESSION_PATH),
- my_skeleton (unity_session_skeleton_new ()),
+ my_skeleton (desktop_session_skeleton_new ()),
my_last_action (None)
{
g_signal_connect (my_skeleton, "handle-lock",
diff --git a/tests/backend-dbus/mock-unity-session.h b/tests/backend-dbus/mock-unity-session.h
index 9ca5fe9..890f2ac 100644
--- a/tests/backend-dbus/mock-unity-session.h
+++ b/tests/backend-dbus/mock-unity-session.h
@@ -21,7 +21,7 @@
#define MOCK_UNITY_SESSION_H
#include "mock-object.h" // parent class
-#include "backend-dbus/unity-session.h" // Unity Session
+#include "backend-dbus/desktop-session.h" // Desktop Session
class MockUnitySession: public MockObject
{
@@ -39,16 +39,16 @@ class MockUnitySession: public MockObject
private:
- UnitySession * my_skeleton;
+ DesktopSession * my_skeleton;
Action my_last_action;
- static gboolean handle_lock (UnitySession *,
+ static gboolean handle_lock (DesktopSession *,
GDBusMethodInvocation *,
gpointer);
- static gboolean handle_prompt_lock (UnitySession *,
+ static gboolean handle_prompt_lock (DesktopSession *,
GDBusMethodInvocation *,
gpointer);
- static gboolean handle_request_logout (UnitySession *,
+ static gboolean handle_request_logout (DesktopSession *,
GDBusMethodInvocation *,
gpointer);
diff --git a/tests/backend-dbus/test-actions.cc b/tests/backend-dbus/test-actions.cc
index 76a0ab4..709273a 100644
--- a/tests/backend-dbus/test-actions.cc
+++ b/tests/backend-dbus/test-actions.cc
@@ -265,8 +265,8 @@ TEST_F (Actions, PowerOff)
TEST_F (Actions, LogoutUnity)
{
- MockUnitySession unity_session(loop, conn);
- ASSERT_EQ (MockUnitySession::None, unity_session.last_action());
+ MockUnitySession desktop_session(loop, conn);
+ ASSERT_EQ (MockUnitySession::None, desktop_session.last_action());
wait_msec();
// confirm that user is prompted
@@ -276,7 +276,7 @@ TEST_F (Actions, LogoutUnity)
ASSERT_TRUE (end_session_dialog->is_open());
end_session_dialog->cancel();
wait_msec (50);
- ASSERT_EQ (MockUnitySession::None, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::None, desktop_session.last_action());
// confirm that user is prompted
// and that logout is called when user confirms the logout dialog
@@ -285,19 +285,19 @@ TEST_F (Actions, LogoutUnity)
ASSERT_TRUE (end_session_dialog->is_open ());
end_session_dialog->confirm_logout ();
wait_msec (100);
- ASSERT_EQ (MockUnitySession::RequestLogout, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::RequestLogout, desktop_session.last_action());
// confirm that we try to call SessionManager::LogoutQuet
// when prompts are disabled
login1_manager->clear_last_action ();
- unity_session.clear_last_action ();
+ desktop_session.clear_last_action ();
ASSERT_EQ ("", login1_manager->last_action());
- ASSERT_EQ (MockUnitySession::None, unity_session.last_action ());
+ ASSERT_EQ (MockUnitySession::None, desktop_session.last_action ());
g_settings_set_boolean (indicator_settings, SUPPRESS_KEY, TRUE);
wait_msec (50);
indicator_session_actions_logout (actions);
wait_msec (50);
- ASSERT_EQ (MockUnitySession::RequestLogout, unity_session.last_action ());
+ ASSERT_EQ (MockUnitySession::RequestLogout, desktop_session.last_action ());
g_settings_reset (indicator_settings, SUPPRESS_KEY);
}
@@ -356,29 +356,29 @@ TEST_F (Actions, Hibernate)
TEST_F (Actions, SwitchToScreensaver)
{
- MockUnitySession unity_session(loop, conn);
+ MockUnitySession desktop_session(loop, conn);
- ASSERT_EQ (MockUnitySession::None, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::None, desktop_session.last_action());
indicator_session_actions_switch_to_screensaver (actions);
wait_msec (50);
- ASSERT_EQ (MockUnitySession::Lock, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::Lock, desktop_session.last_action());
}
TEST_F (Actions, SwitchToGreeter)
{
- MockUnitySession unity_session(loop, conn);
+ MockUnitySession desktop_session(loop, conn);
ASSERT_NE (MockDisplayManagerSeat::GREETER, dm_seat->last_action());
- ASSERT_EQ (MockUnitySession::None, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::None, desktop_session.last_action());
indicator_session_actions_switch_to_greeter (actions);
wait_msec (50);
- ASSERT_EQ (MockUnitySession::PromptLock, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::PromptLock, desktop_session.last_action());
ASSERT_EQ (MockDisplayManagerSeat::GREETER, dm_seat->last_action());
}
TEST_F (Actions, SwitchToGuest)
{
- MockUnitySession unity_session(loop, conn);
+ MockUnitySession desktop_session(loop, conn);
// allow guests
dm_seat->set_guest_allowed (true);
@@ -394,12 +394,12 @@ TEST_F (Actions, SwitchToGuest)
wait_for_signal (login1_seat->skeleton(), "notify::active-session");
ASSERT_EQ (guest_session_tag, login1_seat->active_session());
wait_msec (50);
- ASSERT_EQ (MockUnitySession::PromptLock, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::PromptLock, desktop_session.last_action());
}
TEST_F (Actions, SwitchToUsername)
{
- MockUnitySession unity_session(loop, conn);
+ MockUnitySession desktop_session(loop, conn);
const char * const dr1_username = "whartnell";
const char * const dr2_username = "ptroughton";
MockUser * dr1_user;
@@ -417,7 +417,7 @@ TEST_F (Actions, SwitchToUsername)
wait_for_signal (login1_seat->skeleton(), "notify::active-session");
ASSERT_EQ (dr1_session, login1_seat->active_session());
wait_msec (50);
- ASSERT_EQ (MockUnitySession::PromptLock, unity_session.last_action());
+ ASSERT_EQ (MockUnitySession::PromptLock, desktop_session.last_action());
indicator_session_actions_switch_to_username (actions, dr2_username);
wait_for_signal (login1_seat->skeleton(), "notify::active-session");