Back to index

libindicate  12.10.0
indicator.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_INDICATOR_H_INCLUDED__
00031 #define INDICATE_INDICATOR_H_INCLUDED__ 1
00032 
00033 #include <glib.h>
00034 #include <glib-object.h>
00035 
00036 G_BEGIN_DECLS
00037 
00038 /* Boilerplate */
00039 #define INDICATE_TYPE_INDICATOR (indicate_indicator_get_type ())
00040 #define INDICATE_INDICATOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), INDICATE_TYPE_INDICATOR, IndicateIndicator))
00041 #define INDICATE_IS_INDICATOR(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), INDICATE_TYPE_INDICATOR))
00042 #define INDICATE_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), INDICATE_TYPE_INDICATOR, IndicateIndicatorClass))
00043 #define INDICATE_IS_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), INDICATE_TYPE_INDICATOR))
00044 #define INDICATE_INDICATOR_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_INDICATOR, IndicateIndicatorClass))
00045 
00046 /* Some values that are commonly used.  Most likely only
00047    internal, but if you need them, here they are! */
00048 #define INDICATE_INDICATOR_VALUE_TRUE       "true"
00049 #define INDICATE_INDICATOR_VALUE_FALSE      "false"
00050 
00051 /* This is a signal that signals to the indicator that the user
00052  * has done an action where they'd like this indicator to be
00053  * displayed. */
00054 #define INDICATE_INDICATOR_SIGNAL_HIDE      "hide"
00055 #define INDICATE_INDICATOR_SIGNAL_SHOW      "show"
00056 #define INDICATE_INDICATOR_SIGNAL_DISPLAY   "user-display"
00057 #define INDICATE_INDICATOR_SIGNAL_MODIFIED  "modified"
00058 #define INDICATE_INDICATOR_SIGNAL_DISPLAYED "displayed"
00059 
00060 typedef struct _IndicateIndicator IndicateIndicator;
00061 typedef struct _IndicateIndicatorClass IndicateIndicatorClass;
00062 
00071 struct _IndicateIndicator {
00072        GObject parent;
00073 };
00074 
00075 #include "server.h"
00076 
00087 typedef GPtrArray * (*indicate_indicator_list_properties_slot_t) (IndicateIndicator * indicator);
00088 
00115 struct _IndicateIndicatorClass {
00116        /* Parents */
00117        GObjectClass parent_class;
00118 
00119        /* Signals */
00120        void (*hide) (IndicateIndicator * indicator, gpointer data);
00121        void (*show) (IndicateIndicator * indicator, gpointer data);
00122        void (*user_display) (IndicateIndicator * indicator, guint timestamp, gpointer data);
00123        void (*modified) (IndicateIndicator * indicator, gchar * property, gpointer data);
00124        void (*displayed) (IndicateIndicator * indicator, gboolean displayed);
00125 
00126        /* Subclassable functions */
00127        void (*set_property) (IndicateIndicator * indicator, const gchar * key, GVariant * data);
00128        GVariant * (*get_property) (IndicateIndicator * indicator, const gchar * key);
00129        indicate_indicator_list_properties_slot_t list_properties;
00130 
00131        /* Reserver for future use */
00132        void (*indicate_indicator_reserved1)(void);
00133        void (*indicate_indicator_reserved2)(void);
00134        void (*indicate_indicator_reserved3)(void);
00135        void (*indicate_indicator_reserved4)(void);
00136 };
00137 
00138 GType indicate_indicator_get_type(void) G_GNUC_CONST;
00139 
00140 /* New Indicator Functions */
00141 IndicateIndicator * indicate_indicator_new (void);
00142 IndicateIndicator * indicate_indicator_new_with_server (IndicateServer * server);
00143 
00144 /* Show and hide this indicator */
00145 void indicate_indicator_show (IndicateIndicator * indicator);
00146 void indicate_indicator_hide (IndicateIndicator * indicator);
00147 
00148 gboolean indicate_indicator_is_visible (IndicateIndicator * indicator);
00149 
00150 /* Define this indicator server */
00151 void indicate_indicator_set_server (IndicateIndicator * indicator, IndicateServer * server);
00152 
00153 /* Every entry has an ID, here's how to get it */
00154 guint indicate_indicator_get_id (IndicateIndicator * indicator);
00155 IndicateServer * indicate_indicator_get_server (IndicateIndicator * indicator);
00156 
00157 void indicate_indicator_user_display (IndicateIndicator * indicator, guint timestamp);
00158 
00159 /* Properties handling */
00160 void indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * key, const gchar * data);
00161 void indicate_indicator_set_property_time (IndicateIndicator * indicator, const gchar * key, GTimeVal * time);
00162 void indicate_indicator_set_property_int (IndicateIndicator * indicator, const gchar * key, gint value);
00163 void indicate_indicator_set_property_bool (IndicateIndicator * indicator, const gchar * key, gboolean value);
00164 void indicate_indicator_set_property_variant (IndicateIndicator * indicator, const gchar * key, GVariant * value);
00165 
00166 const gchar * indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * key);
00167 GVariant * indicate_indicator_get_property_variant (IndicateIndicator * indicator, const gchar * key);
00168 
00179 GPtrArray * indicate_indicator_list_properties (IndicateIndicator * indicator);
00180 
00181 /* Controling whether it's displayed */
00182 void indicate_indicator_set_displayed (IndicateIndicator * indicator, gboolean displayed);
00183 gboolean indicate_indicator_get_displayed (IndicateIndicator * indicator);
00184 
00211 G_END_DECLS
00212 
00213 #endif /* INDICATE_INDICATOR_H_INCLUDED__ */