[gnome-desktop/jjardon/remove_unused_api: 15/15] gnome-idle-monitor: Remove API not supported in Wayland and not really used by anyone



commit 0aaffd7052fb183747c391add7f6068e04493e4d
Author: Javier Jardón <jjardon gnome org>
Date:   Sat Jan 11 18:40:54 2020 +0900

    gnome-idle-monitor: Remove API not supported in Wayland and not really used by anyone

 .../gnome-desktop3/gnome-desktop3-sections.txt     |   1 -
 libgnome-desktop/gnome-idle-monitor.c              | 101 +--------------------
 libgnome-desktop/gnome-idle-monitor.h              |   2 -
 3 files changed, 1 insertion(+), 103 deletions(-)
---
diff --git a/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt 
b/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt
index 182fa60a..39e46f20 100644
--- a/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt
+++ b/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt
@@ -115,7 +115,6 @@ GnomeIdleMonitor
 GnomeIdleMonitorClass
 GnomeIdleMonitorWatchFunc
 gnome_idle_monitor_new
-gnome_idle_monitor_new_for_device
 gnome_idle_monitor_add_idle_watch
 gnome_idle_monitor_add_user_active_watch
 gnome_idle_monitor_remove_watch
diff --git a/libgnome-desktop/gnome-idle-monitor.c b/libgnome-desktop/gnome-idle-monitor.c
index d7583a2b..7292a99d 100644
--- a/libgnome-desktop/gnome-idle-monitor.c
+++ b/libgnome-desktop/gnome-idle-monitor.c
@@ -45,7 +45,6 @@ struct _GnomeIdleMonitorPrivate
        int                  name_watch_id;
        GHashTable          *watches;
        GHashTable          *watches_by_upstream_id;
-       GdkDevice           *device;
        gchar               *path;
 };
 
@@ -62,15 +61,6 @@ typedef struct
        guint64                   timeout_msec;
 } GnomeIdleMonitorWatch;
 
-enum
-{
-       PROP_0,
-       PROP_DEVICE,
-       PROP_LAST,
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
 static void gnome_idle_monitor_initable_iface_init (GInitableIface *iface);
 static void gnome_idle_monitor_remove_watch_internal (GnomeIdleMonitor *monitor,
                                                      guint             id);
@@ -170,57 +160,11 @@ gnome_idle_monitor_dispose (GObject *object)
        g_clear_object (&monitor->priv->om);
        g_clear_pointer (&monitor->priv->watches, g_hash_table_destroy);
        g_clear_pointer (&monitor->priv->watches_by_upstream_id, g_hash_table_destroy);
-       g_clear_object (&monitor->priv->device);
        g_clear_pointer (&monitor->priv->path, g_free);
 
        G_OBJECT_CLASS (gnome_idle_monitor_parent_class)->dispose (object);
 }
 
-static void
-gnome_idle_monitor_get_property (GObject    *object,
-                                guint       prop_id,
-                                GValue     *value,
-                                GParamSpec *pspec)
-{
-       GnomeIdleMonitor *monitor = GNOME_IDLE_MONITOR (object);
-       switch (prop_id)
-       {
-       case PROP_DEVICE:
-               g_value_set_object (value, monitor->priv->device);
-               break;
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-               break;
-       }
-}
-
-static void
-gnome_idle_monitor_set_property (GObject      *object,
-                                guint         prop_id,
-                                const GValue *value,
-                                GParamSpec   *pspec)
-{
-       GnomeIdleMonitor *monitor = GNOME_IDLE_MONITOR (object);
-       switch (prop_id)
-       {
-       case PROP_DEVICE:
-               monitor->priv->device = g_value_dup_object (value);
-
-               g_free (monitor->priv->path);
-               if (monitor->priv->device) {
-                       monitor->priv->path = g_strdup_printf ("/org/gnome/Mutter/IdleMonitor/Device%d",
-                                                              gdk_x11_device_get_id (monitor->priv->device));
-               } else {
-                       monitor->priv->path = g_strdup ("/org/gnome/Mutter/IdleMonitor/Core");
-               }
-
-               break;
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-               break;
-       }
-}
-
 static void
 add_known_watch (gpointer key,
                 gpointer value,
@@ -378,21 +322,6 @@ gnome_idle_monitor_class_init (GnomeIdleMonitorClass *klass)
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
        object_class->dispose = gnome_idle_monitor_dispose;
-       object_class->get_property = gnome_idle_monitor_get_property;
-       object_class->set_property = gnome_idle_monitor_set_property;
-
-       /**
-        * GnomeIdleMonitor:device:
-        *
-        * The device to listen to idletime on.
-        */
-       obj_props[PROP_DEVICE] =
-               g_param_spec_object ("device",
-                                    "Device",
-                                    "The device to listen to idletime on",
-                                    GDK_TYPE_DEVICE,
-                                    G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-       g_object_class_install_property (object_class, PROP_DEVICE, obj_props[PROP_DEVICE]);
 }
 
 static void
@@ -413,8 +342,7 @@ gnome_idle_monitor_init (GnomeIdleMonitor *monitor)
  * gnome_idle_monitor_new:
  *
  * Returns: a new #GnomeIdleMonitor that tracks the server-global
- * idletime for all devices. To track device-specific idletime,
- * use gnome_idle_monitor_new_for_device().
+ * idletime for all devices.
  */
 GnomeIdleMonitor *
 gnome_idle_monitor_new (void)
@@ -422,33 +350,6 @@ gnome_idle_monitor_new (void)
        return GNOME_IDLE_MONITOR (g_initable_new (GNOME_TYPE_IDLE_MONITOR, NULL, NULL, NULL));
 }
 
-/**
- * gnome_idle_monitor_new_for_device:
- * @device: A #GdkDevice to get the idle time for.
- * @error: A pointer to a #GError or %NULL.
- *
- * Returns: a new #GnomeIdleMonitor that tracks the device-specific
- * idletime for @device. If device-specific idletime is not available,
- * %NULL is returned, and @error is set. To track server-global
- * idletime for all devices, use gnome_idle_monitor_new(). This function
- * only works under X11, not under Wayland and will return an error.
- */
-GnomeIdleMonitor *
-gnome_idle_monitor_new_for_device (GdkDevice  *device,
-                                  GError    **error)
-{
-#if defined(GDK_WINDOWING_WAYLAND)
-       if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) {
-               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-                                    "Per-device idle monitors not supported under Wayland");
-               return NULL;
-       }
-#endif
-
-       return GNOME_IDLE_MONITOR (g_initable_new (GNOME_TYPE_IDLE_MONITOR, NULL, error,
-                                                  "device", device, NULL));
-}
-
 static GnomeIdleMonitorWatch *
 make_watch (GnomeIdleMonitor          *monitor,
            guint64                    timeout_msec,
diff --git a/libgnome-desktop/gnome-idle-monitor.h b/libgnome-desktop/gnome-idle-monitor.h
index 167b9a19..806560ad 100644
--- a/libgnome-desktop/gnome-idle-monitor.h
+++ b/libgnome-desktop/gnome-idle-monitor.h
@@ -63,8 +63,6 @@ typedef void (*GnomeIdleMonitorWatchFunc) (GnomeIdleMonitor      *monitor,
 GType              gnome_idle_monitor_get_type     (void);
 
 GnomeIdleMonitor * gnome_idle_monitor_new          (void);
-GnomeIdleMonitor * gnome_idle_monitor_new_for_device (GdkDevice  *device,
-                                                     GError    **error);
 
 guint              gnome_idle_monitor_add_idle_watch    (GnomeIdleMonitor         *monitor,
                                                         guint64                   interval_msec,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]