Logo Search packages:      
Sourcecode: gnome-compiz-manager version File versions

gcm-tray-icon.c

/* Generated by GOB (v2.0.14)   (do not edit directly) */

/* End world hunger, donate to the World Food Programme, http://www.wfp.org */

#define GOB_VERSION_MAJOR 2
#define GOB_VERSION_MINOR 0
#define GOB_VERSION_PATCHLEVEL 14

#define selfp (self->_priv)

#include <string.h> /* memset() */

#include "gcm-tray-icon.h"

#ifdef G_LIKELY
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
#else /* ! G_LIKELY */
#define ___GOB_LIKELY(expr) (expr)
#define ___GOB_UNLIKELY(expr) (expr)
#endif /* G_LIKELY */

#line 33 "gcm-tray-icon.gob"

#include <unistd.h>
#include <time.h>

#include "gcm-tray-menu.h"
#include "gcm-config.h"
      
#define COMPIZ_LOGO PACKAGE_DATA_DIR"/gnome-compiz-manager/logo24.png"
#define COMPIZ_LOGO_OFF PACKAGE_DATA_DIR"/gnome-compiz-manager/logooff24.png"
#define METACITY_LOGO PACKAGE_DATA_DIR"/gnome-compiz-manager/metacity24.png"

#line 36 "gcm-tray-icon.c"
/* self casting macros */
#define SELF(x) GCM_TRAY_ICON(x)
#define SELF_CONST(x) GCM_TRAY_ICON_CONST(x)
#define IS_SELF(x) GCM_IS_TRAY_ICON(x)
#define TYPE_SELF GCM_TYPE_TRAY_ICON
#define SELF_CLASS(x) GCM_TRAY_ICON_CLASS(x)

#define SELF_GET_CLASS(x) GCM_TRAY_ICON_GET_CLASS(x)

/* self typedefs */
typedef GCMTrayIcon Self;
typedef GCMTrayIconClass SelfClass;

struct _GCMTrayIconPrivate {
#line 47 "gcm-tray-icon.gob"
      GCMGLDesktop * gl_desktop;
#line 49 "gcm-tray-icon.gob"
      GtkStatusIcon * trayicon;
#line 51 "gcm-tray-icon.gob"
      GCMTrayMenu * traymenu;
#line 57 "gcm-tray-icon.c"
};
/* here are local prototypes */
static void gcm_tray_icon_init (GCMTrayIcon * o) G_GNUC_UNUSED;
static void gcm_tray_icon_class_init (GCMTrayIconClass * klass) G_GNUC_UNUSED;
static void gcm_tray_icon_on_tray_icon_popup_menu (GCMTrayIcon * self, guint button, guint activate_timeout, GtkStatusIcon * trayicon) G_GNUC_UNUSED;
static void gcm_tray_icon_enable_gl_desktop_changed (GConfClient * client, guint cnxn_id, GConfEntry * entry, GCMTrayIcon * self) G_GNUC_UNUSED;
static void gcm_tray_icon_tray_icon_changed (GConfClient * client, guint cnxn_id, GConfEntry * entry, GCMTrayIcon * self) G_GNUC_UNUSED;

/*
 * Signal connection wrapper macro shortcuts
 */
#define self_connect__stopped(object,func,data) gcm_tray_icon_connect__stopped((object),(func),(data))
#define self_connect_after__stopped(object,func,data) gcm_tray_icon_connect_after__stopped((object),(func),(data))
#define self_connect_data__stopped(object,func,data,destroy_data,flags) gcm_tray_icon_connect_data__stopped((object),(func),(data),(destroy_data),(flags))

enum {
      STOPPED_SIGNAL,
      LAST_SIGNAL
};

static guint object_signals[LAST_SIGNAL] = {0};

/* pointer to the class of our parent */
static GObjectClass *parent_class = NULL;

/* Short form macros */
#define self_stopped gcm_tray_icon_stopped
#define self_new gcm_tray_icon_new
#define self_on_tray_icon_popup_menu gcm_tray_icon_on_tray_icon_popup_menu
#define self_enable_gl_desktop_changed gcm_tray_icon_enable_gl_desktop_changed
#define self_tray_icon_changed gcm_tray_icon_tray_icon_changed
GType
gcm_tray_icon_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (GCMTrayIconClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) gcm_tray_icon_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (GCMTrayIcon),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) gcm_tray_icon_init,
                  NULL
            };

            type = g_type_register_static (G_TYPE_OBJECT, "GCMTrayIcon", &info, (GTypeFlags)0);
      }

      return type;
}

