diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-11-05 11:16:06 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-11-05 11:16:06 +0100 |
commit | b2c1e66e48d69199ba5d5cc607f47d695919a140 (patch) | |
tree | 400d9c41d006c52128d86dad74317602f10a869d | |
parent | e4b3f48f135deb403e470664726ec53ff0bd9a85 (diff) | |
parent | 50d8e7cc08546d778634e6be463a4851cfb8267b (diff) | |
download | ayatana-indicator-messages-b2c1e66e48d69199ba5d5cc607f47d695919a140.tar.gz ayatana-indicator-messages-b2c1e66e48d69199ba5d5cc607f47d695919a140.tar.bz2 ayatana-indicator-messages-b2c1e66e48d69199ba5d5cc607f47d695919a140.zip |
Merge new libmessaging-menu API
Adds MessagingMenuMessage, which allows adding individual messages with titles
and body previews to the messaging menu with messaging_menu_app_append_message.
This only adds the new API, messages are not actually sent to the messaging
menu yet.
-rw-r--r-- | libmessaging-menu/Makefile.am | 13 | ||||
-rw-r--r-- | libmessaging-menu/messaging-menu-app.c (renamed from libmessaging-menu/messaging-menu.c) | 65 | ||||
-rw-r--r-- | libmessaging-menu/messaging-menu-app.h | 160 | ||||
-rw-r--r-- | libmessaging-menu/messaging-menu-message.c | 372 | ||||
-rw-r--r-- | libmessaging-menu/messaging-menu-message.h | 64 | ||||
-rw-r--r-- | libmessaging-menu/messaging-menu.h | 125 |
6 files changed, 671 insertions, 128 deletions
diff --git a/libmessaging-menu/Makefile.am b/libmessaging-menu/Makefile.am index 7a6ee31..15d0c9b 100644 --- a/libmessaging-menu/Makefile.am +++ b/libmessaging-menu/Makefile.am @@ -4,13 +4,16 @@ lib_LTLIBRARIES = libmessaging-menu.la libmessaging_menu_ladir = $(includedir)/messaging-menu libmessaging_menu_la_SOURCES = \ - messaging-menu.c \ + messaging-menu-app.c \ + messaging-menu-message.c \ gtupleaction.c \ gtupleaction.h \ $(BUILT_SOURCES) libmessaging_menu_la_HEADERS = \ - messaging-menu.h + messaging-menu-app.h \ + messaging-menu.h \ + messaging-menu-message.h libmessaging_menu_la_LIBADD = $(GIO_LIBS) @@ -52,7 +55,11 @@ MessagingMenu_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 MessagingMenu_1_0_gir_CFLAGS = $(INCLUDES) $(GIO_CFLAGS) MessagingMenu_1_0_gir_SCANNERFLAGS = --c-include="messaging-menu.h" MessagingMenu_1_0_gir_LIBS = libmessaging-menu.la -MessagingMenu_1_0_gir_FILES = messaging-menu.c messaging-menu.h +MessagingMenu_1_0_gir_FILES = \ + messaging-menu-app.c \ + messaging-menu-app.h \ + messaging-menu-message.c \ + messaging-menu-message.h MessagingMenu_1_0_gir_EXPORT_PACKAGES = messaging-menu INTROSPECTION_GIRS += MessagingMenu-1.0.gir diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu-app.c index 38883f8..377aea0 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu-app.c @@ -17,7 +17,7 @@ * Lars Uebernickel <lars.uebernickel@canonical.com> */ -#include "messaging-menu.h" +#include "messaging-menu-app.h" #include "indicator-messages-service.h" #include <gio/gdesktopappinfo.h> @@ -1193,3 +1193,66 @@ messaging_menu_app_remove_attention (MessagingMenuApp *app, { messaging_menu_app_set_draws_attention (app, source_id, TRUE); } + +/** + * messaging_menu_app_append_message: + * @app: a #MessagingMenuApp + * @msg: the #MessagingMenuMessage to append + * @source_id: (allow-none): the source id to which @msg is added, or NULL + * @notify: whether a notification bubble should be shown for this + * message + * + * Appends @msg to the source with id @source_id of @app. The messaging + * menu might not display this message immediately if other messages are + * queued before this one. + * + * If @source_id has a count associated with it, that count will be + * increased by one. + * + * If @source_id is %NULL, @msg won't be associated with a source. + */ +void +messaging_menu_app_append_message (MessagingMenuApp *app, + MessagingMenuMessage *msg, + const gchar *source_id, + gboolean notify) +{ + g_return_if_fail (MESSAGING_MENU_IS_APP (app)); + g_return_if_fail (MESSAGING_MENU_IS_MESSAGE (app)); +} + +/** + * messaging_menu_app_remove_message: + * @app: a #MessagingMenuApp + * @msg: the #MessagingMenuMessage to remove + * + * Removes @msg from @app. + * + * If @source_id has a count associated with it, that count will be + * decreased by one. + */ +void +messaging_menu_app_remove_message (MessagingMenuApp *app, + MessagingMenuMessage *msg) +{ + g_return_if_fail (MESSAGING_MENU_IS_APP (app)); + g_return_if_fail (MESSAGING_MENU_IS_MESSAGE (app)); +} + +/** + * messaging_menu_app_remove_message_by_id: + * @app: a #MessagingMenuApp + * @id: the unique id of @msg + * + * Removes the message with the id @id from @app. + * + * If @source_id has a count associated with it, that count will be + * decreased by one. + */ +void +messaging_menu_app_remove_message_by_id (MessagingMenuApp *app, + const gchar *id) +{ + g_return_if_fail (MESSAGING_MENU_IS_APP (app)); + g_return_if_fail (id != NULL); +} diff --git a/libmessaging-menu/messaging-menu-app.h b/libmessaging-menu/messaging-menu-app.h new file mode 100644 index 0000000..a2d27bc --- /dev/null +++ b/libmessaging-menu/messaging-menu-app.h @@ -0,0 +1,160 @@ +/* + * Copyright 2012 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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/>. + * + * Authors: + * Lars Uebernickel <lars.uebernickel@canonical.com> + */ + +#ifndef __messaging_menu_app_h__ +#define __messaging_menu_app_h__ + +#include <gio/gio.h> +#include "messaging-menu-message.h" + +G_BEGIN_DECLS + +#define MESSAGING_MENU_TYPE_APP messaging_menu_app_get_type() +#define MESSAGING_MENU_APP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MESSAGING_MENU_TYPE_APP, MessagingMenuApp)) +#define MESSAGING_MENU_APP_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), MESSAGING_MENU_TYPE_APP, MessagingMenuAppClass)) +#define MESSAGING_MENU_IS_APP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MESSAGING_MENU_TYPE_APP)) + +/** + * MessagingMenuStatus: + * @MESSAGING_MENU_STATUS_AVAILABLE: available + * @MESSAGING_MENU_STATUS_AWAY: away + * @MESSAGING_MENU_STATUS_BUSY: busy + * @MESSAGING_MENU_STATUS_INVISIBLE: invisible + * @MESSAGING_MENU_STATUS_OFFLINE: offline + * + * An enumeration for the possible chat statuses the messaging menu can be in. + */ +typedef enum { + MESSAGING_MENU_STATUS_AVAILABLE, + MESSAGING_MENU_STATUS_AWAY, + MESSAGING_MENU_STATUS_BUSY, + MESSAGING_MENU_STATUS_INVISIBLE, + MESSAGING_MENU_STATUS_OFFLINE +} MessagingMenuStatus; + + +typedef GObjectClass MessagingMenuAppClass; +typedef struct _MessagingMenuApp MessagingMenuApp; + +GType messaging_menu_app_get_type (void) G_GNUC_CONST; + +MessagingMenuApp * messaging_menu_app_new (const gchar *desktop_id); + +void messaging_menu_app_register (MessagingMenuApp *app); +void messaging_menu_app_unregister (MessagingMenuApp *app); + +void messaging_menu_app_set_status (MessagingMenuApp *app, + MessagingMenuStatus status); + +void messaging_menu_app_insert_source (MessagingMenuApp *app, + gint position, + const gchar *id, + GIcon *icon, + const gchar *label); + +void messaging_menu_app_append_source (MessagingMenuApp *app, + const gchar *id, + GIcon *icon, + const gchar *label); + +void messaging_menu_app_insert_source_with_count (MessagingMenuApp *app, + gint position, + const gchar *id, + GIcon *icon, + const gchar *label, + guint count); + +void messaging_menu_app_append_source_with_count (MessagingMenuApp *app, + const gchar *id, + GIcon *icon, + const gchar *label, + guint count); + +void messaging_menu_app_insert_source_with_time (MessagingMenuApp *app, + gint position, + const gchar *id, + GIcon *icon, + const gchar *label, + gint64 time); + +void messaging_menu_app_append_source_with_time (MessagingMenuApp *app, + const gchar *id, + GIcon *icon, + const gchar *label, + gint64 time); + +void messaging_menu_app_append_source_with_string (MessagingMenuApp *app, + const gchar *id, + GIcon *icon, + const gchar *label, + const gchar *str); + +void messaging_menu_app_insert_source_with_string (MessagingMenuApp *app, + gint position, + const gchar *id, + GIcon *icon, + const gchar *label, + const gchar *str); + +void messaging_menu_app_remove_source (MessagingMenuApp *app, + const gchar *source_id); + +gboolean messaging_menu_app_has_source (MessagingMenuApp *app, + const gchar *source_id); + +void messaging_menu_app_set_source_label (MessagingMenuApp *app, + const gchar *source_id, + const gchar *label); + +void messaging_menu_app_set_source_icon (MessagingMenuApp *app, + const gchar *source_id, + GIcon *icon); + +void messaging_menu_app_set_source_count (MessagingMenuApp *app, + const gchar *source_id, + guint count); + +void messaging_menu_app_set_source_time (MessagingMenuApp *app, + const gchar *source_id, + gint64 time); + +void messaging_menu_app_set_source_string (MessagingMenuApp *app, + const gchar *source_id, + const gchar *str); + +void messaging_menu_app_draw_attention (MessagingMenuApp *app, + const gchar *source_id); + +void messaging_menu_app_remove_attention (MessagingMenuApp *app, + const gchar *source_id); + +void messaging_menu_app_append_message (MessagingMenuApp *app, + MessagingMenuMessage *msg, + const gchar *source_id, + gboolean notify); + +void messaging_menu_app_remove_message (MessagingMenuApp *app, + MessagingMenuMessage *msg); + +void messaging_menu_app_remove_message_by_id (MessagingMenuApp *app, + const gchar *id); + +G_END_DECLS + +#endif diff --git a/libmessaging-menu/messaging-menu-message.c b/libmessaging-menu/messaging-menu-message.c new file mode 100644 index 0000000..631786a --- /dev/null +++ b/libmessaging-menu/messaging-menu-message.c @@ -0,0 +1,372 @@ +/* + * Copyright 2012 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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/>. + * + * Authors: + * Lars Uebernickel <lars.uebernickel@canonical.com> + */ + +#include "messaging-menu-message.h" + +typedef GObjectClass MessagingMenuMessageClass; + +struct _MessagingMenuMessage +{ + GObject parent; + + gchar *id; + GIcon *icon; + gchar *title; + gchar *subtitle; + gchar *body; + gint64 time; + gboolean draws_attention; +}; + +G_DEFINE_TYPE (MessagingMenuMessage, messaging_menu_message, G_TYPE_OBJECT); + +enum +{ + PROP_0, + PROP_ID, + PROP_ICON, + PROP_TITLE, + PROP_SUBTITLE, + PROP_BODY, + PROP_TIME, + PROP_DRAWS_ATTENTION, + NUM_PROPERTIES +}; + +static GParamSpec *properties[NUM_PROPERTIES]; + +static void +messaging_menu_message_dispose (GObject *object) +{ + MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); + + g_clear_object (&msg->icon); + + G_OBJECT_CLASS (messaging_menu_message_parent_class)->dispose (object); +} + +static void +messaging_menu_message_finalize (GObject *object) +{ + MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); + + g_free (msg->id); + g_free (msg->title); + g_free (msg->subtitle); + g_free (msg->body); + + G_OBJECT_CLASS (messaging_menu_message_parent_class)->finalize (object); +} + +static void +messaging_menu_message_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); + + switch (property_id) + { + case PROP_ID: + g_value_set_string (value, msg->id); + break; + + case PROP_ICON: + g_value_set_object (value, msg->icon); + break; + + case PROP_TITLE: + g_value_set_string (value, msg->title); + break; + + case PROP_SUBTITLE: + g_value_set_string (value, msg->subtitle); + break; + + case PROP_BODY: + g_value_set_string (value, msg->body); + + case PROP_TIME: + g_value_set_int64 (value, msg->time); + break; + + case PROP_DRAWS_ATTENTION: + g_value_set_boolean (value, msg->draws_attention); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +messaging_menu_message_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); + + switch (property_id) + { + case PROP_ID: + msg->id = g_value_dup_string (value); + break; + + case PROP_ICON: + msg->icon = g_value_dup_object (value); + break; + + case PROP_TITLE: + msg->title = g_value_dup_string (value); + break; + + case PROP_SUBTITLE: + msg->subtitle = g_value_dup_string (value); + break; + + case PROP_BODY: + msg->body = g_value_dup_string (value); + + case PROP_TIME: + msg->time = g_value_get_int64 (value); + break; + + case PROP_DRAWS_ATTENTION: + messaging_menu_message_set_draws_attention (msg, g_value_get_boolean (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +messaging_menu_message_class_init (MessagingMenuMessageClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = messaging_menu_message_dispose; + object_class->finalize = messaging_menu_message_finalize; + object_class->get_property = messaging_menu_message_get_property; + object_class->set_property = messaging_menu_message_set_property; + + properties[PROP_ID] = g_param_spec_string ("id", "Id", + "Unique id of the message", + NULL, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + properties[PROP_ICON] = g_param_spec_object ("icon", "Icon", + "Icon of the message", + G_TYPE_ICON, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + properties[PROP_TITLE] = g_param_spec_string ("title", "Title", + "Title of the message", + NULL, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + properties[PROP_SUBTITLE] = g_param_spec_string ("subtitle", "Subtitle", + "Subtitle of the message", + NULL, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + properties[PROP_BODY] = g_param_spec_string ("body", "Body", + "First lines of the body of the message", + NULL, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + properties[PROP_TIME] = g_param_spec_int64 ("time", "Time", + "Time the message was sent, in microseconds", 0, G_MAXINT64, 0, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + properties[PROP_DRAWS_ATTENTION] = g_param_spec_boolean ("draws-attention", "Draws attention", + "Whether the message should draw attention", + FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (klass, NUM_PROPERTIES, properties); +} + +static void +messaging_menu_message_init (MessagingMenuMessage *self) +{ +} + +/** + * messaging_menu_message_new: + * @id: unique id of the message + * @icon: (transfer full): a #GIcon representing the message + * @title: the title of the message + * @subtitle: (allow-none): the subtitle of the message + * @body: (allow-none): the message body + * @time: the time the message was received + * + * Creates a new #MessagingMenuMessage. + * + * Returns: (transfer full): a new #MessagingMenuMessage + */ +MessagingMenuMessage * +messaging_menu_message_new (const gchar *id, + GIcon *icon, + const gchar *title, + const gchar *subtitle, + const gchar *body, + gint64 time) +{ + g_return_val_if_fail (id != NULL, NULL); + g_return_val_if_fail (title != NULL, NULL); + + return g_object_new (MESSAGING_MENU_TYPE_MESSAGE, + "id", id, + "icon", icon, + "title", title, + "subtitle", subtitle, + "body", body, + "time", time, + NULL); +} + +/** + * messaging_menu_message_get_id: + * @msg: a #MessagingMenuMessage + * + * Returns: the unique id of @msg + */ +const gchar * +messaging_menu_message_get_id (MessagingMenuMessage *msg) +{ + g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); + + return msg->id; +} + +/** + * messaging_menu_message_get_icon: + * @msg: a #MessagingMenuMessage + * + * Returns: (transfer none): the icon of @msg + */ +GIcon * +messaging_menu_message_get_icon (MessagingMenuMessage *msg) +{ + g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); + + return msg->icon; +} + +/** + * messaging_menu_message_get_title: + * @msg: a #MessagingMenuMessage + * + * Returns: the title of @msg + */ +const gchar * +messaging_menu_message_get_title (MessagingMenuMessage *msg) +{ + g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); + + return msg->title; +} + +/** + * messaging_menu_message_get_subtitle: + * @msg: a #MessagingMenuMessage + * + * Returns: the subtitle of @msg + */ +const gchar * +messaging_menu_message_get_subtitle (MessagingMenuMessage *msg) +{ + g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); + + return msg->subtitle; +} + +/** + * messaging_menu_message_get_body: + * @msg: a #MessagingMenuMessage + * + * Returns: the body of @msg + */ +const gchar * +messaging_menu_message_get_body (MessagingMenuMessage *msg) +{ + g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); + + return msg->body; +} + +/** + * messaging_menu_message_get_time: + * @msg: a #MessagingMenuMessage + * + * Returns: the time at which @msg was received + */ +gint64 +messaging_menu_message_get_time (MessagingMenuMessage *msg) +{ + g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), 0); + + return msg->time; +} + +/** + * messaging_menu_message_get_draws_attention: + * @msg: a #MessagingMenuMessage + * + * Returns: whether @msg is drawing attention + */ +gboolean +messaging_menu_message_get_draws_attention (MessagingMenuMessage *msg) +{ + g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), FALSE); + + return msg->draws_attention; +} + +/** + * messaging_menu_message_set_draws_attention: + * @msg: a #MessagingMenuMessage + * @draws_attention: whether @msg should draw attention + * + * Sets whether @msg is drawing attention. + */ +void +messaging_menu_message_set_draws_attention (MessagingMenuMessage *msg, + gboolean draws_attention) +{ + g_return_if_fail (MESSAGING_MENU_IS_MESSAGE (msg)); + + msg->draws_attention = draws_attention; + g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_DRAWS_ATTENTION]); +} diff --git a/libmessaging-menu/messaging-menu-message.h b/libmessaging-menu/messaging-menu-message.h new file mode 100644 index 0000000..068247b --- /dev/null +++ b/libmessaging-menu/messaging-menu-message.h @@ -0,0 +1,64 @@ +/* + * Copyright 2012 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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/>. + * + * Authors: + * Lars Uebernickel <lars.uebernickel@canonical.com> + */ + +#ifndef __messaging_menu_message_h__ +#define __messaging_menu_message_h__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + +#define MESSAGING_MENU_TYPE_MESSAGE (messaging_menu_message_get_type ()) +#define MESSAGING_MENU_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MESSAGING_MENU_TYPE_MESSAGE, MessagingMenuMessage)) +#define MESSAGING_MENU_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MESSAGING_MENU_TYPE_MESSAGE, MessagingMenuMessageClass)) +#define MESSAGING_MENU_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MESSAGING_MENU_TYPE_MESSAGE)) +#define MESSAGING_MENU_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MESSAGING_MENU_TYPE_MESSAGE)) +#define MESSAGING_MENU_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MESSAGING_MENU_TYPE_MESSAGE, MessagingMenuMessageClass)) + +typedef struct _MessagingMenuMessage MessagingMenuMessage; + +GType messaging_menu_message_get_type (void) G_GNUC_CONST; + +MessagingMenuMessage * messaging_menu_message_new (const gchar *id, + GIcon *icon, + const gchar *title, + const gchar *subtitle, + const gchar *body, + gint64 time); + +const gchar * messaging_menu_message_get_id (MessagingMenuMessage *msg); + +GIcon * messaging_menu_message_get_icon (MessagingMenuMessage *msg); + +const gchar * messaging_menu_message_get_title (MessagingMenuMessage *msg); + +const gchar * messaging_menu_message_get_subtitle (MessagingMenuMessage *msg); + +const gchar * messaging_menu_message_get_body (MessagingMenuMessage *msg); + +gint64 messaging_menu_message_get_time (MessagingMenuMessage *msg); + +gboolean messaging_menu_message_get_draws_attention (MessagingMenuMessage *msg); + +void messaging_menu_message_set_draws_attention (MessagingMenuMessage *msg, + gboolean draws_attention); + +G_END_DECLS + +#endif diff --git a/libmessaging-menu/messaging-menu.h b/libmessaging-menu/messaging-menu.h index 6c405c7..929b229 100644 --- a/libmessaging-menu/messaging-menu.h +++ b/libmessaging-menu/messaging-menu.h @@ -20,129 +20,6 @@ #ifndef __messaging_menu_h__ #define __messaging_menu_h__ -#include <gio/gio.h> - -G_BEGIN_DECLS - -#define MESSAGING_MENU_TYPE_APP messaging_menu_app_get_type() -#define MESSAGING_MENU_APP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MESSAGING_MENU_TYPE_APP, MessagingMenuApp)) -#define MESSAGING_MENU_APP_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), MESSAGING_MENU_TYPE_APP, MessagingMenuAppClass)) -#define MESSAGING_MENU_IS_APP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MESSAGING_MENU_TYPE_APP)) - -/** - * MessagingMenuStatus: - * @MESSAGING_MENU_STATUS_AVAILABLE: available - * @MESSAGING_MENU_STATUS_AWAY: away - * @MESSAGING_MENU_STATUS_BUSY: busy - * @MESSAGING_MENU_STATUS_INVISIBLE: invisible - * @MESSAGING_MENU_STATUS_OFFLINE: offline - * - * An enumeration for the possible chat statuses the messaging menu can be in. - */ -typedef enum { - MESSAGING_MENU_STATUS_AVAILABLE, - MESSAGING_MENU_STATUS_AWAY, - MESSAGING_MENU_STATUS_BUSY, - MESSAGING_MENU_STATUS_INVISIBLE, - MESSAGING_MENU_STATUS_OFFLINE -} MessagingMenuStatus; - - -typedef GObjectClass MessagingMenuAppClass; -typedef struct _MessagingMenuApp MessagingMenuApp; - -GType messaging_menu_app_get_type (void) G_GNUC_CONST; - -MessagingMenuApp * messaging_menu_app_new (const gchar *desktop_id); - -void messaging_menu_app_register (MessagingMenuApp *app); -void messaging_menu_app_unregister (MessagingMenuApp *app); - -void messaging_menu_app_set_status (MessagingMenuApp *app, - MessagingMenuStatus status); - -void messaging_menu_app_insert_source (MessagingMenuApp *app, - gint position, - const gchar *id, - GIcon *icon, - const gchar *label); - -void messaging_menu_app_append_source (MessagingMenuApp *app, - const gchar *id, - GIcon *icon, - const gchar *label); - -void messaging_menu_app_insert_source_with_count (MessagingMenuApp *app, - gint position, - const gchar *id, - GIcon *icon, - const gchar *label, - guint count); - -void messaging_menu_app_append_source_with_count (MessagingMenuApp *app, - const gchar *id, - GIcon *icon, - const gchar *label, - guint count); - -void messaging_menu_app_insert_source_with_time (MessagingMenuApp *app, - gint position, - const gchar *id, - GIcon *icon, - const gchar *label, - gint64 time); - -void messaging_menu_app_append_source_with_time (MessagingMenuApp *app, - const gchar *id, - GIcon *icon, - const gchar *label, - gint64 time); - -void messaging_menu_app_append_source_with_string (MessagingMenuApp *app, - const gchar *id, - GIcon *icon, - const gchar *label, - const gchar *str); - -void messaging_menu_app_insert_source_with_string (MessagingMenuApp *app, - gint position, - const gchar *id, - GIcon *icon, - const gchar *label, - const gchar *str); - -void messaging_menu_app_remove_source (MessagingMenuApp *app, - const gchar *source_id); - -gboolean messaging_menu_app_has_source (MessagingMenuApp *app, - const gchar *source_id); - -void messaging_menu_app_set_source_label (MessagingMenuApp *app, - const gchar *source_id, - const gchar *label); - -void messaging_menu_app_set_source_icon (MessagingMenuApp *app, - const gchar *source_id, - GIcon *icon); - -void messaging_menu_app_set_source_count (MessagingMenuApp *app, - const gchar *source_id, - guint count); - -void messaging_menu_app_set_source_time (MessagingMenuApp *app, - const gchar *source_id, - gint64 time); - -void messaging_menu_app_set_source_string (MessagingMenuApp *app, - const gchar *source_id, - const gchar *str); - -void messaging_menu_app_draw_attention (MessagingMenuApp *app, - const gchar *source_id); - -void messaging_menu_app_remove_attention (MessagingMenuApp *app, - const gchar *source_id); - -G_END_DECLS +#include "messaging-menu-app.h" #endif |