Commit f960fd2d authored by Matthew Barnes's avatar Matthew Barnes
Browse files

Reduce usage of g_type_class_peek_parent().

G_DEFINE_TYPE macros define a static "parent_class" variable.
parent 88db20f3
......@@ -53,7 +53,6 @@ enum {
};
static GSList *all_editors;
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
G_DEFINE_ABSTRACT_TYPE (EABEditor, eab_editor, G_TYPE_OBJECT)
......@@ -140,7 +139,7 @@ eab_editor_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (eab_editor_parent_class)->dispose (object);
}
static void
......@@ -149,7 +148,7 @@ eab_editor_finalize (GObject *object)
all_editors = g_slist_remove (all_editors, object);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (eab_editor_parent_class)->finalize (object);
}
static void
......@@ -157,7 +156,6 @@ eab_editor_class_init (EABEditorClass *class)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EABEditorPrivate));
object_class = G_OBJECT_CLASS (class);
......
......@@ -137,8 +137,6 @@ struct _EContactListEditorPrivate {
guint in_async_call : 1;
};
static gpointer parent_class;
G_DEFINE_TYPE (EContactListEditor, e_contact_list_editor, EAB_TYPE_EDITOR)
static EContactListEditor *
......@@ -1347,7 +1345,7 @@ contact_list_editor_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (e_contact_list_editor_parent_class)->dispose (object);
}
static void
......@@ -1364,7 +1362,8 @@ contact_list_editor_constructed (GObject *object)
editor = E_CONTACT_LIST_EDITOR (object);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
G_OBJECT_CLASS (e_contact_list_editor_parent_class)->
constructed (object);
shell = eab_editor_get_shell (EAB_EDITOR (editor));
registry = e_shell_get_registry (shell);
......@@ -1576,7 +1575,6 @@ e_contact_list_editor_class_init (EContactListEditorClass *class)
GObjectClass *object_class;
EABEditorClass *editor_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EContactListEditorPrivate));
object_class = G_OBJECT_CLASS (class);
......
......@@ -33,8 +33,6 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CONTACT_LIST_MODEL, EContactListModelPrivate))
static gpointer parent_class;
G_DEFINE_TYPE (EContactListModel, e_contact_list_model, GTK_TYPE_TREE_STORE);
struct _EContactListModelPrivate {
......@@ -71,8 +69,8 @@ contact_list_model_constructor (GType type,
types[0] = E_TYPE_DESTINATION;
/* Chain up to parent's constructor() method. */
object = G_OBJECT_CLASS (parent_class)->constructor (
type, n_construct_properties, construct_properties);
object = G_OBJECT_CLASS (e_contact_list_model_parent_class)->
constructor (type, n_construct_properties, construct_properties);
gtk_tree_store_set_column_types (
GTK_TREE_STORE (object), G_N_ELEMENTS (types), types);
......@@ -105,8 +103,6 @@ e_contact_list_model_class_init (EContactListModelClass *class)
g_type_class_add_private (class, sizeof (EContactListModelPrivate));
parent_class = g_type_class_peek_parent (class);
object_class = G_OBJECT_CLASS (class);
object_class->constructor = contact_list_model_constructor;
object_class->dispose = contact_list_model_dispose;
......
......@@ -83,7 +83,6 @@ enum {
LAST_SIGNAL
};
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (EAddressbookModel, e_addressbook_model, G_TYPE_OBJECT)
......@@ -575,7 +574,7 @@ addressbook_model_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (e_addressbook_model_parent_class)->dispose (object);
}
static void
......@@ -588,7 +587,7 @@ addressbook_model_finalize (GObject *object)
g_ptr_array_free (priv->contacts, TRUE);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (e_addressbook_model_parent_class)->finalize (object);
}
static void
......@@ -596,7 +595,6 @@ e_addressbook_model_class_init (EAddressbookModelClass *class)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EAddressbookModelPrivate));
object_class = G_OBJECT_CLASS (class);
......
......@@ -125,7 +125,6 @@ static GtkTargetEntry drag_types[] = {
{ (gchar *) "text/x-vcard", 0, DND_TARGET_TYPE_VCARD }
};
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
/* Forward Declarations */
......@@ -566,7 +565,7 @@ addressbook_view_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (e_addressbook_view_parent_class)->dispose (object);
}
static void
......@@ -603,7 +602,7 @@ addressbook_view_constructed (GObject *object)
* view in GalViewInstance::loaded signal handlers. */
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
G_OBJECT_CLASS (e_addressbook_view_parent_class)->constructed (object);
}
static void
......@@ -765,7 +764,6 @@ e_addressbook_view_class_init (EAddressbookViewClass *class)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EAddressbookViewPrivate));
object_class = G_OBJECT_CLASS (class);
......
......@@ -39,7 +39,6 @@ static void e_minicard_label_set_property (GObject *object, guint property_id,
static void e_minicard_label_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event);
static void e_minicard_label_realize (GnomeCanvasItem *item);
static void e_minicard_label_unrealize (GnomeCanvasItem *item);
static void e_minicard_label_reflow (GnomeCanvasItem *item, gint flags);
static void e_minicard_label_style_set (EMinicardLabel *label, GtkStyle *previous_style);
......@@ -47,8 +46,6 @@ static void e_minicard_label_resize_children ( EMinicardLabel *e_minicard_label
static void set_colors (EMinicardLabel *label);
static GnomeCanvasGroupClass *parent_class = NULL;
/* The arguments we take */
enum {
PROP_0,
......@@ -85,8 +82,6 @@ e_minicard_label_class_init (EMinicardLabelClass *class)
class->style_set = e_minicard_label_style_set;
parent_class = g_type_class_peek_parent (class);
object_class->set_property = e_minicard_label_set_property;
object_class->get_property = e_minicard_label_get_property;
/* object_class->destroy = e_minicard_label_destroy; */
......@@ -159,7 +154,6 @@ e_minicard_label_class_init (EMinicardLabelClass *class)
/* GnomeCanvasItem method overrides */
item_class->realize = e_minicard_label_realize;
item_class->unrealize = e_minicard_label_unrealize;
item_class->event = e_minicard_label_event;
}
......@@ -274,8 +268,7 @@ e_minicard_label_realize (GnomeCanvasItem *item)
e_minicard_label = E_MINICARD_LABEL (item);
group = GNOME_CANVAS_GROUP ( item );
if (GNOME_CANVAS_ITEM_CLASS ( parent_class )->realize)
(* GNOME_CANVAS_ITEM_CLASS ( parent_class )->realize) (item);
GNOME_CANVAS_ITEM_CLASS (e_minicard_label_parent_class)->realize (item);
e_canvas_item_request_reflow (item);
......@@ -316,13 +309,6 @@ e_minicard_label_realize (GnomeCanvasItem *item)
e_canvas_item_request_reflow (item);
}
static void
e_minicard_label_unrealize (GnomeCanvasItem *item)
{
if (GNOME_CANVAS_ITEM_CLASS ( parent_class )->unrealize)
(* GNOME_CANVAS_ITEM_CLASS ( parent_class )->unrealize) (item);
}
static gboolean
e_minicard_label_event (GnomeCanvasItem *item,
GdkEvent *event)
......@@ -367,10 +353,8 @@ e_minicard_label_event (GnomeCanvasItem *item,
break;
}
if (GNOME_CANVAS_ITEM_CLASS ( parent_class )->event)
return (* GNOME_CANVAS_ITEM_CLASS ( parent_class )->event) (item, event);
else
return 0;
return GNOME_CANVAS_ITEM_CLASS (e_minicard_label_parent_class)->
event (item, event);
}
static void
......
......@@ -55,8 +55,6 @@ static gboolean e_minicard_view_widget_real_focus_in_event
(GtkWidget *widget,
GdkEventFocus *event);
static gpointer parent_class;
/* The arguments we take */
enum {
PROP_0,
......@@ -89,8 +87,6 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *class)
GtkWidgetClass *widget_class;
ECanvasClass *canvas_class;
parent_class = g_type_class_peek_parent (class);
object_class = G_OBJECT_CLASS (class);
object_class->set_property = e_minicard_view_widget_set_property;
object_class->get_property = e_minicard_view_widget_get_property;
......@@ -308,7 +304,7 @@ e_minicard_view_widget_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (e_minicard_view_widget_parent_class)->dispose (object);
}
static void
......@@ -374,8 +370,8 @@ e_minicard_view_widget_style_set (GtkWidget *widget,
view->background, "fill_color_gdk",
&style->base[GTK_STATE_NORMAL], NULL);
if (GTK_WIDGET_CLASS (parent_class)->style_set)
GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
GTK_WIDGET_CLASS (e_minicard_view_widget_parent_class)->
style_set (widget, previous_style);
}
static void
......@@ -420,16 +416,16 @@ e_minicard_view_widget_realize (GtkWidget *widget)
view->emv, "right_click",
G_CALLBACK (right_click), view);
if (GTK_WIDGET_CLASS (parent_class)->realize)
GTK_WIDGET_CLASS (parent_class)->realize (widget);
GTK_WIDGET_CLASS (e_minicard_view_widget_parent_class)->
realize (widget);
}
static void
e_minicard_view_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
GTK_WIDGET_CLASS (e_minicard_view_widget_parent_class)->
size_allocate (widget, allocation);
if (gtk_widget_get_realized (widget)) {
gdouble width;
......@@ -456,8 +452,7 @@ e_minicard_view_widget_reflow (ECanvas *canvas)
EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET (canvas);
GtkAllocation allocation;
if (E_CANVAS_CLASS (parent_class)->reflow)
E_CANVAS_CLASS (parent_class)->reflow (canvas);
E_CANVAS_CLASS (e_minicard_view_widget_parent_class)->reflow (canvas);
g_object_get (view->emv, "width", &width, NULL);
gtk_widget_get_allocation (GTK_WIDGET (canvas), &allocation);
......@@ -506,9 +501,7 @@ e_minicard_view_widget_real_focus_in_event (GtkWidget *widget,
}
}
if (GTK_WIDGET_CLASS (parent_class)->focus_in_event)
return GTK_WIDGET_CLASS (parent_class)->focus_in_event (widget, event);
return FALSE;
return GTK_WIDGET_CLASS (e_minicard_view_widget_parent_class)->
focus_in_event (widget, event);
}
......@@ -45,8 +45,6 @@ static void e_minicard_view_drag_data_get (GtkWidget *widget,
guint time,
EMinicardView *view);
static EReflowClass *parent_class = NULL;
/* The arguments we take */
enum {
PROP_0,
......@@ -374,7 +372,7 @@ e_minicard_view_dispose (GObject *object)
view->adapter = NULL;
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (e_minicard_view_parent_class)->dispose (object);
}
static guint
......@@ -421,10 +419,8 @@ e_minicard_view_event (GnomeCanvasItem *item,
break;
}
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->event)
return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event);
else
return FALSE;
return GNOME_CANVAS_ITEM_CLASS (e_minicard_view_parent_class)->
event (item, event);
}
static gint
......@@ -436,9 +432,8 @@ e_minicard_view_selection_event (EReflow *reflow,
gint return_val = FALSE;
view = E_MINICARD_VIEW (reflow);
if (parent_class->selection_event) {
return_val = parent_class->selection_event (reflow, item, event);
}
return_val = E_REFLOW_CLASS (e_minicard_view_parent_class)->
selection_event (reflow, item, event);
switch (event->type) {
case GDK_FOCUS_CHANGE:
......@@ -476,8 +471,6 @@ e_minicard_view_class_init (EMinicardViewClass *class)
item_class = (GnomeCanvasItemClass *) class;
reflow_class = (EReflowClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->set_property = e_minicard_view_set_property;
object_class->get_property = e_minicard_view_get_property;
object_class->dispose = e_minicard_view_dispose;
......
......@@ -46,7 +46,6 @@ static void e_minicard_dispose (GObject *object);
static void e_minicard_finalize (GObject *object);
static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event);
static void e_minicard_realize (GnomeCanvasItem *item);
static void e_minicard_unrealize (GnomeCanvasItem *item);
static void e_minicard_reflow ( GnomeCanvasItem *item, gint flags );
static void e_minicard_style_set (EMinicard *minicard, GtkStyle *previous_style);
......@@ -55,8 +54,6 @@ static void remodel ( EMinicard *e_minicard );
static gint e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event);
static gpointer parent_class;
#define d(x)
#define LIST_ICON_NAME "stock_contact-list"
......@@ -109,8 +106,6 @@ e_minicard_class_init (EMinicardClass *class)
GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
parent_class = g_type_class_peek_parent (class);
object_class = G_OBJECT_CLASS (class);
object_class->set_property = e_minicard_set_property;
object_class->get_property = e_minicard_get_property;
......@@ -119,7 +114,6 @@ e_minicard_class_init (EMinicardClass *class)
item_class = GNOME_CANVAS_ITEM_CLASS (class);
item_class->realize = e_minicard_realize;
item_class->unrealize = e_minicard_unrealize;
item_class->event = e_minicard_event;
class->style_set = e_minicard_style_set;
......@@ -421,7 +415,7 @@ e_minicard_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (e_minicard_parent_class)->dispose (object);
}
static void
......@@ -445,7 +439,7 @@ e_minicard_finalize (GObject *object)
}
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (e_minicard_parent_class)->finalize (object);
}
static void
......@@ -472,8 +466,7 @@ e_minicard_realize (GnomeCanvasItem *item)
canvas = GNOME_CANVAS_ITEM (item)->canvas;
style = gtk_widget_get_style (GTK_WIDGET (canvas));
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) (item);
GNOME_CANVAS_ITEM_CLASS (e_minicard_parent_class)->realize (item);
e_minicard->rect =
gnome_canvas_item_new ( group,
......@@ -519,13 +512,6 @@ e_minicard_realize (GnomeCanvasItem *item)
e_canvas_item_request_reflow (item);
}
static void
e_minicard_unrealize (GnomeCanvasItem *item)
{
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item);
}
void
e_minicard_activate_editor (EMinicard *minicard)
{
......@@ -695,10 +681,7 @@ e_minicard_event (GnomeCanvasItem *item,
break;
}
if (GNOME_CANVAS_ITEM_CLASS ( parent_class )->event)
return (* GNOME_CANVAS_ITEM_CLASS ( parent_class )->event) (item, event);
else
return FALSE;
return FALSE;
}
static void
......
......@@ -32,8 +32,6 @@ static const gchar * ea_ab_view_get_description (AtkObject *accessible);
static void ea_ab_view_class_init (EAddressbookViewClass *class);
static gpointer parent_class = NULL;
GType
ea_ab_view_get_type (void)
{
......@@ -80,8 +78,6 @@ ea_ab_view_class_init (EAddressbookViewClass *class)
{
AtkObjectClass *atk_object_class;
parent_class = g_type_class_peek_parent (class);
atk_object_class = ATK_OBJECT_CLASS (class);
atk_object_class->get_name = ea_ab_view_get_name;
atk_object_class->get_description = ea_ab_view_get_description;
......
......@@ -81,7 +81,6 @@ static const gchar *ui =
" </popup>"
"</ui>";
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (
......@@ -276,7 +275,7 @@ contact_display_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (eab_contact_display_parent_class)->dispose (object);
}
static void
......@@ -312,7 +311,7 @@ contact_display_hovering_over_link (EWebView *web_view,
chainup:
/* Chain up to parent's hovering_over_link() method. */
web_view_class = E_WEB_VIEW_CLASS (parent_class);
web_view_class = E_WEB_VIEW_CLASS (eab_contact_display_parent_class);
web_view_class->hovering_over_link (web_view, title, uri);
}
......@@ -335,7 +334,8 @@ contact_display_link_clicked (EWebView *web_view,
}
/* Chain up to parent's link_clicked() method. */
E_WEB_VIEW_CLASS (parent_class)->link_clicked (web_view, uri);
E_WEB_VIEW_CLASS (eab_contact_display_parent_class)->
link_clicked (web_view, uri);
}
#ifdef WITH_CONTACT_MAPS
......@@ -428,7 +428,8 @@ contact_display_update_actions (EWebView *web_view,
const gchar *uri;
/* Chain up to parent's update_actions() method. */
E_WEB_VIEW_CLASS (parent_class)->update_actions (web_view, event);
E_WEB_VIEW_CLASS (eab_contact_display_parent_class)->
update_actions (web_view, event);
uri = e_web_view_get_selected_uri (web_view);
......@@ -454,7 +455,6 @@ eab_contact_display_class_init (EABContactDisplayClass *class)
GObjectClass *object_class;
EWebViewClass *web_view_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EABContactDisplayPrivate));
object_class = G_OBJECT_CLASS (class);
......
......@@ -46,8 +46,6 @@ G_DEFINE_TYPE (
#define TEXT_IS_RIGHT_TO_LEFT \
(gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
static gpointer parent_class = NULL;
enum {
PROP_0,
PROP_DISPLAY_MODE,
......@@ -1110,7 +1108,7 @@ eab_contact_formatter_finalize (GObject *object)
formatter->priv->contact = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (eab_contact_formatter_parent_class)->finalize (object);
}
static void
......@@ -1118,7 +1116,6 @@ eab_contact_formatter_class_init (EABContactFormatterClass *klass)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (EABContactFormatterClass));
object_class = G_OBJECT_CLASS (klass);
......
......@@ -32,8 +32,6 @@
#include "gal-view-minicard.h"
static gpointer parent_class;
G_DEFINE_TYPE (
GalViewMinicard,
gal_view_minicard,
......@@ -69,7 +67,7 @@ view_minicard_finalize (GObject *object)
}
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (gal_view_minicard_parent_class)->finalize (object);
}
static void
......@@ -161,8 +159,6 @@ gal_view_minicard_class_init (GalViewMinicardClass *class)
GObjectClass *object_class;
GalViewClass *gal_view_class;
parent_class = g_type_class_peek_parent (class);
object_class = G_OBJECT_CLASS (class);
object_class->dispose = view_minicard_finalize;
......
......@@ -51,7 +51,6 @@ enum {
LAST_SIGNAL
};
static gpointer parent_class;
static guint comp_editor_page_signals[LAST_SIGNAL];
G_DEFINE_TYPE (CompEditorPage, comp_editor_page, G_TYPE_OBJECT)
......@@ -119,7 +118,7 @@ comp_editor_page_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (comp_editor_page_parent_class)->dispose (object);
}
static void
......@@ -127,7 +126,6 @@ comp_editor_page_class_init (CompEditorPageClass *class)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (CompEditorPagePrivate));
object_class = G_OBJECT_CLASS (class);
......
......@@ -177,7 +177,6 @@ enum {
LAST_SIGNAL
};
static gpointer parent_class;
static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE_WITH_CODE (
......@@ -409,7 +408,7 @@ cal_model_constructed (GObject *object)
e_extensible_load_extensions (E_EXTENSIBLE (object));
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
G_OBJECT_CLASS (e_cal_model_parent_class)->constructed (object);
}
static void
......@@ -457,7 +456,7 @@ cal_model_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
G_OBJECT_CLASS (e_cal_model_parent_class)->dispose (object);
}
static void
......@@ -492,7 +491,7 @@ cal_model_finalize (GObject *object)
g_hash_table_destroy (priv->notify_removed);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (e_cal_model_parent_class)->finalize (object);