/* a macro for creating a new object of our type */
#define GET_NEW ((GCMTrayIcon *)g_object_new(gcm_tray_icon_get_type(), NULL))

/* a function for creating a new object of our type */
#include <stdarg.h>
static GCMTrayIcon * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
static GCMTrayIcon *
GET_NEW_VARG (const char *first, ...)
{
      GCMTrayIcon *ret;
      va_list ap;
      va_start (ap, first);
      ret = (GCMTrayIcon *)g_object_new_valist (gcm_tray_icon_get_type (), first, ap);
      va_end (ap);
      return ret;
}


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "GCM:Tray:Icon::finalize"
      GCMTrayIcon *self G_GNUC_UNUSED = GCM_TRAY_ICON (obj_self);
      gpointer priv G_GNUC_UNUSED = self->_priv;
      if(G_OBJECT_CLASS(parent_class)->finalize) \
            (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
#line 48 "gcm-tray-icon.gob"
      if(self->_priv->gl_desktop) { g_object_unref ((gpointer) self->_priv->gl_desktop); self->_priv->gl_desktop = NULL; }
#line 142 "gcm-tray-icon.c"
#line 50 "gcm-tray-icon.gob"
      if(self->_priv->trayicon) { g_object_unref ((gpointer) self->_priv->trayicon); self->_priv->trayicon = NULL; }
#line 145 "gcm-tray-icon.c"
#line 52 "gcm-tray-icon.gob"
      if(self->_priv->traymenu) { g_object_unref ((gpointer) self->_priv->traymenu); self->_priv->traymenu = NULL; }
#line 148 "gcm-tray-icon.c"
}
#undef __GOB_FUNCTION__

