mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
dbus-session: Rename client_vanished() to close()
This means the MetaDbusSession interface takes a more active role instead of being something that more or less sends signals to the interface implementor. This will allow better control when using MetaDbusSession to manage these sessions, instead of their non-abstract variants. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2713>
This commit is contained in:
parent
abdd8c54f3
commit
7874bea068
@ -57,12 +57,6 @@ typedef struct _MetaDbusSessionClient
|
|||||||
GList *sessions;
|
GList *sessions;
|
||||||
} MetaDbusSessionClient;
|
} MetaDbusSessionClient;
|
||||||
|
|
||||||
static void
|
|
||||||
meta_dbus_session_client_vanished (MetaDbusSession *session)
|
|
||||||
{
|
|
||||||
META_DBUS_SESSION_GET_IFACE (session)->client_vanished (session);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_dbus_session_client_destroy (MetaDbusSessionClient *client)
|
meta_dbus_session_client_destroy (MetaDbusSessionClient *client)
|
||||||
{
|
{
|
||||||
@ -77,11 +71,7 @@ meta_dbus_session_client_destroy (MetaDbusSessionClient *client)
|
|||||||
|
|
||||||
session = l->data;
|
session = l->data;
|
||||||
|
|
||||||
/*
|
meta_dbus_session_close (session);
|
||||||
* This will invoke on_session_closed which removes the session from the
|
|
||||||
* list.
|
|
||||||
*/
|
|
||||||
meta_dbus_session_client_vanished (session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->name_watcher_id)
|
if (client->name_watcher_id)
|
||||||
@ -235,3 +225,9 @@ meta_dbus_session_watcher_class_init (MetaDbusSessionWatcherClass *klass)
|
|||||||
|
|
||||||
object_class->finalize = meta_dbus_session_watcher_finalize;
|
object_class->finalize = meta_dbus_session_watcher_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_dbus_session_close (MetaDbusSession *session)
|
||||||
|
{
|
||||||
|
META_DBUS_SESSION_GET_IFACE (session)->close (session);
|
||||||
|
}
|
||||||
|
@ -34,7 +34,7 @@ struct _MetaDbusSessionInterface
|
|||||||
{
|
{
|
||||||
GTypeInterface parent_iface;
|
GTypeInterface parent_iface;
|
||||||
|
|
||||||
void (* client_vanished) (MetaDbusSession *session);
|
void (* close) (MetaDbusSession *session);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define META_TYPE_DBUS_SESSION_WATCHER (meta_dbus_session_watcher_get_type ())
|
#define META_TYPE_DBUS_SESSION_WATCHER (meta_dbus_session_watcher_get_type ())
|
||||||
@ -49,4 +49,6 @@ void meta_dbus_session_watcher_watch_session (MetaDbusSessionWatcher *session_wa
|
|||||||
|
|
||||||
void meta_dbus_session_notify_closed (MetaDbusSession *session);
|
void meta_dbus_session_notify_closed (MetaDbusSession *session);
|
||||||
|
|
||||||
|
void meta_dbus_session_close (MetaDbusSession *session);
|
||||||
|
|
||||||
#endif /* META_DBUS_SESSION_WATCHER_H */
|
#endif /* META_DBUS_SESSION_WATCHER_H */
|
||||||
|
@ -207,9 +207,11 @@ meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
meta_remote_desktop_session_close (MetaRemoteDesktopSession *session)
|
meta_remote_desktop_session_close (MetaDbusSession *dbus_session)
|
||||||
{
|
{
|
||||||
|
MetaRemoteDesktopSession *session =
|
||||||
|
META_REMOTE_DESKTOP_SESSION (dbus_session);
|
||||||
MetaDBusRemoteDesktopSession *skeleton =
|
MetaDBusRemoteDesktopSession *skeleton =
|
||||||
META_DBUS_REMOTE_DESKTOP_SESSION (session);
|
META_DBUS_REMOTE_DESKTOP_SESSION (session);
|
||||||
|
|
||||||
@ -217,9 +219,12 @@ meta_remote_desktop_session_close (MetaRemoteDesktopSession *session)
|
|||||||
|
|
||||||
if (session->screen_cast_session)
|
if (session->screen_cast_session)
|
||||||
{
|
{
|
||||||
|
MetaDbusSession *screen_cast_session =
|
||||||
|
META_DBUS_SESSION (session->screen_cast_session);
|
||||||
|
|
||||||
g_clear_signal_handler (&session->screen_cast_session_closed_handler_id,
|
g_clear_signal_handler (&session->screen_cast_session_closed_handler_id,
|
||||||
session->screen_cast_session);
|
session->screen_cast_session);
|
||||||
meta_screen_cast_session_close (session->screen_cast_session);
|
meta_dbus_session_close (screen_cast_session);
|
||||||
session->screen_cast_session = NULL;
|
session->screen_cast_session = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +264,7 @@ on_screen_cast_session_closed (MetaScreenCastSession *screen_cast_session,
|
|||||||
MetaRemoteDesktopSession *session)
|
MetaRemoteDesktopSession *session)
|
||||||
{
|
{
|
||||||
session->screen_cast_session = NULL;
|
session->screen_cast_session = NULL;
|
||||||
meta_remote_desktop_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -384,7 +389,7 @@ handle_start (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
error->message);
|
error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
||||||
meta_remote_desktop_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -416,7 +421,7 @@ handle_stop (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_remote_desktop_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
|
|
||||||
meta_dbus_remote_desktop_session_complete_stop (skeleton, invocation);
|
meta_dbus_remote_desktop_session_complete_stop (skeleton, invocation);
|
||||||
|
|
||||||
@ -1675,16 +1680,10 @@ meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface
|
|||||||
iface->handle_selection_read = handle_selection_read;
|
iface->handle_selection_read = handle_selection_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
meta_remote_desktop_session_client_vanished (MetaDbusSession *dbus_session)
|
|
||||||
{
|
|
||||||
meta_remote_desktop_session_close (META_REMOTE_DESKTOP_SESSION (dbus_session));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_dbus_session_init_iface (MetaDbusSessionInterface *iface)
|
meta_dbus_session_init_iface (MetaDbusSessionInterface *iface)
|
||||||
{
|
{
|
||||||
iface->client_vanished = meta_remote_desktop_session_client_vanished;
|
iface->close = meta_remote_desktop_session_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1759,7 +1758,7 @@ meta_remote_desktop_session_handle_stop (MetaRemoteAccessHandle *handle)
|
|||||||
if (!session)
|
if (!session)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_remote_desktop_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -51,8 +51,6 @@ void meta_remote_desktop_session_request_transfer (MetaRemoteDesktopSession *se
|
|||||||
const char *mime_type,
|
const char *mime_type,
|
||||||
GTask *task);
|
GTask *task);
|
||||||
|
|
||||||
void meta_remote_desktop_session_close (MetaRemoteDesktopSession *session);
|
|
||||||
|
|
||||||
MetaRemoteDesktopSession * meta_remote_desktop_session_new (MetaRemoteDesktop *remote_desktop,
|
MetaRemoteDesktopSession * meta_remote_desktop_session_new (MetaRemoteDesktop *remote_desktop,
|
||||||
const char *peer_name,
|
const char *peer_name,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
@ -88,7 +88,7 @@ meta_remote_desktop_inhibit (MetaRemoteDesktop *remote_desktop)
|
|||||||
MetaRemoteDesktopSession *session = value;
|
MetaRemoteDesktopSession *session = value;
|
||||||
|
|
||||||
g_hash_table_iter_steal (&iter);
|
g_hash_table_iter_steal (&iter);
|
||||||
meta_remote_desktop_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ on_prepare_shutdown (MetaBackend *backend,
|
|||||||
MetaRemoteDesktopSession *session = value;
|
MetaRemoteDesktopSession *session = value;
|
||||||
|
|
||||||
g_hash_table_iter_steal (&iter);
|
g_hash_table_iter_steal (&iter);
|
||||||
meta_remote_desktop_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,9 +130,10 @@ meta_screen_cast_session_is_active (MetaScreenCastSession *session)
|
|||||||
return session->is_active;
|
return session->is_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
meta_screen_cast_session_close (MetaScreenCastSession *session)
|
meta_screen_cast_session_close (MetaDbusSession *dbus_session)
|
||||||
{
|
{
|
||||||
|
MetaScreenCastSession *session = META_SCREEN_CAST_SESSION (dbus_session);
|
||||||
MetaDBusScreenCastSession *skeleton = META_DBUS_SCREEN_CAST_SESSION (session);
|
MetaDBusScreenCastSession *skeleton = META_DBUS_SCREEN_CAST_SESSION (session);
|
||||||
|
|
||||||
session->is_active = FALSE;
|
session->is_active = FALSE;
|
||||||
@ -287,7 +288,7 @@ handle_stop (MetaDBusScreenCastSession *skeleton,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_screen_cast_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
|
|
||||||
meta_dbus_screen_cast_session_complete_stop (skeleton, invocation);
|
meta_dbus_screen_cast_session_complete_stop (skeleton, invocation);
|
||||||
|
|
||||||
@ -298,7 +299,7 @@ static void
|
|||||||
on_stream_closed (MetaScreenCastStream *stream,
|
on_stream_closed (MetaScreenCastStream *stream,
|
||||||
MetaScreenCastSession *session)
|
MetaScreenCastSession *session)
|
||||||
{
|
{
|
||||||
meta_screen_cast_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -710,16 +711,10 @@ meta_screen_cast_session_init_iface (MetaDBusScreenCastSessionIface *iface)
|
|||||||
iface->handle_record_virtual = handle_record_virtual;
|
iface->handle_record_virtual = handle_record_virtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
meta_screen_cast_session_client_vanished (MetaDbusSession *dbus_session)
|
|
||||||
{
|
|
||||||
meta_screen_cast_session_close (META_SCREEN_CAST_SESSION (dbus_session));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_dbus_session_init_iface (MetaDbusSessionInterface *iface)
|
meta_dbus_session_init_iface (MetaDbusSessionInterface *iface)
|
||||||
{
|
{
|
||||||
iface->client_vanished = meta_screen_cast_session_client_vanished;
|
iface->close = meta_screen_cast_session_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaScreenCastSession *
|
MetaScreenCastSession *
|
||||||
@ -822,7 +817,7 @@ meta_screen_cast_session_handle_stop (MetaRemoteAccessHandle *handle)
|
|||||||
if (!session)
|
if (!session)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_screen_cast_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -61,8 +61,6 @@ gboolean meta_screen_cast_session_start (MetaScreenCastSession *session,
|
|||||||
|
|
||||||
gboolean meta_screen_cast_session_is_active (MetaScreenCastSession *session);
|
gboolean meta_screen_cast_session_is_active (MetaScreenCastSession *session);
|
||||||
|
|
||||||
void meta_screen_cast_session_close (MetaScreenCastSession *session);
|
|
||||||
|
|
||||||
MetaScreenCastStream * meta_screen_cast_session_get_stream (MetaScreenCastSession *session,
|
MetaScreenCastStream * meta_screen_cast_session_get_stream (MetaScreenCastSession *session,
|
||||||
const char *path);
|
const char *path);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ meta_screen_cast_inhibit (MetaScreenCast *screen_cast)
|
|||||||
{
|
{
|
||||||
MetaScreenCastSession *session = screen_cast->sessions->data;
|
MetaScreenCastSession *session = screen_cast->sessions->data;
|
||||||
|
|
||||||
meta_screen_cast_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ on_prepare_shutdown (MetaBackend *backend,
|
|||||||
|
|
||||||
if (meta_screen_cast_session_get_session_type (session) !=
|
if (meta_screen_cast_session_get_session_type (session) !=
|
||||||
META_SCREEN_CAST_SESSION_TYPE_REMOTE_DESKTOP)
|
META_SCREEN_CAST_SESSION_TYPE_REMOTE_DESKTOP)
|
||||||
meta_screen_cast_session_close (session);
|
meta_dbus_session_close (META_DBUS_SESSION (session));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user