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

gcp-shell.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 "gcp-shell.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 27 "gcp-shell.gob"

#include "gcp-page-config.h"
#include "gcm-page-loader.h"

/* For testing propose use the local (not installed) glade file */
#define GCP_SHELL_GLADE_FILE PACKAGE_DATA_DIR"/gnome-compiz-manager/glade/gnome-compiz-preferences.glade"
/* #define GCP_SHELL_GLADE_FILE "data/gnome-compiz-preferences.glade" */
      
/*
 * Standard gettext macros.
 */
#ifdef ENABLE_NLS
#  include <libintl.h>
#  undef _
#  define _(String) dgettext (PACKAGE, String)
#  ifdef gettext_noop
#    define N_(String) gettext_noop (String)
#  else
#    define N_(String) (String)
#  endif
#else
#  define textdomain(String) (String)
#  define gettext(String) (String)
#  define dgettext(Domain,Message) (Message)
#  define dcgettext(Domain,Message,Type) (Message)
#  define bindtextdomain(Domain,Directory) (Domain)
#  define _(String) (String)
#  define N_(String) (String)
#endif

#line 55 "gcp-shell.c"
/* self casting macros */
#define SELF(x) GCP_SHELL(x)
#define SELF_CONST(x) GCP_SHELL_CONST(x)
#define IS_SELF(x) GCP_IS_SHELL(x)
#define TYPE_SELF GCP_TYPE_SHELL
#define SELF_CLASS(x) GCP_SHELL_CLASS(x)

#define SELF_GET_CLASS(x) GCP_SHELL_GET_CLASS(x)

/* self typedefs */
typedef GCPShell Self;
typedef GCPShellClass SelfClass;

struct _GCPShellPrivate {
#line 0 "gcp-shell.gob"
      GladeXML * _glade_xml;
#line 60 "gcp-shell.gob"
      GtkNotebook * notebook;
#line 61 "gcp-shell.gob"
      GCMGLDesktop * gl_desktop;
#line 63 "gcp-shell.gob"
      GCPPageConfig * config_page;
#line 64 "gcp-shell.gob"
      GCMPageLoader * loader;
#line 80 "gcp-shell.c"
};
/* here are local prototypes */
static void gcp_shell_init (GCPShell * o) G_GNUC_UNUSED;
static void gcp_shell_class_init (GCPShellClass * c) G_GNUC_UNUSED;
gboolean    gcp_shell_delete_event  (GCPShell * self, GdkEvent * event, gpointer data);
void  gcp_shell_on_button_close_clicked   (GCPShell * self, GtkWidget * button);
static void gcp_shell_on_gl_desktop_changed (GCPShell * self, gboolean enable, GCPPageConfig * config) G_GNUC_UNUSED;

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

/* Short form macros */
#define self_new gcp_shell_new
#define self_delete_event gcp_shell_delete_event
#define self_on_button_close_clicked gcp_shell_on_button_close_clicked
#define self_on_gl_desktop_changed gcp_shell_on_gl_desktop_changed
GType
gcp_shell_get_type (void)
{
      static GType type = 0;

      if ___GOB_UNLIKELY(type == 0) {
            static const GTypeInfo info = {
                  sizeof (GCPShellClass),
                  (GBaseInitFunc) NULL,
                  (GBaseFinalizeFunc) NULL,
                  (GClassInitFunc) gcp_shell_class_init,
                  (GClassFinalizeFunc) NULL,
                  NULL /* class_data */,
                  sizeof (GCPShell),
                  0 /* n_preallocs */,
                  (GInstanceInitFunc) gcp_shell_init,
                  NULL
            };

            type = g_type_register_static (GTK_TYPE_WINDOW, "GCPShell", &info, (GTypeFlags)0);
      }

      return type;
}

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

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

/* a function to connect glade callback */
static void
___glade_xml_connect_foreach(const gchar *handler_name,
GObject *object,
const gchar *signal_name,
const gchar *signal_data,
GObject *connect_object,
gboolean after,
gpointer user_data)
{
      static GModule * allsymbols = NULL;
      
      if (!allsymbols) allsymbols = g_module_open(NULL, 0);
      if (allsymbols) {
            gchar * func_name = g_strdup_printf("gcp_shell_%s", handler_name);
            GCallback func;

            if (!g_module_symbol(allsymbols, func_name, (gpointer)&func)){
                  if (!g_module_symbol(allsymbols, handler_name, (gpointer)&func)) {
                        g_warning("could not find signal handler '%s'.", func_name);
                        g_free(func_name);
                        return;
                  }
            }
            if (after)
                  g_signal_connect_data(object, signal_name, func, user_data, NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
            else
                  g_signal_connect_data(object, signal_name, func, user_data, NULL, G_CONNECT_SWAPPED);
            g_free(func_name);
      }
}


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "GCP:Shell::finalize"
      GCPShell *self G_GNUC_UNUSED = GCP_SHELL (obj_self);
      gpointer priv G_GNUC_UNUSED = self->_priv;
      if(G_OBJECT_CLASS(parent_class)->finalize) \
            (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
      if(self->_priv->_glade_xml) { g_object_unref ((gpointer) self->_priv->_glade_xml); self->_priv->_glade_xml = NULL; }
#line 62 "gcp-shell.gob"
      if(self->_priv->gl_desktop) { g_object_unref ((gpointer) self->_priv->gl_desktop); self->_priv->gl_desktop = NULL; }
#line 183 "gcp-shell.c"
}
#undef __GOB_FUNCTION__

static void 
gcp_shell_init (GCPShell * o G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCP:Shell::init"
      o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,GCP_TYPE_SHELL,GCPShellPrivate);
      {
      GtkWidget * root;
      o->_priv->_glade_xml = glade_xml_new(GCP_SHELL_GLADE_FILE, "shell", NULL);
      root = glade_xml_get_widget(o->_priv->_glade_xml, "shell");
      gtk_widget_show(root);
      gtk_container_add(GTK_CONTAINER(o), root);
      glade_xml_signal_autoconnect_full(o->_priv->_glade_xml, (GladeXMLConnectFunc)___glade_xml_connect_foreach, (gpointer)o);
}
      o->_priv->notebook = (GtkNotebook * )glade_xml_get_widget(o->_priv->_glade_xml, "notebook");
}
#undef __GOB_FUNCTION__
static void 
gcp_shell_class_init (GCPShellClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "GCP:Shell::class_init"
      GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

      g_type_class_add_private(c,sizeof(GCPShellPrivate));

      parent_class = g_type_class_ref (GTK_TYPE_WINDOW);

      g_object_class->finalize = ___finalize;
}
#undef __GOB_FUNCTION__



#line 66 "gcp-shell.gob"
GCPShell * 
gcp_shell_new (void)
#line 222 "gcp-shell.c"
{
#define __GOB_FUNCTION__ "GCP:Shell::new"
{
#line 68 "gcp-shell.gob"
      
            GCPShell * self = GET_NEW;
            GtkWidget * label;
            GdkPixbuf * pixbuf;
            GSList * item;
            
            gtk_window_set_title(GTK_WINDOW(self), "Gnome Compiz Preferences");
            pixbuf = gdk_pixbuf_new_from_file(PACKAGE_DATA_DIR"/gnome-compiz-manager/glade/logo.png",
                                                              NULL);
            gtk_window_set_icon(GTK_WINDOW(self), pixbuf);
            gtk_window_set_default_size(GTK_WINDOW(self), 200, 200);
            g_signal_connect(GTK_WIDGET(self), 
                                    "delete-event", 
                                    G_CALLBACK(self_delete_event), NULL);
            
            /* Create compiz launcher */
            selfp->gl_desktop = gcm_gl_desktop_new();
            self_on_gl_desktop_changed(self, gcm_gl_desktop_enabled(selfp->gl_desktop),
                                                NULL);
            
            /* Create configuration page */
            selfp->config_page = gcp_page_config_new(selfp->gl_desktop);
            gtk_widget_show(GTK_WIDGET(selfp->config_page));
            label = gtk_label_new(_("Configuration"));
            gtk_widget_show(GTK_WIDGET(label));
            gtk_notebook_append_page(selfp->notebook, GTK_WIDGET(selfp->config_page), label);
            g_signal_connect_swapped (G_OBJECT(selfp->config_page), 
                                  "gl_desktop_changed",
                                  G_CALLBACK(self_on_gl_desktop_changed), self);
            /* Page loader */
            selfp->loader = gcm_page_loader_new(selfp->gl_desktop);
            for (item = gcm_page_loader_get_pages(selfp->loader); item; item = item->next)
            {
                  GCMPage * page = GCM_PAGE(item->data);
                  gtk_widget_show(GTK_WIDGET(page));
                  label = gtk_label_new(page->label);
                  gtk_widget_show(GTK_WIDGET(label));
                  gtk_notebook_append_page(selfp->notebook, GTK_WIDGET(page), 
                                                       label);
            }
            
            return self;
      }}
#line 270 "gcp-shell.c"
#undef __GOB_FUNCTION__

#line 112 "gcp-shell.gob"
gboolean 
gcp_shell_delete_event (GCPShell * self, GdkEvent * event, gpointer data)
#line 276 "gcp-shell.c"
{
#define __GOB_FUNCTION__ "GCP:Shell::delete_event"
#line 112 "gcp-shell.gob"
      g_return_val_if_fail (self != NULL, (gboolean )0);
#line 112 "gcp-shell.gob"
      g_return_val_if_fail (GCP_IS_SHELL (self), (gboolean )0);
#line 283 "gcp-shell.c"
{
#line 114 "gcp-shell.gob"
      
            gtk_main_quit();
            return TRUE;
      }}
#line 290 "gcp-shell.c"
#undef __GOB_FUNCTION__

#line 119 "gcp-shell.gob"
void 
gcp_shell_on_button_close_clicked (GCPShell * self, GtkWidget * button)
#line 296 "gcp-shell.c"
{
#define __GOB_FUNCTION__ "GCP:Shell::on_button_close_clicked"
#line 119 "gcp-shell.gob"
      g_return_if_fail (self != NULL);
#line 119 "gcp-shell.gob"
      g_return_if_fail (GCP_IS_SHELL (self));
#line 303 "gcp-shell.c"
{
#line 121 "gcp-shell.gob"
      
            gtk_main_quit();
      }}
#line 309 "gcp-shell.c"
#undef __GOB_FUNCTION__

#line 125 "gcp-shell.gob"
static void 
gcp_shell_on_gl_desktop_changed (GCPShell * self, gboolean enable, GCPPageConfig * config)
#line 315 "gcp-shell.c"
{
#define __GOB_FUNCTION__ "GCP:Shell::on_gl_desktop_changed"
#line 125 "gcp-shell.gob"
      g_return_if_fail (self != NULL);
#line 125 "gcp-shell.gob"
      g_return_if_fail (GCP_IS_SHELL (self));
#line 322 "gcp-shell.c"
{
#line 127 "gcp-shell.gob"
      
        gtk_notebook_set_show_tabs(selfp->notebook, enable);
            gtk_notebook_set_current_page(selfp->notebook, 0);
    }}
#line 329 "gcp-shell.c"
#undef __GOB_FUNCTION__

Generated by  Doxygen 1.6.0   Back to index