[gtk/getters-and-setters: 1/4] Add a getter for GdkAppLaunchContext::display



commit 4ca0a933242b8fa4597380de4d27396eb4d207f4
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 24 07:39:20 2020 -0500

    Add a getter for GdkAppLaunchContext::display

 docs/reference/gdk/gdk4-sections.txt |  1 +
 gdk/gdkapplaunchcontext.c            | 30 +++++++++++++++++++++++-------
 gdk/gdkapplaunchcontext.h            |  4 ++++
 3 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 7a065041db..e2943f152d 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -994,6 +994,7 @@ gdk_wayland_surface_get_type
 <TITLE>Application launching</TITLE>
 <FILE>gdkapplaunchcontext</FILE>
 GdkAppLaunchContext
+gdk_app_launch_context_get_display
 gdk_app_launch_context_set_desktop
 gdk_app_launch_context_set_timestamp
 gdk_app_launch_context_set_icon
diff --git a/gdk/gdkapplaunchcontext.c b/gdk/gdkapplaunchcontext.c
index 97c72aad4f..7a7e3956ae 100644
--- a/gdk/gdkapplaunchcontext.c
+++ b/gdk/gdkapplaunchcontext.c
@@ -60,9 +60,9 @@
  */
 
 static void    gdk_app_launch_context_finalize    (GObject           *object);
-static gchar * gdk_app_launch_context_get_display (GAppLaunchContext *context,
-                                                   GAppInfo          *info,
-                                                   GList             *files);
+static gchar * gdk_app_launch_context_get_display_name (GAppLaunchContext *context,
+                                                        GAppInfo          *info,
+                                                        GList             *files);
 static gchar * gdk_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
                                                              GAppInfo          *info,
                                                              GList             *files);
@@ -125,7 +125,7 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
 
   gobject_class->finalize = gdk_app_launch_context_finalize;
 
-  context_class->get_display = gdk_app_launch_context_get_display;
+  context_class->get_display = gdk_app_launch_context_get_display_name;
   context_class->get_startup_notify_id = gdk_app_launch_context_get_startup_notify_id;
   context_class->launch_failed = gdk_app_launch_context_launch_failed;
 
@@ -158,9 +158,9 @@ gdk_app_launch_context_finalize (GObject *object)
 }
 
 static gchar *
-gdk_app_launch_context_get_display (GAppLaunchContext *context,
-                                    GAppInfo          *info,
-                                    GList             *files)
+gdk_app_launch_context_get_display_name (GAppLaunchContext *context,
+                                         GAppInfo          *info,
+                                         GList             *files)
 {
   GdkAppLaunchContext *ctx = GDK_APP_LAUNCH_CONTEXT (context);
   GdkDisplay *display;
@@ -173,6 +173,22 @@ gdk_app_launch_context_get_display (GAppLaunchContext *context,
   return g_strdup (gdk_display_get_name (display));
 }
 
+/**
+ * gdk_app_launch_context_get_display:
+ * @context: a #GdkAppLaunchContext
+ *
+ * Gets the #GdkDispolat that @context is for.
+ *
+ * Returns: the display of @context
+ */
+GdkDisplay *
+gdk_app_launch_context_get_display (GdkAppLaunchContext *context)
+{
+  g_return_val_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context), NULL);
+
+  return context->display;
+}
+
 /**
  * gdk_app_launch_context_set_desktop:
  * @context: a #GdkAppLaunchContext
diff --git a/gdk/gdkapplaunchcontext.h b/gdk/gdkapplaunchcontext.h
index 6109480ed0..575a867501 100644
--- a/gdk/gdkapplaunchcontext.h
+++ b/gdk/gdkapplaunchcontext.h
@@ -38,6 +38,9 @@ G_BEGIN_DECLS
 GDK_AVAILABLE_IN_ALL
 GType                gdk_app_launch_context_get_type      (void);
 
+GDK_AVAILABLE_IN_ALL
+GdkDisplay *         gdk_app_launch_context_get_display   (GdkAppLaunchContext *context);
+
 GDK_AVAILABLE_IN_ALL
 void                 gdk_app_launch_context_set_desktop   (GdkAppLaunchContext *context,
                                                            gint                 desktop);
@@ -51,6 +54,7 @@ GDK_AVAILABLE_IN_ALL
 void                 gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
                                                            const char          *icon_name);
 
+
 G_END_DECLS
 
 #endif /* __GDK_APP_LAUNCH_CONTEXT_H__ */


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