[gtk+] gdk: Remove new gdk_display_manager_peek() API



commit 01c810b4d75d1ed4502287fb30794f10116e3a59
Author: Benjamin Otte <otte redhat com>
Date:   Thu May 2 16:27:47 2013 +0200

    gdk: Remove new gdk_display_manager_peek() API
    
    It's not necessary anymore because gdk_display_manager_get() always
    succeeds and the value is independant of when it was called as it's no
    longer backend specific.

 gdk/gdk.c               |    3 --
 gdk/gdkdisplaymanager.c |   57 ++++++++++++++---------------------------------
 gdk/gdkdisplaymanager.h |    2 -
 gtk/gtkmodules.c        |   19 ++++++---------
 4 files changed, 25 insertions(+), 56 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 711a096..01a4b7a 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -382,9 +382,6 @@ gdk_display_open_default_libgtk_only (void)
 
   g_return_val_if_fail (gdk_initialized, NULL);
 
-  if (gdk_display_manager_peek () == NULL)
-    return NULL;
-
   display = gdk_display_get_default ();
   if (display)
     return display;
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index cbc3ab2..4dfaeb1 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -253,36 +253,6 @@ gdk_set_allowed_backends (const gchar *backends)
   allowed_backends = g_strdup (backends);
 }
 
-static GdkDisplayManager *manager = NULL;
-
-/**
- * gdk_display_manager_get:
- *
- * Gets the singleton #GdkDisplayManager object.
- *
- * When called for the first time, this function consults the
- * <envar>GDK_BACKEND</envar> environment variable to find out which
- * of the supported GDK backends to use (in case GDK has been compiled
- * with multiple backends). Applications can use gdk_set_allowed_backends()
- * to limit what backends can be used.
- *
- * Returns: (transfer none): The global #GdkDisplayManager singleton;
- *     gdk_parse_args(), gdk_init(), or gdk_init_check() must have
- *     been called first.
- *
- * Since: 2.2
- **/
-GdkDisplayManager*
-gdk_display_manager_get (void)
-{
-  gdk_display_manager_peek ();
-
-  if (manager == NULL)
-    g_error ("No GDK backend found (%s)", allowed_backends);
-
-  return manager;
-}
-
 typedef struct _GdkBackend GdkBackend;
 
 struct _GdkBackend {
@@ -311,20 +281,27 @@ static GdkBackend gdk_backends[] = {
 };
 
 /**
- * gdk_display_manager_peek:
+ * gdk_display_manager_get:
  *
- * Gets the singleton #GdkDisplayManager object. If GDK could
- * not be initialized, %NULL is returned.
+ * Gets the singleton #GdkDisplayManager object.
+ *
+ * When called for the first time, this function consults the
+ * <envar>GDK_BACKEND</envar> environment variable to find out which
+ * of the supported GDK backends to use (in case GDK has been compiled
+ * with multiple backends). Applications can use gdk_set_allowed_backends()
+ * to limit what backends can be used.
  *
- * Returns: (transfer none): The global #GdkDisplayManager singleton,
- *     or %NULL if GDK could not be initialized. gdk_parse_args(),
- *     gdk_init(), or gdk_init_check() must have been called first
+ * Returns: (transfer none): The global #GdkDisplayManager singleton;
+ *     gdk_parse_args(), gdk_init(), or gdk_init_check() must have
+ *     been called first.
  *
- * Since: 3.10
- */
-GdkDisplayManager *
-gdk_display_manager_peek (void)
+ * Since: 2.2
+ **/
+GdkDisplayManager*
+gdk_display_manager_get (void)
 {
+  static GdkDisplayManager *manager = NULL;
+
   if (manager == NULL)
     manager = g_object_new (GDK_TYPE_DISPLAY_MANAGER, NULL);
   
diff --git a/gdk/gdkdisplaymanager.h b/gdk/gdkdisplaymanager.h
index 4392af0..419b3f5 100644
--- a/gdk/gdkdisplaymanager.h
+++ b/gdk/gdkdisplaymanager.h
@@ -43,8 +43,6 @@ G_BEGIN_DECLS
 GType              gdk_display_manager_get_type            (void) G_GNUC_CONST;
 
 GdkDisplayManager *gdk_display_manager_get                 (void);
-GDK_AVAILABLE_IN_3_10
-GdkDisplayManager *gdk_display_manager_peek                (void);
 GdkDisplay *       gdk_display_manager_get_default_display (GdkDisplayManager *manager);
 void               gdk_display_manager_set_default_display (GdkDisplayManager *manager,
                                                             GdkDisplay        *display);
diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
index e19f79d..f363cb2 100644
--- a/gtk/gtkmodules.c
+++ b/gtk/gtkmodules.c
@@ -525,17 +525,14 @@ _gtk_modules_init (gint        *argc,
       gtk_argv [*argc] = NULL;
     }
 
-  display_manager = gdk_display_manager_peek ();
-  if (display_manager != NULL)
-    {
-      default_display_opened = gdk_display_get_default () != NULL;
-      g_signal_connect (display_manager, "notify::default-display",
-                        G_CALLBACK (default_display_notify_cb),
-                        NULL);
-      g_signal_connect (display_manager, "display-opened",
-                        G_CALLBACK (display_opened_cb),
-                        NULL);
-    }
+  display_manager = gdk_display_manager_get ();
+  default_display_opened = gdk_display_get_default () != NULL;
+  g_signal_connect (display_manager, "notify::default-display",
+                    G_CALLBACK (default_display_notify_cb),
+                    NULL);
+  g_signal_connect (display_manager, "display-opened",
+                    G_CALLBACK (display_opened_cb),
+                    NULL);
 
   if (gtk_modules_args)
     {


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