core: Make MetaStartupSequence/Notification public

This will be preferred over SnStartupNotification, as exposed
through MetaDisplay.
This commit is contained in:
Carlos Garnacho 2018-08-22 22:56:18 +02:00 committed by Georges Basile Stavracas Neto
parent 4a69a0d7f7
commit 4d92979b43
7 changed files with 139 additions and 9 deletions

View File

@ -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 \

View File

@ -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;
}

View File

@ -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 */

View File

@ -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)

View File

@ -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

View File

@ -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',

View File

@ -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 */