Back to index

libindicator  12.10.0
indicator-object.h
Go to the documentation of this file.
00001 /*
00002 An object to represent loadable indicator modules to make loading
00003 them easy and objectified.
00004 
00005 Copyright 2009 Canonical Ltd.
00006 
00007 Authors:
00008     Ted Gould <ted@canonical.com>
00009 
00010 This library is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 version 3.0 as published by the Free Software Foundation.
00013 
00014 This library is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License version 3.0 for more details.
00018 
00019 You should have received a copy of the GNU General Public
00020 License along with this library. If not, see
00021 <http://www.gnu.org/licenses/>.
00022 */
00023 
00024 #ifndef __INDICATOR_OBJECT_H__
00025 #define __INDICATOR_OBJECT_H__
00026 
00027 #include <gtk/gtk.h>
00028 
00029 G_BEGIN_DECLS
00030 
00031 typedef enum
00032 {
00033   INDICATOR_OBJECT_SCROLL_UP,
00034   INDICATOR_OBJECT_SCROLL_DOWN,
00035   INDICATOR_OBJECT_SCROLL_LEFT,
00036   INDICATOR_OBJECT_SCROLL_RIGHT
00037 } IndicatorScrollDirection;
00038 
00039 #define INDICATOR_OBJECT_TYPE            (indicator_object_get_type ())
00040 #define INDICATOR_OBJECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_OBJECT_TYPE, IndicatorObject))
00041 #define INDICATOR_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_OBJECT_TYPE, IndicatorObjectClass))
00042 #define INDICATOR_IS_OBJECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_OBJECT_TYPE))
00043 #define INDICATOR_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_OBJECT_TYPE))
00044 #define INDICATOR_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_OBJECT_TYPE, IndicatorObjectClass))
00045 
00046 #define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED       "entry-added"
00047 #define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID    (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, INDICATOR_OBJECT_TYPE))
00048 #define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED     "entry-removed"
00049 #define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID  (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, INDICATOR_OBJECT_TYPE))
00050 #define INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED       "entry-moved"
00051 #define INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID    (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, INDICATOR_OBJECT_TYPE))
00052 #define INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED    "entry-scrolled"
00053 #define INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, INDICATOR_OBJECT_TYPE))
00054 #define INDICATOR_OBJECT_SIGNAL_MENU_SHOW         "menu-show"
00055 #define INDICATOR_OBJECT_SIGNAL_MENU_SHOW_ID      (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_MENU_SHOW, INDICATOR_OBJECT_TYPE))
00056 #define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED  "show-now-changed"
00057 #define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED, INDICATOR_OBJECT_TYPE))
00058 #define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE "accessible-desc-update"
00059 #define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, INDICATOR_OBJECT_TYPE))
00060 #define INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE "secondary-activate"
00061 #define INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE, INDICATOR_OBJECT_TYPE))
00062 
00063 /* the name of the property to decide whether or not entries are visible by default */
00064 #define INDICATOR_OBJECT_DEFAULT_VISIBILITY        "indicator-object-default-visibility"
00065 
00066 typedef struct _IndicatorObject        IndicatorObject;
00067 typedef struct _IndicatorObjectClass   IndicatorObjectClass;
00068 typedef struct _IndicatorObjectPrivate IndicatorObjectPrivate;
00069 typedef struct _IndicatorObjectEntry   IndicatorObjectEntry;
00070 
00115 struct _IndicatorObjectClass {
00116        GObjectClass parent_class;
00117 
00118        /* Virtual Functions */
00119        GtkLabel * (*get_label) (IndicatorObject * io);
00120        GtkImage * (*get_image) (IndicatorObject * io);
00121        GtkMenu  * (*get_menu)  (IndicatorObject * io);
00122        const gchar * (*get_accessible_desc) (IndicatorObject * io);
00123        const gchar * (*get_name_hint) (IndicatorObject * io);
00124 
00125        GList *    (*get_entries) (IndicatorObject * io);
00126        guint      (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);
00127        gboolean   (*get_show_now) (IndicatorObject * io, IndicatorObjectEntry * entry);
00128 
00129        void       (*entry_being_removed) (IndicatorObject * io, IndicatorObjectEntry * entry);
00130        void       (*entry_was_added) (IndicatorObject * io, IndicatorObjectEntry * entry);
00131 
00132        void       (*entry_activate) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
00133        void       (*entry_activate_window) (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp);
00134        void       (*entry_close) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
00135 
00136        /* Signals */
00137        void       (*entry_added)   (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
00138        void       (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
00139        void       (*entry_moved)   (IndicatorObject * io, IndicatorObjectEntry * entry, guint old_pos, guint new_pos, gpointer user_data);
00140        void       (*entry_scrolled)  (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction);
00141        void       (*menu_show)     (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);
00142        void       (*show_now_changed) (IndicatorObject * io, IndicatorObjectEntry * entry, gboolean show_now_state, gpointer user_data);
00143        void       (*accessible_desc_update) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
00144        void       (*secondary_activate) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);
00145 
00146        /* Reserved */
00147        void       (*reserved1)     (void);
00148        void       (*reserved2)     (void);
00149        void       (*reserved3)     (void);
00150        void       (*reserved4)     (void);
00151        void       (*reserved5)     (void);
00152 };
00153 
00160 struct _IndicatorObject {
00161        GObject parent;
00162        IndicatorObjectPrivate * priv;
00163 };
00164 
00181 struct _IndicatorObjectEntry {
00182        IndicatorObject * parent_object;
00183        GtkLabel * label;
00184        GtkImage * image;
00185        GtkMenu  * menu;
00186        const gchar * accessible_desc;
00187        const gchar * name_hint;
00188 
00189        void       (*reserved1)     (void);
00190        void       (*reserved2)     (void);
00191        void       (*reserved3)     (void);
00192        void       (*reserved4)     (void);
00193 };
00194 
00195 GType indicator_object_get_type (void);
00196 IndicatorObject * indicator_object_new_from_file (const gchar * file);
00197 
00198 GList * indicator_object_get_entries (IndicatorObject * io);
00199 guint   indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry);
00200 guint   indicator_object_get_show_now (IndicatorObject * io, IndicatorObjectEntry * entry);
00201 void   indicator_object_set_visible (IndicatorObject * io, gboolean visible);
00202 void    indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
00203 void    indicator_object_entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp);
00204 void    indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
00205 
00206 void    indicator_object_set_environment (IndicatorObject * io, GStrv env);
00207 GStrv   indicator_object_get_environment (IndicatorObject * io);
00208 gboolean indicator_object_check_environment (IndicatorObject * io, const gchar * env);
00209 
00210 G_END_DECLS
00211 
00212 #endif