Back to index

libappindicator  12.10.0
app-indicator.h
Go to the documentation of this file.
00001 /*
00002 An object to represent the application as an application indicator
00003 in the system panel.
00004 
00005 Copyright 2009 Canonical Ltd.
00006 
00007 Authors:
00008     Ted Gould <ted@canonical.com>
00009     Cody Russell <cody.russell@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 __APP_INDICATOR_H__
00031 #define __APP_INDICATOR_H__
00032 
00033 #include <gtk/gtk.h>
00034 
00035 G_BEGIN_DECLS
00036 
00073 #define APP_INDICATOR_TYPE            (app_indicator_get_type ())
00074 #define APP_INDICATOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_INDICATOR_TYPE, AppIndicator))
00075 #define APP_INDICATOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), APP_INDICATOR_TYPE, AppIndicatorClass))
00076 #define IS_APP_INDICATOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APP_INDICATOR_TYPE))
00077 #define IS_APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APP_INDICATOR_TYPE))
00078 #define APP_INDICATOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), APP_INDICATOR_TYPE, AppIndicatorClass))
00079 
00115 #define APP_INDICATOR_SIGNAL_NEW_ICON            "new-icon"
00116 #define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON  "new-attention-icon"
00117 #define APP_INDICATOR_SIGNAL_NEW_STATUS          "new-status"
00118 #define APP_INDICATOR_SIGNAL_NEW_LABEL           "new-label"
00119 #define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED  "connection-changed"
00120 #define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path"
00121 #define APP_INDICATOR_SIGNAL_SCROLL_EVENT        "scroll-event"
00122 
00134 typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/
00135        APP_INDICATOR_CATEGORY_APPLICATION_STATUS, /*< nick=ApplicationStatus >*/
00136        APP_INDICATOR_CATEGORY_COMMUNICATIONS, /*< nick=Communications >*/
00137        APP_INDICATOR_CATEGORY_SYSTEM_SERVICES, /*< nick=SystemServices >*/
00138        APP_INDICATOR_CATEGORY_HARDWARE, /*< nick=Hardware >*/
00139        APP_INDICATOR_CATEGORY_OTHER /*< nick=Other >*/
00140 } AppIndicatorCategory;
00141 
00153 typedef enum { /*< prefix=APP_INDICATOR_STATUS >*/
00154        APP_INDICATOR_STATUS_PASSIVE, /*< nick=Passive >*/
00155        APP_INDICATOR_STATUS_ACTIVE, /*< nick=Active >*/
00156        APP_INDICATOR_STATUS_ATTENTION /*< nick=NeedsAttention >*/
00157 } AppIndicatorStatus;
00158 
00159 typedef struct _AppIndicator        AppIndicator;
00160 typedef struct _AppIndicatorClass   AppIndicatorClass;
00161 typedef struct _AppIndicatorPrivate AppIndicatorPrivate;
00162 
00188 struct _AppIndicatorClass {
00189        /* Parent */
00190        GObjectClass parent_class;
00191 
00192        /* DBus Signals */
00193        void (* new_icon)               (AppIndicator      *indicator,
00194                                         gpointer            user_data);
00195        void (* new_attention_icon)     (AppIndicator      *indicator,
00196                                         gpointer            user_data);
00197        void (* new_status)             (AppIndicator      *indicator,
00198                                         const gchar       *status,
00199                                         gpointer            user_data);
00200        void (* new_icon_theme_path)    (AppIndicator      *indicator,
00201                                         const gchar       *icon_theme_path,
00202                                         gpointer            user_data);
00203        void (* new_label)              (AppIndicator       *indicator,
00204                                         const gchar        *label,
00205                                         const gchar        *guide,
00206                                         gpointer            user_data);
00207 
00208        /* Local Signals */
00209        void (* connection_changed)     (AppIndicator * indicator,
00210                                         gboolean          connected,
00211                                         gpointer          user_data);
00212 
00213        void (* scroll_event)           (AppIndicator * indicator,
00214                                         gint                  delta,
00215                                         GdkScrollDirection direction,
00216                                         gpointer          user_data);
00217 
00218        void (*app_indicator_reserved_ats)(void);
00219 
00220        /* Overridable Functions */
00221        GtkStatusIcon * (*fallback)     (AppIndicator * indicator);
00222        void (*unfallback)              (AppIndicator * indicator,
00223                                         GtkStatusIcon * status_icon);
00224 
00225        /* Reserved */
00226        void (*app_indicator_reserved_1)(void);
00227        void (*app_indicator_reserved_2)(void);
00228        void (*app_indicator_reserved_3)(void);
00229        void (*app_indicator_reserved_4)(void);
00230        void (*app_indicator_reserved_5)(void);
00231        void (*app_indicator_reserved_6)(void);
00232 };
00233 
00246 struct _AppIndicator {
00247        GObject parent;
00248 
00249        /*< Private >*/
00250        AppIndicatorPrivate *priv;
00251 };
00252 
00253 /* GObject Stuff */
00254 GType                           app_indicator_get_type           (void) G_GNUC_CONST;
00255 
00256 AppIndicator                   *app_indicator_new                (const gchar          *id,
00257                                                                   const gchar          *icon_name,
00258                                                                   AppIndicatorCategory  category);
00259 AppIndicator                   *app_indicator_new_with_path      (const gchar          *id,
00260                                                                   const gchar          *icon_name,
00261                                                                   AppIndicatorCategory  category,
00262                                                                   const gchar          *icon_theme_path);
00263 
00264 /* Set properties */
00265 void                            app_indicator_set_status         (AppIndicator       *self,
00266                                                                   AppIndicatorStatus  status);
00267 void                            app_indicator_set_attention_icon (AppIndicator       *self,
00268                                                                   const gchar        *icon_name);
00269 void                            app_indicator_set_attention_icon_full (AppIndicator       *self,
00270                                                                   const gchar        *icon_name,
00271                                                                   const gchar        *icon_desc);
00272 void                            app_indicator_set_menu           (AppIndicator       *self,
00273                                                                   GtkMenu            *menu);
00274 void                            app_indicator_set_icon           (AppIndicator       *self,
00275                                                                   const gchar        *icon_name);
00276 void                            app_indicator_set_icon_full      (AppIndicator       *self,
00277                                                                   const gchar        *icon_name,
00278                                                                   const gchar        *icon_desc);
00279 void                            app_indicator_set_label          (AppIndicator       *self,
00280                                                                   const gchar        *label,
00281                                                                   const gchar        *guide);
00282 void                            app_indicator_set_icon_theme_path(AppIndicator       *self,
00283                                                                   const gchar        *icon_theme_path);
00284 void                            app_indicator_set_ordering_index (AppIndicator       *self,
00285                                                                   guint32             ordering_index);
00286 void                            app_indicator_set_secondary_activate_target (AppIndicator *self,
00287                                                                              GtkWidget    *menuitem);
00288 void                            app_indicator_set_title          (AppIndicator       *self,
00289                                                                   const gchar        *title);
00290 
00291 /* Get properties */
00292 const gchar *                   app_indicator_get_id                   (AppIndicator *self);
00293 AppIndicatorCategory            app_indicator_get_category             (AppIndicator *self);
00294 AppIndicatorStatus              app_indicator_get_status               (AppIndicator *self);
00295 const gchar *                   app_indicator_get_icon                 (AppIndicator *self);
00296 const gchar *                   app_indicator_get_icon_desc            (AppIndicator *self);
00297 const gchar *                   app_indicator_get_icon_theme_path      (AppIndicator *self);
00298 const gchar *                   app_indicator_get_attention_icon       (AppIndicator *self);
00299 const gchar *                   app_indicator_get_attention_icon_desc  (AppIndicator *self);
00300 const gchar *                   app_indicator_get_title                (AppIndicator *self);
00301 
00302 GtkMenu *                       app_indicator_get_menu                 (AppIndicator *self);
00303 const gchar *                   app_indicator_get_label                (AppIndicator *self);
00304 const gchar *                   app_indicator_get_label_guide          (AppIndicator *self);
00305 guint32                         app_indicator_get_ordering_index       (AppIndicator *self);
00306 GtkWidget *                     app_indicator_get_secondary_activate_target (AppIndicator *self);
00307 
00308 /* Helpers */
00309 void                            app_indicator_build_menu_from_desktop (AppIndicator * self,
00310                                                                   const gchar * desktop_file,
00311                                                                   const gchar * desktop_profile);
00312 
00313 G_END_DECLS
00314 
00332 #endif