[mutter/wip/carlosg/startup-sequences: 11/16] core: Make MetaStartupSequence/Notification public



commit 4d92979b436bbd9aabffebe63b204dee2c964963
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Aug 22 22:56:18 2018 +0200

    core: Make MetaStartupSequence/Notification public
    
    This will be preferred over SnStartupNotification, as exposed
    through MetaDisplay.

 src/Makefile.am                         |  2 +
 src/core/display.c                      |  6 +++
 src/core/startup-notification-private.h |  7 +--
 src/core/startup-notification.c         | 85 +++++++++++++++++++++++++++++++--
 src/meta/display.h                      |  2 +
 src/meta/meson.build                    |  1 +
 src/meta/meta-startup-notification.h    | 45 +++++++++++++++++
 7 files changed, 139 insertions(+), 9 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 5e08c1d61..2969f2ea0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -314,6 +314,7 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES =      \
        meta/prefs.h                            \
        core/startup-notification.c             \
        core/startup-notification-private.h     \
+       meta/meta-startup-notification.h        \
        meta/types.h                            \
        core/restart.c                          \
        core/stack.c                            \
@@ -575,6 +576,7 @@ libmutterinclude_headers =                  \
        meta/meta-shaped-texture.h              \
        meta/meta-shadow-factory.h              \
        meta/meta-stage.h                       \
+       meta/meta-startup-notification.h        \
        meta/meta-window-actor.h                \
        meta/meta-window-group.h                \
        meta/meta-window-shape.h                \
diff --git a/src/core/display.c b/src/core/display.c
index 22e3c796b..6243bf73a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -3644,3 +3644,9 @@ meta_display_get_workspace_manager (MetaDisplay *display)
 {
   return display->workspace_manager;
 }
+
+MetaStartupNotification *
+meta_display_get_startup_notification (MetaDisplay *display)
+{
+  return display->startup_notification;
+}
diff --git a/src/core/startup-notification-private.h b/src/core/startup-notification-private.h
index 334a55608..849c5de62 100644
--- a/src/core/startup-notification-private.h
+++ b/src/core/startup-notification-private.h
@@ -26,11 +26,8 @@
 #define META_STARTUP_NOTIFICATION_PRIVATE_H
 
 #include "core/display-private.h"
+#include "meta/meta-startup-notification.h"
 
-#define META_TYPE_STARTUP_NOTIFICATION (meta_startup_notification_get_type ())
-#define META_TYPE_STARTUP_SEQUENCE (meta_startup_sequence_get_type ())
-
-typedef struct _MetaStartupSequence MetaStartupSequence;
 typedef struct _MetaStartupSequenceClass MetaStartupSequenceClass;
 
 struct _MetaStartupSequenceClass
@@ -63,6 +60,4 @@ MetaStartupSequence *
          meta_startup_notification_lookup_sequence (MetaStartupNotification *sn,
                                                     const gchar             *id);
 
-GSList * meta_startup_notification_get_sequences   (MetaStartupNotification *sn);
-
 #endif /* META_STARTUP_NOTIFICATION_PRIVATE_H */
diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c
index 161c8c7b9..43260d59b 100644
--- a/src/core/startup-notification.c
+++ b/src/core/startup-notification.c
@@ -90,6 +90,7 @@ typedef struct {
   char *id;
   uint64_t timestamp;
   int workspace;
+  uint completed : 1;
 } MetaStartupSequencePrivate;
 
 G_DEFINE_TYPE (MetaStartupNotification,
@@ -288,35 +289,113 @@ meta_startup_sequence_class_init (MetaStartupSequenceClass *klass)
   g_object_class_install_properties (object_class, N_SEQ_PROPS, seq_props);
 }
 
-static const gchar *
+const char *
 meta_startup_sequence_get_id (MetaStartupSequence *seq)
 {
   MetaStartupSequencePrivate *priv;
 
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), NULL);
+
   priv = meta_startup_sequence_get_instance_private (seq);
   return priv->id;
 }
 
-static gint64
+uint64_t
 meta_startup_sequence_get_timestamp (MetaStartupSequence *seq)
 {
   MetaStartupSequencePrivate *priv;
 
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), 0);
+
   priv = meta_startup_sequence_get_instance_private (seq);
   return priv->timestamp;
 }
 
-static void
+void
 meta_startup_sequence_complete (MetaStartupSequence *seq)
 {
   MetaStartupSequenceClass *klass;
+  MetaStartupSequencePrivate *priv;
+
+  g_return_if_fail (META_IS_STARTUP_SEQUENCE (seq));
 
+  priv = meta_startup_sequence_get_instance_private (seq);
+  if (priv->completed)
+    return;
+
+  priv->completed = TRUE;
   klass = META_STARTUP_SEQUENCE_GET_CLASS (seq);
 
   if (klass->complete)
     klass->complete (seq);
 }
 
+gboolean
+meta_startup_sequence_get_completed (MetaStartupSequence *seq)
+{
+  MetaStartupSequencePrivate *priv;
+
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), FALSE);
+
+  priv = meta_startup_sequence_get_instance_private (seq);
+  return priv->completed;
+}
+
+const char *
+meta_startup_sequence_get_name (MetaStartupSequence *seq)
+{
+  MetaStartupSequencePrivate *priv;
+
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), NULL);
+
+  priv = meta_startup_sequence_get_instance_private (seq);
+  return priv->name;
+}
+
+int
+meta_startup_sequence_get_workspace (MetaStartupSequence *seq)
+{
+  MetaStartupSequencePrivate *priv;
+
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), 0);
+
+  priv = meta_startup_sequence_get_instance_private (seq);
+  return priv->workspace;
+}
+
+const char *
+meta_startup_sequence_get_icon_name (MetaStartupSequence *seq)
+{
+  MetaStartupSequencePrivate *priv;
+
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), NULL);
+
+  priv = meta_startup_sequence_get_instance_private (seq);
+  return priv->icon_name;
+}
+
+const char *
+meta_startup_sequence_get_application_id (MetaStartupSequence *seq)
+{
+  MetaStartupSequencePrivate *priv;
+
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), NULL);
+
+  priv = meta_startup_sequence_get_instance_private (seq);
+  return priv->application_id;
+}
+
+const char *
+meta_startup_sequence_get_wmclass (MetaStartupSequence *seq)
+{
+  MetaStartupSequencePrivate *priv;
+
+  g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), NULL);
+
+  priv = meta_startup_sequence_get_instance_private (seq);
+  return priv->wmclass;
+}
+
 void
 meta_startup_notification_add_sequence (MetaStartupNotification *sn,
                                         MetaStartupSequence     *seq)
diff --git a/src/meta/display.h b/src/meta/display.h
index 3b58aaf23..d8e460499 100644
--- a/src/meta/display.h
+++ b/src/meta/display.h
@@ -27,6 +27,7 @@
 #include <meta/prefs.h>
 #include <meta/common.h>
 #include <meta/workspace.h>
+#include <meta/meta-startup-notification.h>
 
 /**
  * MetaTabList:
@@ -225,5 +226,6 @@ typedef enum
 } MetaDisplayCorner;
 
 MetaWorkspaceManager *meta_display_get_workspace_manager (MetaDisplay *display);
+MetaStartupNotification * meta_display_get_startup_notification (MetaDisplay *display);
 
 #endif
diff --git a/src/meta/meson.build b/src/meta/meson.build
index 4fd1edc16..bdd77a08e 100644
--- a/src/meta/meson.build
+++ b/src/meta/meson.build
@@ -25,6 +25,7 @@ mutter_public_headers = [
   'meta-shadow-factory.h',
   'meta-shaped-texture.h',
   'meta-stage.h',
+  'meta-startup-notification.h',
   'meta-window-actor.h',
   'meta-window-group.h',
   'meta-window-shape.h',
diff --git a/src/meta/meta-startup-notification.h b/src/meta/meta-startup-notification.h
new file mode 100644
index 000000000..da2d60ab5
--- /dev/null
+++ b/src/meta/meta-startup-notification.h
@@ -0,0 +1,45 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2018 Red Hat, Inc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef META_STARTUP_NOTIFICATION_H
+#define META_STARTUP_NOTIFICATION_H
+
+#define META_TYPE_STARTUP_SEQUENCE (meta_startup_sequence_get_type ())
+#define META_TYPE_STARTUP_NOTIFICATION (meta_startup_notification_get_type ())
+
+typedef struct _MetaStartupNotification MetaStartupNotification;
+typedef struct _MetaStartupSequence MetaStartupSequence;
+
+GType         meta_startup_notification_get_type      (void);
+
+GSList *      meta_startup_notification_get_sequences (MetaStartupNotification *sn);
+
+GType         meta_startup_sequence_get_type          (void);
+
+const char * meta_startup_sequence_get_id             (MetaStartupSequence *sequence);
+gboolean     meta_startup_sequence_get_completed      (MetaStartupSequence *sequence);
+const char * meta_startup_sequence_get_name           (MetaStartupSequence *sequence);
+int          meta_startup_sequence_get_workspace      (MetaStartupSequence *sequence);
+uint64_t     meta_startup_sequence_get_timestamp      (MetaStartupSequence *sequence);
+const char * meta_startup_sequence_get_icon_name      (MetaStartupSequence *sequence);
+const char * meta_startup_sequence_get_application_id (MetaStartupSequence *sequence);
+const char * meta_startup_sequence_get_wmclass        (MetaStartupSequence *sequence);
+
+void        meta_startup_sequence_complete           (MetaStartupSequence *sequence);
+
+#endif /* META_STARTUP_NOTIFICATION_H */


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