[gtk+/wip/matthiasc/gdk-settings: 1/12] gdk: Add settings api to GdkDisplay



commit 61d13b0f1470dac00caba168ab72c2b14e4f0634
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 30 09:00:49 2017 -0400

    gdk: Add settings api to GdkDisplay
    
    This commit adds gdk_display_get_setting and a ::setting-changed
    signal, which will replace the settings event we use now. Note
    that I've done away with the GdkSettingAction argument that the
    event has, since we are not using it at all.

 gdk/gdkdisplay.c        |   24 ++++++++++++++++++++++++
 gdk/gdkdisplay.h        |    6 ++++++
 gdk/gdkdisplayprivate.h |    7 +++++--
 3 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 5e75773..f8989c6 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -84,6 +84,7 @@ enum {
   SEAT_REMOVED,
   MONITOR_ADDED,
   MONITOR_REMOVED,
+  SETTING_CHANGED,
   LAST_SIGNAL
 };
 
@@ -341,6 +342,14 @@ gdk_display_class_init (GdkDisplayClass *class)
                  0, NULL, NULL,
                   g_cclosure_marshal_VOID__OBJECT,
                  G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
+
+  signals[SETTING_CHANGED] =
+    g_signal_new (g_intern_static_string ("setting-changed"),
+                 G_OBJECT_CLASS_TYPE (object_class),
+                 G_SIGNAL_RUN_LAST,
+                 0, NULL, NULL,
+                  NULL,
+                 G_TYPE_NONE, 1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
 }
 
 static void
@@ -2223,3 +2232,18 @@ gdk_display_emit_opened (GdkDisplay *display)
 {
   g_signal_emit (display, signals[OPENED], 0);
 }
+
+gboolean
+gdk_display_get_setting (GdkDisplay *display,
+                         const char *name,
+                         GValue     *value)
+{
+  return gdk_screen_get_setting (gdk_display_get_default_screen (display), name, value);
+}
+
+void
+gdk_display_setting_changed (GdkDisplay       *display,
+                             const char       *name)
+{
+  g_signal_emit (display, signals[SETTING_CHANGED], 0, name);
+}
diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h
index d099ab4..d916848 100644
--- a/gdk/gdkdisplay.h
+++ b/gdk/gdkdisplay.h
@@ -154,6 +154,12 @@ GDK_AVAILABLE_IN_3_22
 GdkMonitor * gdk_display_get_monitor_at_window (GdkDisplay *display,
                                                 GdkWindow  *window);
 
+GDK_AVAILABLE_IN_3_94
+gboolean     gdk_display_get_setting (GdkDisplay *display,
+                                      const char *name,
+                                      GValue     *value);
+
+
 
 G_END_DECLS
 
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index cd3ef34..16969e4 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -225,8 +225,8 @@ struct _GdkDisplayClass
 
   /* Signals */
   void                   (*opened)                     (GdkDisplay     *display);
-  void (*closed) (GdkDisplay *display,
-                  gboolean    is_error);
+  void                   (*closed)                     (GdkDisplay     *display,
+                                                        gboolean        is_error);
 };
 
 
@@ -303,6 +303,9 @@ void                gdk_display_monitor_removed       (GdkDisplay       *display
                                                        GdkMonitor       *monitor);
 void                gdk_display_emit_opened           (GdkDisplay       *display);
 
+void                gdk_display_setting_changed       (GdkDisplay       *display,
+                                                       const char       *name);
+
 G_END_DECLS
 
 #endif  /* __GDK_DISPLAY_PRIVATE_H__ */


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