[totem/wip/hadess/simplify-plugins: 6/18] im-status: Stop using intermediate private struct
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/simplify-plugins: 6/18] im-status: Stop using intermediate private struct
- Date: Mon, 21 Feb 2022 10:20:28 +0000 (UTC)
commit f94dc689cf71126d74d48c1ba21035b36d8da99c
Author: Bastien Nocera <hadess hadess net>
Date: Mon Feb 21 09:49:40 2022 +0100
im-status: Stop using intermediate private struct
src/plugins/im-status/totem-im-status.c | 52 +++++++++++++++++----------------
1 file changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/src/plugins/im-status/totem-im-status.c b/src/plugins/im-status/totem-im-status.c
index 8400b1bc1..12b8d24c9 100644
--- a/src/plugins/im-status/totem-im-status.c
+++ b/src/plugins/im-status/totem-im-status.c
@@ -43,12 +43,14 @@
#define TOTEM_IM_STATUS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o),
TOTEM_TYPE_IM_STATUS_PLUGIN, TotemImStatusPlugin))
typedef struct {
+ PeasExtensionBase parent;
+
guint handler_id_fullscreen;
guint handler_id_playing;
GCancellable *cancellable;
gboolean idle; /* Whether we're idle */
GDBusProxy *proxy;
-} TotemImStatusPluginPrivate;
+} TotemImStatusPlugin;
enum {
STATUS_AVAILABLE = 0,
@@ -66,11 +68,11 @@ totem_im_status_set_idleness (TotemImStatusPlugin *pi,
GVariant *variant;
GError *error = NULL;
- if (pi->priv->idle == idle)
+ if (pi->idle == idle)
return;
- pi->priv->idle = idle;
- variant = g_dbus_proxy_call_sync (pi->priv->proxy,
+ pi->idle = idle;
+ variant = g_dbus_proxy_call_sync (pi->proxy,
"SetStatus",
g_variant_new ("(u)", idle ? STATUS_BUSY : STATUS_AVAILABLE),
G_DBUS_CALL_FLAGS_NONE,
@@ -90,7 +92,7 @@ totem_im_status_update_from_state (TotemObject *totem,
TotemImStatusPlugin *pi)
{
/* Session Proxy not ready yet */
- if (pi->priv->proxy == NULL)
+ if (pi->proxy == NULL)
return;
if (totem_object_is_playing (totem) != FALSE
@@ -125,9 +127,9 @@ got_proxy_cb (GObject *source_object,
return;
}
- pi->priv->proxy = proxy;
- g_object_unref (pi->priv->cancellable);
- pi->priv->cancellable = NULL;
+ pi->proxy = proxy;
+ g_object_unref (pi->cancellable);
+ pi->cancellable = NULL;
g_object_get (pi, "object", &totem, NULL);
totem_im_status_update_from_state (totem, pi);
@@ -140,7 +142,7 @@ impl_activate (PeasActivatable *plugin)
TotemImStatusPlugin *pi = TOTEM_IM_STATUS_PLUGIN (plugin);
TotemObject *totem;
- pi->priv->cancellable = g_cancellable_new ();
+ pi->cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
@@ -148,17 +150,17 @@ impl_activate (PeasActivatable *plugin)
"org.gnome.SessionManager",
"/org/gnome/SessionManager/Presence",
"org.gnome.SessionManager.Presence",
- pi->priv->cancellable,
+ pi->cancellable,
(GAsyncReadyCallback) got_proxy_cb,
pi);
g_object_get (plugin, "object", &totem, NULL);
- pi->priv->handler_id_fullscreen = g_signal_connect (G_OBJECT (totem),
+ pi->handler_id_fullscreen = g_signal_connect (G_OBJECT (totem),
"notify::fullscreen",
G_CALLBACK (property_notify_cb),
pi);
- pi->priv->handler_id_playing = g_signal_connect (G_OBJECT (totem),
+ pi->handler_id_playing = g_signal_connect (G_OBJECT (totem),
"notify::playing",
G_CALLBACK (property_notify_cb),
pi);
@@ -173,28 +175,28 @@ impl_deactivate (PeasActivatable *plugin)
TotemObject *totem;
/* In flight? */
- if (pi->priv->cancellable != NULL) {
- g_cancellable_cancel (pi->priv->cancellable);
- g_object_unref (pi->priv->cancellable);
- pi->priv->cancellable = NULL;
+ if (pi->cancellable != NULL) {
+ g_cancellable_cancel (pi->cancellable);
+ g_object_unref (pi->cancellable);
+ pi->cancellable = NULL;
}
- if (pi->priv->proxy != NULL) {
- g_object_unref (pi->priv->proxy);
- pi->priv->proxy = NULL;
+ if (pi->proxy != NULL) {
+ g_object_unref (pi->proxy);
+ pi->proxy = NULL;
}
g_object_get (plugin, "object", &totem, NULL);
- if (pi->priv->handler_id_fullscreen != 0) {
+ if (pi->handler_id_fullscreen != 0) {
g_signal_handler_disconnect (G_OBJECT (totem),
- pi->priv->handler_id_fullscreen);
- pi->priv->handler_id_fullscreen = 0;
+ pi->handler_id_fullscreen);
+ pi->handler_id_fullscreen = 0;
}
- if (pi->priv->handler_id_playing != 0) {
+ if (pi->handler_id_playing != 0) {
g_signal_handler_disconnect (G_OBJECT (totem),
- pi->priv->handler_id_playing);
- pi->priv->handler_id_playing = 0;
+ pi->handler_id_playing);
+ pi->handler_id_playing = 0;
}
g_object_unref (totem);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]