Kaydet (Commit) 9bb37bd6 authored tarafından Nick Treleaven's avatar Nick Treleaven

Cache G_TYPE_INSTANCE_GET_PRIVATE() result when initializing an

object for efficiency.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4798 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst dc3801ea
2010-04-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/geanymenubuttonaction.c, src/geanymenubuttonaction.h,
src/geanyentryaction.c, src/geanyentryaction.h,
src/geanywraplabel.c:
Cache G_TYPE_INSTANCE_GET_PRIVATE() result when initializing an
object for efficiency.
2010-03-31 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* plugins/classbuilder.c:
......
......@@ -33,8 +33,7 @@
typedef struct _GeanyEntryActionPrivate GeanyEntryActionPrivate;
#define GEANY_ENTRY_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
GEANY_ENTRY_ACTION_TYPE, GeanyEntryActionPrivate))
#define GEANY_ENTRY_ACTION_GET_PRIVATE(obj) (GEANY_ENTRY_ACTION(obj)->priv)
struct _GeanyEntryActionPrivate
......@@ -147,8 +146,12 @@ static void geany_entry_action_class_init(GeanyEntryActionClass *klass)
static void geany_entry_action_init(GeanyEntryAction *action)
{
GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
GeanyEntryActionPrivate *priv;
action->priv = G_TYPE_INSTANCE_GET_PRIVATE(action,
GEANY_ENTRY_ACTION_TYPE, GeanyEntryActionPrivate);
priv = action->priv;
priv->entry = NULL;
priv->numeric = FALSE;
}
......
......@@ -38,9 +38,12 @@ G_BEGIN_DECLS
typedef struct _GeanyEntryAction GeanyEntryAction;
typedef struct _GeanyEntryActionClass GeanyEntryActionClass;
struct _GeanyEntryActionPrivate;
struct _GeanyEntryAction
{
GtkAction parent;
struct _GeanyEntryActionPrivate *priv;
};
struct _GeanyEntryActionClass
......
......@@ -32,8 +32,7 @@
typedef struct _GeanyMenubuttonActionPrivate GeanyMenubuttonActionPrivate;
#define GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
GEANY_MENU_BUTTON_ACTION_TYPE, GeanyMenubuttonActionPrivate))
#define GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(obj) (GEANY_MENU_BUTTON_ACTION(obj)->priv)
struct _GeanyMenubuttonActionPrivate
......@@ -159,7 +158,12 @@ static void geany_menu_button_action_class_init(GeanyMenubuttonActionClass *klas
static void geany_menu_button_action_init(GeanyMenubuttonAction *action)
{
GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action);
GeanyMenubuttonActionPrivate *priv;
action->priv = G_TYPE_INSTANCE_GET_PRIVATE(action,
GEANY_MENU_BUTTON_ACTION_TYPE, GeanyMenubuttonActionPrivate);
priv = action->priv;
priv->tooltip_arrow = NULL;
priv->menu = NULL;
}
......
......@@ -38,9 +38,12 @@ G_BEGIN_DECLS
typedef struct _GeanyMenubuttonAction GeanyMenubuttonAction;
typedef struct _GeanyMenubuttonActionClass GeanyMenubuttonActionClass;
struct _GeanyMenubuttonActionPrivate;
struct _GeanyMenubuttonAction
{
GtkAction parent;
struct _GeanyMenubuttonActionPrivate *priv;
};
struct _GeanyMenubuttonActionClass
......
......@@ -33,8 +33,7 @@
#define GEANY_WRAP_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj),\
GEANY_WRAP_LABEL_TYPE, GeanyWrapLabelPrivate))
#define GEANY_WRAP_LABEL_GET_PRIVATE(obj) (GEANY_WRAP_LABEL(obj)->priv)
struct _GeanyWrapLabelClass
......@@ -42,16 +41,17 @@ struct _GeanyWrapLabelClass
GtkLabelClass parent_class;
};
struct _GeanyWrapLabel
{
GtkLabel parent;
};
typedef struct
{
gsize wrap_width;
} GeanyWrapLabelPrivate;
struct _GeanyWrapLabel
{
GtkLabel parent;
GeanyWrapLabelPrivate *priv;
};
static void geany_wrap_label_size_request (GtkWidget *widget, GtkRequisition *req);
static void geany_wrap_label_size_allocate (GtkWidget *widget, GtkAllocation *alloc);
......@@ -73,8 +73,12 @@ static void geany_wrap_label_class_init(GeanyWrapLabelClass *klass)
static void geany_wrap_label_init(GeanyWrapLabel *self)
{
GeanyWrapLabelPrivate *priv = GEANY_WRAP_LABEL_GET_PRIVATE(self);
GeanyWrapLabelPrivate *priv;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
GEANY_WRAP_LABEL_TYPE, GeanyWrapLabelPrivate);
priv = self->priv;
priv->wrap_width = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment