summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Geddes <vgeddes@src.gnome.org>2007-07-12 20:49:35 +0000
committerVincent Geddes <vgeddes@src.gnome.org>2007-07-12 20:49:35 +0000
commit0fb53631661139b88fbeb0c1844d577009772e51 (patch)
tree9270a3a5bf64b21fef5a1e12d0421fe3088e5431
parent25ab68be16a85e3f476449176074200af66cf200 (diff)
downloadglade-BINDINGS_BRANCHPOINT.tar.gz
Update to use G_DEFINE_TYPE macros. Removed the manual peeks to get theBINDINGS_BRANCHPOINT
* gladeui/glade-widget.c gladeui/glade-design-layout.c gladeui/glade-placeholder.c gladeui/glade-placeholder.h: Update to use G_DEFINE_TYPE macros. Removed the manual peeks to get the parent class. svn path=/trunk/; revision=1465
-rw-r--r--ChangeLog9
-rw-r--r--gladeui/glade-design-layout.c20
-rw-r--r--gladeui/glade-placeholder.c85
-rw-r--r--gladeui/glade-placeholder.h28
-rw-r--r--gladeui/glade-widget.c39
5 files changed, 75 insertions, 106 deletions
diff --git a/ChangeLog b/ChangeLog
index f1336849..5900a960 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-07-12 Vincent Geddes <vgeddes@gnome.org>
+
+ * gladeui/glade-widget.c
+ gladeui/glade-design-layout.c
+ gladeui/glade-placeholder.c
+ gladeui/glade-placeholder.h: Update to use G_DEFINE_TYPE macros. Removed
+ the manual peeks to get the parent class.
+
2007-07-12 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* gladeui/glade-widget-adaptor.c: added gwa_displayable_values_check() and use it to check
@@ -16,6 +24,7 @@
GtkList::selection-mode
GtkCList::shadow-type, selection-mode, sort-type
+
2006-07-11 Tristan Van Berkom <tvb@gnome.org>
* src/glade-window.c: Implemented docking view menu.
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c
index 500bc2c2..ffcf5a48 100644
--- a/gladeui/glade-design-layout.c
+++ b/gladeui/glade-design-layout.c
@@ -78,10 +78,7 @@ struct _GladeDesignLayoutPrivate
gulong widget_event_id;
};
-static GtkBinClass *parent_class = NULL;
-
-
-G_DEFINE_TYPE(GladeDesignLayout, glade_design_layout, GTK_TYPE_BIN)
+G_DEFINE_TYPE (GladeDesignLayout, glade_design_layout, GTK_TYPE_BIN)
static GladePointerRegion
glade_design_layout_get_pointer_region (GladeDesignLayout *layout, gint x, gint y)
@@ -584,7 +581,7 @@ glade_design_layout_map (GtkWidget *widget)
if (priv->event_window)
gdk_window_show (priv->event_window);
- GTK_WIDGET_CLASS (parent_class)->map (widget);
+ GTK_WIDGET_CLASS (glade_design_layout_parent_class)->map (widget);
}
@@ -595,7 +592,7 @@ glade_design_layout_unmap (GtkWidget *widget)
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
- GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+ GTK_WIDGET_CLASS (glade_design_layout_parent_class)->unmap (widget);
if (priv->event_window)
gdk_window_hide (priv->event_window);
@@ -658,7 +655,7 @@ glade_design_layout_unrealize (GtkWidget *widget)
priv->event_window = NULL;
}
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+ GTK_WIDGET_CLASS (glade_design_layout_parent_class)->unrealize (widget);
}
@@ -676,7 +673,7 @@ glade_design_layout_add (GtkContainer *container, GtkWidget *widget)
G_CALLBACK (child_size_request_handler),
container);
- GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
+ GTK_CONTAINER_CLASS (glade_design_layout_parent_class)->add (container, widget);
gdk_window_lower (layout->priv->event_window);
}
@@ -688,7 +685,7 @@ glade_design_layout_remove (GtkContainer *container, GtkWidget *widget)
G_CALLBACK (child_size_request_handler),
container);
- GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
+ GTK_CONTAINER_CLASS (glade_design_layout_parent_class)->remove (container, widget);
}
static void
@@ -709,7 +706,7 @@ glade_design_layout_dispose (GObject *object)
priv->cursor_resize_bottom_right = NULL;
}
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (glade_design_layout_parent_class)->dispose (object);
}
static void
@@ -721,7 +718,7 @@ glade_design_layout_finalize (GObject *object)
g_free (priv->current_size_request);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (glade_design_layout_parent_class)->finalize (object);
}
/* creates a gc to draw a nice border around the child */
@@ -890,7 +887,6 @@ glade_design_layout_class_init (GladeDesignLayoutClass *klass)
GtkContainerClass *container_class;
object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
widget_class = GTK_WIDGET_CLASS (klass);
container_class = GTK_CONTAINER_CLASS (klass);
diff --git a/gladeui/glade-placeholder.c b/gladeui/glade-placeholder.c
index 2ca84444..d3175a4c 100644
--- a/gladeui/glade-placeholder.c
+++ b/gladeui/glade-placeholder.c
@@ -2,6 +2,9 @@
/*
* Copyright (C) 2003, 2004 Joaquin Cuenca Abela
*
+ * Authors:
+ * Joaquin Cuenca Abela <e98cuenc@yahoo.com>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
@@ -16,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Authors:
- * Joaquin Cuenca Abela <e98cuenc@yahoo.com>
- */
+*/
#include "config.h"
@@ -34,23 +35,29 @@
#include "glade-widget.h"
#include "glade-app.h"
-static void glade_placeholder_class_init (GladePlaceholderClass *klass);
-static void glade_placeholder_init (GladePlaceholder *placeholder);
-static void glade_placeholder_finalize (GObject *object);
-static void glade_placeholder_realize (GtkWidget *widget);
-static void glade_placeholder_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void glade_placeholder_send_configure (GladePlaceholder *placeholder);
-static gboolean glade_placeholder_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gboolean glade_placeholder_motion_notify_event (GtkWidget *widget,
- GdkEventMotion *event);
-static gboolean glade_placeholder_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gboolean glade_placeholder_popup_menu (GtkWidget *widget);
+#define WIDTH_REQUISITION 20
+#define HEIGHT_REQUISITION 20
+
+static void glade_placeholder_finalize (GObject *object);
+static void glade_placeholder_realize (GtkWidget *widget);
+
+static void glade_placeholder_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+
+static void glade_placeholder_send_configure (GladePlaceholder *placeholder);
+
+static gboolean glade_placeholder_expose (GtkWidget *widget,
+ GdkEventExpose *event);
+
+static gboolean glade_placeholder_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event);
+
+static gboolean glade_placeholder_button_press (GtkWidget *widget,
+ GdkEventButton *event);
+
+static gboolean glade_placeholder_popup_menu (GtkWidget *widget);
-static GtkWidgetClass *parent_class = NULL;
static char *placeholder_xpm[] = {
/* columns rows colors chars-per-pixel */
@@ -68,39 +75,7 @@ static char *placeholder_xpm[] = {
" .. "
};
-/**
- * glade_placeholder_get_type:
- *
- * Creates the typecode for the #GladePlaceholder object type.
- *
- * Returns: the typecode for the #GladePlaceholder object type
- */
-GType
-glade_placeholder_get_type (void)
-{
- static GType placeholder_type = 0;
-
- if (!placeholder_type)
- {
- static const GTypeInfo placeholder_info =
- {
- sizeof (GladePlaceholderClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) glade_placeholder_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GladePlaceholder),
- 0, /* n_preallocs */
- (GInstanceInitFunc) glade_placeholder_init,
- };
-
- placeholder_type = g_type_register_static (GTK_TYPE_WIDGET, "GladePlaceholder",
- &placeholder_info, 0);
- }
-
- return placeholder_type;
-}
+G_DEFINE_TYPE (GladePlaceholder, glade_placeholder, GTK_TYPE_WIDGET)
static void
glade_placeholder_class_init (GladePlaceholderClass *klass)
@@ -108,8 +83,6 @@ glade_placeholder_class_init (GladePlaceholderClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = glade_placeholder_finalize;
widget_class->realize = glade_placeholder_realize;
widget_class->size_allocate = glade_placeholder_size_allocate;
@@ -147,8 +120,8 @@ glade_placeholder_init (GladePlaceholder *placeholder)
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (placeholder), GTK_CAN_FOCUS);
gtk_widget_set_size_request (GTK_WIDGET (placeholder),
- GLADE_PLACEHOLDER_WIDTH_REQ,
- GLADE_PLACEHOLDER_HEIGHT_REQ);
+ WIDTH_REQUISITION,
+ HEIGHT_REQUISITION);
g_signal_connect (placeholder, "notify::parent",
G_CALLBACK (glade_placeholder_notify_parent),
@@ -187,7 +160,7 @@ glade_placeholder_finalize (GObject *object)
g_list_free (placeholder->packing_actions);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (glade_placeholder_parent_class)->finalize (object);
}
static void
diff --git a/gladeui/glade-placeholder.h b/gladeui/glade-placeholder.h
index 566ea907..c6c0942a 100644
--- a/gladeui/glade-placeholder.h
+++ b/gladeui/glade-placeholder.h
@@ -1,4 +1,26 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003, 2004 Joaquin Cuenca Abela
+ *
+ * Authors:
+ * Joaquin Cuenca Abela <e98cuenc@yahoo.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+*/
+
#ifndef __GLADE_PLACEHOLDER_H__
#define __GLADE_PLACEHOLDER_H__
@@ -14,13 +36,9 @@ G_BEGIN_DECLS
#define GLADE_IS_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PLACEHOLDER))
#define GLADE_PLACEHOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_PLACEHOLDER, GladePlaceholderClass))
-#define GLADE_PLACEHOLDER_WIDTH_REQ 20
-#define GLADE_PLACEHOLDER_HEIGHT_REQ 20
-
-typedef struct _GladePlaceholder GladePlaceholder;
+typedef struct _GladePlaceholder GladePlaceholder;
typedef struct _GladePlaceholderClass GladePlaceholderClass;
-
struct _GladePlaceholder
{
GtkWidget widget;
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 892fe09b..756a6887 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -98,7 +98,6 @@ enum
};
static guint glade_widget_signals[LAST_SIGNAL] = {0};
-static GObjectClass *parent_class = NULL;
/* Sometimes we need to use the project deep in the loading code,
* this is just a shortcut way to get the project.
@@ -106,6 +105,9 @@ static GObjectClass *parent_class = NULL;
static GladeProject *loading_project = NULL;
static GQuark glade_widget_name_quark = 0;
+
+G_DEFINE_TYPE (GladeWidget, glade_widget, G_TYPE_OBJECT)
+
/*******************************************************************************
GladeWidget class methods
*******************************************************************************/
@@ -640,7 +642,7 @@ glade_widget_constructor (GType type,
GObject *ret_obj, *object;
GList *properties = NULL, *list;
- ret_obj = G_OBJECT_CLASS (parent_class)->constructor
+ ret_obj = G_OBJECT_CLASS (glade_widget_parent_class)->constructor
(type, n_construct_properties, construct_properties);
gwidget = GLADE_WIDGET (ret_obj);
@@ -742,7 +744,7 @@ glade_widget_finalize (GObject *object)
g_free (widget->internal);
g_hash_table_destroy (widget->signals);
- G_OBJECT_CLASS(parent_class)->finalize(object);
+ G_OBJECT_CLASS(glade_widget_parent_class)->finalize(object);
}
static void
@@ -785,8 +787,7 @@ glade_widget_dispose (GObject *object)
g_list_free (widget->packing_actions);
}
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS (glade_widget_parent_class)->dispose (object);
}
static void
@@ -951,7 +952,6 @@ glade_widget_class_init (GladeWidgetClass *klass)
g_quark_from_static_string ("GladeWidgetDataTag");
object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
object_class->constructor = glade_widget_constructor;
object_class->finalize = glade_widget_finalize;
@@ -1181,33 +1181,6 @@ glade_widget_class_init (GladeWidgetClass *klass)
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
}
-GType
-glade_widget_get_type (void)
-{
- static GType widget_type = 0;
-
- if (!widget_type)
- {
- static const GTypeInfo widget_info =
- {
- sizeof (GladeWidgetClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) glade_widget_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GladeWidget),
- 0, /* n_preallocs */
- (GInstanceInitFunc) glade_widget_init,
- };
-
- widget_type = g_type_register_static (G_TYPE_OBJECT, "GladeWidget",
- &widget_info, 0);
- }
-
- return widget_type;
-}
-
/*******************************************************************************
Static stuff....
*******************************************************************************/