Back to index

libindicate  12.10.0
listener.h
Go to the documentation of this file.
00001 /*
00002 A library to allow applictions to provide simple indications of
00003 information to be displayed to users of the application through the
00004 interface shell.
00005 
00006 Copyright 2009 Canonical Ltd.
00007 
00008 Authors:
00009     Ted Gould <ted@canonical.com>
00010 
00011 This program is free software: you can redistribute it and/or modify it 
00012 under the terms of either or both of the following licenses:
00013 
00014 1) the GNU Lesser General Public License version 3, as published by the 
00015 Free Software Foundation; and/or
00016 2) the GNU Lesser General Public License version 2.1, as published by 
00017 the Free Software Foundation.
00018 
00019 This program is distributed in the hope that it will be useful, but 
00020 WITHOUT ANY WARRANTY; without even the implied warranties of 
00021 MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 
00022 PURPOSE.  See the applicable version of the GNU Lesser General Public 
00023 License for more details.
00024 
00025 You should have received a copy of both the GNU Lesser General Public 
00026 License version 3 and version 2.1 along with this program.  If not, see 
00027 <http://www.gnu.org/licenses/>
00028 */
00029 
00030 #ifndef INDICATE_LISTENER_H_INCLUDED__
00031 #define INDICATE_LISTENER_H_INCLUDED__ 1
00032 
00033 #include <glib.h>
00034 #include <glib-object.h>
00035 
00036 #include "indicator.h"
00037 #include "server.h"
00038 #include "interests.h"
00039 
00040 G_BEGIN_DECLS
00041 
00042 /* Boilerplate */
00043 #define INDICATE_TYPE_LISTENER (indicate_listener_get_type ())
00044 #define INDICATE_LISTENER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), INDICATE_TYPE_LISTENER, IndicateListener))
00045 #define INDICATE_IS_LISTENER(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), INDICATE_TYPE_LISTENER))
00046 #define INDICATE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), INDICATE_TYPE_LISTENER, IndicateListenerClass))
00047 #define INDICATE_IS_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), INDICATE_TYPE_LISTENER))
00048 #define INDICATE_LISTENER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_LISTENER, IndicateListenerClass))
00049 
00050 #define INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED       "indicator-added"
00051 #define INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED     "indicator-removed"
00052 #define INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED    "indicator-modified"
00053 #define INDICATE_LISTENER_SIGNAL_SERVER_ADDED          "server-added"
00054 #define INDICATE_LISTENER_SIGNAL_SERVER_REMOVED        "server-removed"
00055 #define INDICATE_LISTENER_SIGNAL_SERVER_COUNT_CHANGED  "server-count-changed"
00056 
00057 #define INDICATE_LISTENER_SERVER_DBUS_NAME(server)   (indicate_listener_server_get_dbusname(server))
00058 #define INDICATE_LISTENER_INDICATOR_ID(indicator)    (indicate_listener_indicator_get_id(indicator))
00059 
00067 typedef struct _IndicateListenerServer IndicateListenerServer;
00068 #define INDICATE_TYPE_LISTENER_SERVER (indicate_listener_server_get_gtype ())
00069 GType                   indicate_listener_server_get_gtype (void) G_GNUC_CONST;
00070 
00078 typedef struct _IndicateListenerIndicator IndicateListenerIndicator;
00079 #define INDICATE_TYPE_LISTENER_INDICATOR (indicate_listener_indicator_get_gtype ())
00080 GType                   indicate_listener_indicator_get_gtype (void) G_GNUC_CONST;
00081 
00082 
00083 typedef struct _IndicateListener IndicateListener;
00084 struct _IndicateListener {
00085        GObject parent;
00086 };
00087 
00088 
00106 typedef struct _IndicateListenerClass IndicateListenerClass;
00107 struct _IndicateListenerClass {
00108        /* Parent */
00109        GObjectClass parent;
00110 
00111        /* Signals */
00112        void (* indicator_added) (IndicateListenerServer * server, IndicateListenerIndicator * indicator);
00113        void (* indicator_removed) (IndicateListenerServer * server, IndicateListenerIndicator * indicator);
00114        void (* indicator_modified) (IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property);
00115 
00116        void (* server_added) (IndicateListenerServer * server, gchar * type);
00117        void (* server_removed) (IndicateListenerServer * server, gchar * type);
00118        void (* server_count_changed) (IndicateListenerServer * server, guint count);
00119 
00120        void (* indicator_servers_report) (void);
00121 
00122        /* Future Use */
00123        void (*indicate_listener_reserved1)(void);
00124        void (*indicate_listener_reserved2)(void);
00125        void (*indicate_listener_reserved3)(void);
00126 };
00127 
00128 GType indicate_listener_get_type (void) G_GNUC_CONST;
00129 
00130 typedef void (*indicate_listener_get_property_variant_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GVariant * propertydata, gpointer data);
00131 typedef void (*indicate_listener_get_property_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const gchar * propertydata, gpointer data);
00132 typedef void (*indicate_listener_get_property_time_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const GTimeVal * propertydata, gpointer data);
00133 typedef void (*indicate_listener_get_property_int_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gint propertydata, gpointer data);
00134 typedef void (*indicate_listener_get_property_bool_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gboolean propertydata, gpointer data);
00135 typedef void (*indicate_listener_get_server_property_cb) (IndicateListener * listener, IndicateListenerServer * server, const gchar * value, gpointer data);
00136 typedef void (*indicate_listener_get_server_uint_property_cb) (IndicateListener * listener, IndicateListenerServer * server, guint value, gpointer data);
00137 
00138 /* Create a new listener */
00139 IndicateListener *    indicate_listener_new                (void);
00140 IndicateListener *    indicate_listener_ref_default        (void);
00141 void                  indicate_listener_get_property_variant (IndicateListener * listener,
00142                                                             IndicateListenerServer * server,
00143                                                             IndicateListenerIndicator * indicator,
00144                                                             gchar * property,
00145                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GVariant * propertydata, gpointer data),
00146                                                             gpointer data);
00147 void                  indicate_listener_get_property       (IndicateListener * listener,
00148                                                             IndicateListenerServer * server,
00149                                                             IndicateListenerIndicator * indicator,
00150                                                             gchar * property,
00151                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const gchar * propertydata, gpointer data),
00152                                                             gpointer data);
00153 void                  indicate_listener_get_property_time  (IndicateListener * listener,
00154                                                             IndicateListenerServer * server,
00155                                                             IndicateListenerIndicator * indicator,
00156                                                             gchar * property,
00157                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const GTimeVal * propertydata, gpointer data),
00158                                                             gpointer data);
00159 void                  indicate_listener_get_property_int   (IndicateListener * listener,
00160                                                             IndicateListenerServer * server,
00161                                                             IndicateListenerIndicator * indicator,
00162                                                             gchar * property,
00163                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gint propertydata, gpointer data),
00164                                                             gpointer data);
00165 void                  indicate_listener_get_property_bool  (IndicateListener * listener,
00166                                                             IndicateListenerServer * server,
00167                                                             IndicateListenerIndicator * indicator,
00168                                                             gchar * property,
00169                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gboolean propertydata, gpointer data),
00170                                                             gpointer data);
00171 GList *               indicate_listener_get_servers        (IndicateListener * listener);
00172 void                  indicate_listener_display            (IndicateListener * listener,
00173                                                             IndicateListenerServer * server,
00174                                                             IndicateListenerIndicator * indicator,
00175                                                             guint timestamp);
00176 void                  indicate_listener_displayed          (IndicateListener * listener,
00177                                                             IndicateListenerServer * server,
00178                                                             IndicateListenerIndicator * indicator,
00179                                                             gboolean displayed);
00180 void                  indicate_listener_server_get_type    (IndicateListener * listener,
00181                                                             IndicateListenerServer * server,
00182                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, const gchar * value, gpointer data),
00183                                                             gpointer data);
00184 void                  indicate_listener_server_get_desktop (IndicateListener * listener,
00185                                                             IndicateListenerServer * server,
00186                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, const gchar * value, gpointer data),
00187                                                             gpointer data);
00188 void                  indicate_listener_server_get_count   (IndicateListener * listener,
00189                                                             IndicateListenerServer * server,
00190                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, guint value, gpointer data),
00191                                                             gpointer data);
00192 void                  indicate_listener_server_get_menu    (IndicateListener * listener,
00193                                                             IndicateListenerServer * server,
00194                                                             void (*callback) (IndicateListener * listener, IndicateListenerServer * server, const gchar * value, gpointer data),
00195                                                             gpointer data);
00196 void                  indicate_listener_server_get_icon_theme (IndicateListener * listener,
00197                                                         IndicateListenerServer * server,
00198                                                         void (*callback) (IndicateListener *listener, IndicateListenerServer *server, const gchar *value, gpointer data),
00199                                                         gpointer data);
00200 GList *               indicate_listener_server_get_indicators    (IndicateListener * listener,
00201                                                                   IndicateListenerServer * server);
00202 const gchar *         indicate_listener_server_get_dbusname      (IndicateListenerServer * server);
00203 const gchar *         indicate_listener_server_get_dbuspath      (IndicateListenerServer *server);
00204 guint                 indicate_listener_indicator_get_id         (IndicateListenerIndicator * indicator);
00205 void                  indicate_listener_server_show_interest     (IndicateListener * listener,
00206                                                                   IndicateListenerServer * server,
00207                                                                   IndicateInterests interest);
00208 void                  indicate_listener_server_remove_interest   (IndicateListener * listener,
00209                                                                   IndicateListenerServer * server,
00210                                                                   IndicateInterests interest);
00211 gboolean              indicate_listener_server_check_interest    (IndicateListener * listener,
00212                                                                   IndicateListenerServer * server,
00213                                                                   IndicateInterests interest);
00214 void                  indicate_listener_set_default_max_indicators (IndicateListener * listener,
00215                                                                   gint max);
00216 void                  indicate_listener_set_server_max_indicators    (IndicateListener * listener,
00217                                                                   IndicateListenerServer * server,
00218                                                                   gint max);
00219 
00220 G_END_DECLS
00221 
00222 #endif /* INDICATE_LISTENER_H_INCLUDED__ */
00223