static void 
gcm_tray_icon_init (GCMTrayIcon * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCM:Tray:Icon::init"
      o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,GCM_TYPE_TRAY_ICON,GCMTrayIconPrivate);
}
#undef __GOB_FUNCTION__
#line 55 "gcm-tray-icon.gob"
static void 
gcm_tray_icon_class_init (GCMTrayIconClass * klass G_GNUC_UNUSED)
#line 162 "gcm-tray-icon.c"
{
#define __GOB_FUNCTION__ "GCM:Tray:Icon::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) klass;

      g_type_class_add_private(klass,sizeof(GCMTrayIconPrivate));

      parent_class = g_type_class_ref (G_TYPE_OBJECT);

      object_signals[STOPPED_SIGNAL] =
            g_signal_new ("stopped",
                  G_TYPE_FROM_CLASS (g_object_class),
                  (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
                  G_STRUCT_OFFSET (GCMTrayIconClass, stopped),
                  NULL, NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);

      klass->stopped = NULL;
      g_object_class->finalize = ___finalize;
 {
#line 56 "gcm-tray-icon.gob"

            klass->client = gconf_client_get_default ();
            gconf_client_add_dir (klass->client,
                                            GCP_PREFIX,
                                            GCONF_CLIENT_PRELOAD_NONE,
                                            NULL);
      
#line 191 "gcm-tray-icon.c"
 }
}
#undef __GOB_FUNCTION__



#line 64 "gcm-tray-icon.gob"
void 
gcm_tray_icon_stopped (GCMTrayIcon * self)
#line 201 "gcm-tray-icon.c"
{
      GValue ___param_values[1];
      GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 64 "gcm-tray-icon.gob"
      g_return_if_fail (self != NULL);
#line 64 "gcm-tray-icon.gob"
      g_return_if_fail (GCM_IS_TRAY_ICON (self));
#line 213 "gcm-tray-icon.c"

      ___param_values[0].g_type = 0;
      g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
      g_value_set_instance (&___param_values[0], (gpointer) self);

      g_signal_emitv (___param_values,
            object_signals[STOPPED_SIGNAL],
            0 /* detail */,
            &___return_val);

      g_value_unset (&___param_values[0]);
}

#line 67 "gcm-tray-icon.gob"
GCMTrayIcon * 
gcm_tray_icon_new (void)
#line 230 "gcm-tray-icon.c"
{
#define __GOB_FUNCTION__ "GCM:Tray:Icon::new"
{
#line 69 "gcm-tray-icon.gob"
      
            GCMTrayIcon * self = GET_NEW;
            GdkPixbuf * image;
            
            if (!gconf_client_get_bool(SELF_GET_CLASS(self)->client, 
                                                   GCP_CONFIG_TRAY_ICON,
                                                   NULL))
            {
                  g_object_unref(self);
                  return NULL;
            }
            
            selfp->gl_desktop = gcm_gl_desktop_new();
            selfp->traymenu = gcm_tray_menu_new(selfp->gl_desktop);
            image = gdk_pixbuf_new_from_file(
                  gcm_gl_desktop_enabled(selfp->gl_desktop) ? COMPIZ_LOGO : COMPIZ_LOGO_OFF,
                                                             NULL);
            selfp->trayicon = gtk_status_icon_new_from_pixbuf(image);
            
            g_signal_connect_swapped(selfp->trayicon, 
                                                 "popup-menu", 
                                                 (GCallback)self_on_tray_icon_popup_menu, self);
            
            /* Monitor gconf enable_gl_desktop value */
            gconf_client_notify_add(SELF_GET_CLASS(self)->client, 
                                                GCP_CONFIG_ENABLE_GL_DESKTOP,
                                                (GConfClientNotifyFunc)self_enable_gl_desktop_changed,
                                                self, NULL, NULL);
            /* Monitor gconf enable_gl_desktop value */
            gconf_client_notify_add(SELF_GET_CLASS(self)->client, 
                                                GCP_CONFIG_TRAY_ICON,
                                                (GConfClientNotifyFunc)self_tray_icon_changed,
                                                self, NULL, NULL);
            return self;
      }}
#line 270 "gcm-tray-icon.c"
#undef __GOB_FUNCTION__

#line 105 "gcm-tray-icon.gob"
static void 
gcm_tray_icon_on_tray_icon_popup_menu (GCMTrayIcon * self, guint button, guint activate_timeout, GtkStatusIcon * trayicon)
#line 276 "gcm-tray-icon.c"
{
#define __GOB_FUNCTION__ "GCM:Tray:Icon::on_tray_icon_popup_menu"
#line 105 "gcm-tray-icon.gob"
      g_return_if_fail (self != NULL);
#line 105 "gcm-tray-icon.gob"
      g_return_if_fail (GCM_IS_TRAY_ICON (self));
#line 283 "gcm-tray-icon.c"
{
#line 108 "gcm-tray-icon.gob"
      
            gtk_menu_popup(GTK_MENU(selfp->traymenu), NULL, NULL, 
                                 (GtkMenuPositionFunc)gtk_status_icon_position_menu, 
                                 trayicon, button, activate_timeout);
      }}
#line 291 "gcm-tray-icon.c"
#undef __GOB_FUNCTION__

#line 114 "gcm-tray-icon.gob"
static void 
gcm_tray_icon_enable_gl_desktop_changed (GConfClient * client, guint cnxn_id, GConfEntry * entry, GCMTrayIcon * self)
#line 297 "gcm-tray-icon.c"
{
#define __GOB_FUNCTION__ "GCM:Tray:Icon::enable_gl_desktop_changed"
{
#line 119 "gcm-tray-icon.gob"
      
            GConfValue * value = gconf_entry_get_value(entry);
            gboolean enable = gconf_value_get_bool(value);
            GdkPixbuf * image  = gdk_pixbuf_new_from_file(enable ? COMPIZ_LOGO : COMPIZ_LOGO_OFF,
                                                                                NULL);
            
            gtk_status_icon_set_from_pixbuf(selfp->trayicon, image);
      }}
#line 310 "gcm-tray-icon.c"
#undef __GOB_FUNCTION__

#line 128 "gcm-tray-icon.gob"
static void 
gcm_tray_icon_tray_icon_changed (GConfClient * client, guint cnxn_id, GConfEntry * entry, GCMTrayIcon * self)
#line 316 "gcm-tray-icon.c"
{
#define __GOB_FUNCTION__ "GCM:Tray:Icon::tray_icon_changed"
{
#line 133 "gcm-tray-icon.gob"
      
            GConfValue * value = gconf_entry_get_value(entry);
            gboolean enable = gconf_value_get_bool(value);
            
            if (!enable)
            self_stopped(self);
      }}
#line 328 "gcm-tray-icon.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index