summaryrefslogtreecommitdiff
path: root/endless
diff options
context:
space:
mode:
authorMatt Watson <mattdangerw@gmail.com>2013-12-05 15:09:31 -0800
committerMatt Watson <mattdangerw@gmail.com>2013-12-09 11:44:17 -0800
commit5e0dc70d2fb5810d59dbe77e3007d530cb74a505 (patch)
tree62dc3105f50e3c9412bac308056a9e55af35677f /endless
parent562637f3e2c68c336587433f5c50cf1e763e955a (diff)
Use the new way to define private gobject data
Simpler and has a nicer memory layout. Needed glib 2.38 to do this. [endlessm/eos-sdk#421]
Diffstat (limited to 'endless')
-rw-r--r--endless/eosactionbutton.c71
-rw-r--r--endless/eosactionbutton.h3
-rw-r--r--endless/eosactionmenu-private.h3
-rw-r--r--endless/eosactionmenu.c45
-rw-r--r--endless/eosapplication.c49
-rw-r--r--endless/eosapplication.h3
-rw-r--r--endless/eosflexygrid.c46
-rw-r--r--endless/eosflexygrid.h2
-rw-r--r--endless/eosmainarea-private.h3
-rw-r--r--endless/eosmainarea.c72
-rw-r--r--endless/eospagemanager.c174
-rw-r--r--endless/eospagemanager.h3
-rw-r--r--endless/eossplashpagemanager.c65
-rw-r--r--endless/eossplashpagemanager.h3
-rw-r--r--endless/eostopbar-private.h3
-rw-r--r--endless/eostopbar.c73
-rw-r--r--endless/eoswindow.c216
-rw-r--r--endless/eoswindow.h3
18 files changed, 395 insertions, 442 deletions
diff --git a/endless/eosactionbutton.c b/endless/eosactionbutton.c
index 83c437d..db28312 100644
--- a/endless/eosactionbutton.c
+++ b/endless/eosactionbutton.c
@@ -34,13 +34,7 @@
#define _EOS_STYLE_CLASS_ACTION_BUTTON "action-button"
-G_DEFINE_TYPE (EosActionButton, eos_action_button, GTK_TYPE_BUTTON)
-
-#define EOS_ACTION_BUTTON_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_ACTION_BUTTON, EosActionButtonPrivate))
-
-struct _EosActionButtonPrivate
-{
+typedef struct {
/* properties */
EosActionButtonSize size;
gchar *label;
@@ -51,7 +45,9 @@ struct _EosActionButtonPrivate
GtkWidget *grid;
GtkWidget *icon_image;
GtkWidget *label_widget;
-};
+} EosActionButtonPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosActionButton, eos_action_button, GTK_TYPE_BUTTON)
typedef struct _EosActionButtonSizeDefinition EosActionButtonSizeDefinition;
@@ -117,8 +113,6 @@ eos_action_button_class_init (EosActionButtonClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosActionButtonPrivate));
-
object_class->get_property = eos_action_button_get_property;
object_class->set_property = eos_action_button_set_property;
object_class->dispose = eos_action_button_dispose;
@@ -224,13 +218,9 @@ eos_action_button_class_init (EosActionButtonClass *klass)
static void
eos_action_button_init (EosActionButton *self)
{
- EosActionButtonPrivate *priv;
- GtkStyleContext *context;
-
- self->priv = EOS_ACTION_BUTTON_PRIVATE (self);
- priv = self->priv;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (self);
+ GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_add_class (context, _EOS_STYLE_CLASS_ACTION_BUTTON);
priv->icon_image = gtk_image_new();
@@ -296,11 +286,9 @@ eos_action_button_finalize (GObject *object)
static void
eos_action_button_load_icon (EosActionButton *button)
{
- EosActionButtonPrivate *priv;
-
g_return_if_fail (EOS_IS_ACTION_BUTTON (button));
- priv = button->priv;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
if (priv->icon_id != NULL)
{
@@ -329,12 +317,10 @@ void
eos_action_button_set_size (EosActionButton *button,
EosActionButtonSize size)
{
- EosActionButtonPrivate *priv;
- int old_size;
-
g_return_if_fail (EOS_IS_ACTION_BUTTON (button));
- priv = button->priv;
+ int old_size;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
old_size = priv->size;
priv->size = size;
@@ -365,12 +351,9 @@ eos_action_button_set_size (EosActionButton *button,
EosActionButtonSize
eos_action_button_get_size (EosActionButton *button)
{
- EosActionButtonPrivate *priv;
-
g_return_val_if_fail (EOS_IS_ACTION_BUTTON (button), -1);
- priv = button->priv;
-
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
return priv->size;
}
@@ -385,13 +368,10 @@ eos_action_button_get_size (EosActionButton *button)
void
eos_action_button_set_label (EosActionButton *button, const gchar *label)
{
- EosActionButtonPrivate *priv;
- gchar *new_label;
-
g_return_if_fail (EOS_IS_ACTION_BUTTON (button));
- priv = button->priv;
- new_label = g_strdup (label);
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
+ gchar *new_label = g_strdup (label);
g_free (priv->label);
priv->label = new_label;
@@ -412,12 +392,9 @@ eos_action_button_set_label (EosActionButton *button, const gchar *label)
const gchar *
eos_action_button_get_label (EosActionButton *button)
{
- EosActionButtonPrivate *priv;
-
g_return_val_if_fail (EOS_IS_ACTION_BUTTON (button), NULL);
- priv = button->priv;
-
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
return priv->label;
}
@@ -434,11 +411,9 @@ void
eos_action_button_set_label_position (EosActionButton *button,
GtkPositionType position)
{
- EosActionButtonPrivate *priv;
-
g_return_if_fail (EOS_IS_ACTION_BUTTON (button));
- priv = button->priv;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
if (priv->label_pos != position)
{
@@ -479,12 +454,9 @@ eos_action_button_set_label_position (EosActionButton *button,
GtkPositionType
eos_action_button_get_label_position (EosActionButton *button)
{
- EosActionButtonPrivate *priv;
-
g_return_val_if_fail (EOS_IS_ACTION_BUTTON (button), -1);
- priv = button->priv;
-
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
return priv->label_pos;
}
@@ -500,10 +472,8 @@ void
eos_action_button_set_icon_id (EosActionButton *button,
const gchar* icon_id)
{
- EosActionButtonPrivate *priv;
-
g_return_if_fail (EOS_IS_ACTION_BUTTON (button));
- priv = button->priv;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
if (g_strcmp0 (icon_id, priv->icon_id) != 0)
{
@@ -529,7 +499,8 @@ eos_action_button_get_icon_id (EosActionButton *button)
{
g_return_val_if_fail (EOS_IS_ACTION_BUTTON (button), NULL);
- return button->priv->icon_id;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
+ return priv->icon_id;
}
static void
@@ -539,7 +510,7 @@ eos_action_button_get_property (GObject *object,
GParamSpec *pspec)
{
EosActionButton *button = EOS_ACTION_BUTTON (object);
- EosActionButtonPrivate *priv = button->priv;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
switch (property_id)
{
@@ -596,7 +567,7 @@ eos_action_button_get_real_size (GtkWidget *widget,
gint *natural_size)
{
EosActionButton *button = EOS_ACTION_BUTTON (widget);
- EosActionButtonPrivate *priv = button->priv;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
GtkBorder margin;
GtkAllocation label_allocation;
GtkStyleContext *context = gtk_widget_get_style_context (widget);
@@ -675,7 +646,7 @@ eos_action_button_draw (GtkWidget *widget,
cairo_t *cr)
{
EosActionButton *button = EOS_ACTION_BUTTON (widget);
- EosActionButtonPrivate *priv = button->priv;
+ EosActionButtonPrivate *priv = eos_action_button_get_instance_private (button);
gint x, y;
gint frame_x = 0, frame_y = 0, bg_x = 0, bg_y = 0, icon_x = 0, icon_y = 0, label_x = 0, label_y = 0;
diff --git a/endless/eosactionbutton.h b/endless/eosactionbutton.h
index a68a89a..c5276a1 100644
--- a/endless/eosactionbutton.h
+++ b/endless/eosactionbutton.h
@@ -33,7 +33,6 @@ G_BEGIN_DECLS
typedef struct _EosActionButton EosActionButton;
typedef struct _EosActionButtonClass EosActionButtonClass;
-typedef struct _EosActionButtonPrivate EosActionButtonPrivate;
/**
* EosActionButton:
@@ -43,8 +42,6 @@ typedef struct _EosActionButtonPrivate EosActionButtonPrivate;
struct _EosActionButton
{
GtkButton parent;
-
- EosActionButtonPrivate *priv;
};
struct _EosActionButtonClass
diff --git a/endless/eosactionmenu-private.h b/endless/eosactionmenu-private.h
index 4393fdc..f6e84d0 100644
--- a/endless/eosactionmenu-private.h
+++ b/endless/eosactionmenu-private.h
@@ -33,13 +33,10 @@ G_BEGIN_DECLS
typedef struct _EosActionMenu EosActionMenu;
typedef struct _EosActionMenuClass EosActionMenuClass;
-typedef struct _EosActionMenuPrivate EosActionMenuPrivate;
struct _EosActionMenu
{
GtkFrame parent;
-
- EosActionMenuPrivate *priv;
};
struct _EosActionMenuClass
diff --git a/endless/eosactionmenu.c b/endless/eosactionmenu.c
index 0f45305..e27cbc2 100644
--- a/endless/eosactionmenu.c
+++ b/endless/eosactionmenu.c
@@ -17,19 +17,15 @@
*/
-G_DEFINE_TYPE (EosActionMenu, eos_action_menu, GTK_TYPE_FRAME)
-
-#define EOS_ACTION_MENU_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_ACTION_MENU, EosActionMenuPrivate))
-
-struct _EosActionMenuPrivate
-{
+typedef struct {
GtkWidget *overlay;
GtkWidget *center_grid;
GtkWidget *bottom_grid;
GtkActionGroup *action_group;
-};
+} EosActionMenuPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosActionMenu, eos_action_menu, GTK_TYPE_FRAME)
static void
eos_action_menu_dispose (GObject *object);
@@ -44,8 +40,6 @@ eos_action_menu_class_init (EosActionMenuClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosActionMenuPrivate));
-
object_class->dispose = eos_action_menu_dispose;
object_class->finalize = eos_action_menu_finalize;
}
@@ -53,12 +47,9 @@ eos_action_menu_class_init (EosActionMenuClass *klass)
static void
eos_action_menu_init (EosActionMenu *self)
{
- EosActionMenuPrivate *priv;
+ EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (self);
GtkStyleContext *context;
- self->priv = EOS_ACTION_MENU_PRIVATE (self);
- priv = self->priv;
-
context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_add_class (context, _EOS_STYLE_CLASS_ACTION_MENU);
@@ -148,11 +139,9 @@ void
eos_action_menu_add_action (EosActionMenu *menu,
GtkAction *action)
{
- EosActionMenuPrivate *priv;
-
g_return_if_fail (EOS_IS_ACTION_MENU (menu));
- priv = menu->priv;
+ EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
if (action)
{
gtk_action_group_add_action (priv->action_group, action);
@@ -193,9 +182,8 @@ GtkAction *
eos_action_menu_get_action (EosActionMenu *menu,
const gchar *name)
{
- EosActionMenuPrivate *priv;
g_return_val_if_fail (EOS_IS_ACTION_MENU (menu), NULL);
- priv = menu->priv;
+ EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
return gtk_action_group_get_action (priv->action_group, name);
}
@@ -209,9 +197,8 @@ eos_action_menu_get_action (EosActionMenu *menu,
GList *
eos_action_menu_list_actions (EosActionMenu *menu)
{
- EosActionMenuPrivate *priv;
g_return_val_if_fail (EOS_IS_ACTION_MENU (menu), NULL);
- priv = menu->priv;
+ EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
return gtk_action_group_list_actions (priv->action_group);
}
@@ -227,13 +214,12 @@ void
eos_action_menu_remove_action (EosActionMenu *menu,
GtkAction *action)
{
- EosActionMenuPrivate *priv;
- GList *children, *i;
- GtkWidget *target_child = NULL;
-
g_return_if_fail (EOS_IS_ACTION_MENU (menu));
g_return_if_fail (GTK_IS_ACTION (action));
- priv = menu->priv;
+
+ EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
+ GList *children, *i;
+ GtkWidget *target_child = NULL;
gtk_action_group_remove_action(priv->action_group, action);
@@ -272,11 +258,10 @@ void
eos_action_menu_remove_action_by_name (EosActionMenu *menu,
const gchar *name)
{
- GtkAction *action;
- EosActionMenuPrivate *priv;
-
g_return_if_fail (EOS_IS_ACTION_MENU (menu));
- priv = menu->priv;
+
+ GtkAction *action;
+ EosActionMenuPrivate *priv = eos_action_menu_get_instance_private (menu);
action = gtk_action_group_get_action (priv->action_group, name);
if (action)
diff --git a/endless/eosapplication.c b/endless/eosapplication.c
index 5429669..72016c1 100644
--- a/endless/eosapplication.c
+++ b/endless/eosapplication.c
@@ -48,18 +48,14 @@
* ]|
*/
-G_DEFINE_TYPE (EosApplication, eos_application, GTK_TYPE_APPLICATION)
-
-#define APPLICATION_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_APPLICATION, EosApplicationPrivate))
-
-struct _EosApplicationPrivate
-{
+typedef struct {
GOnce init_config_dir_once;
GFile *config_dir;
EosWindow *main_application_window;
-};
+} EosApplicationPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosApplication, eos_application, GTK_TYPE_APPLICATION)
enum
{
@@ -93,7 +89,8 @@ static void
eos_application_finalize (GObject *object)
{
EosApplication *self = EOS_APPLICATION (object);
- g_clear_object (&self->priv->config_dir);
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
+ g_clear_object (&priv->config_dir);
G_OBJECT_CLASS (eos_application_parent_class)->finalize (object);
}
@@ -102,15 +99,16 @@ static void
eos_application_activate (GApplication *application)
{
EosApplication *self = EOS_APPLICATION (application);
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
G_APPLICATION_CLASS (eos_application_parent_class)->activate (application);
/* Raise the main application window if it is iconified. This behavior will
be default in GTK at some future point, in which case the following
paragraph can be removed. */
- if (self->priv->main_application_window)
+ if (priv->main_application_window)
{
- gtk_window_present (GTK_WINDOW (self->priv->main_application_window));
+ gtk_window_present (GTK_WINDOW (priv->main_application_window));
}
/* TODO: Should it be required to override activate() as in GApplication? */
@@ -119,6 +117,7 @@ eos_application_activate (GApplication *application)
static gpointer
ensure_config_dir_exists_and_is_writable (EosApplication *self)
{
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
const gchar *xdg_path = g_get_user_config_dir ();
const gchar *app_id = g_application_get_application_id (G_APPLICATION (self));
GFile *xdg_dir = g_file_new_for_path (xdg_path);
@@ -164,7 +163,7 @@ ensure_config_dir_exists_and_is_writable (EosApplication *self)
g_object_unref (info);
g_free (config_path);
- self->priv->config_dir = config_dir;
+ priv->config_dir = config_dir;
return NULL;
}
@@ -190,7 +189,8 @@ eos_application_startup (GApplication *application)
g_object_unref (provider);
EosApplication *self = EOS_APPLICATION (application);
- g_once (&self->priv->init_config_dir_once,
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
+ g_once (&priv->init_config_dir_once,
(GThreadFunc)ensure_config_dir_exists_and_is_writable, self);
}
@@ -199,6 +199,7 @@ eos_application_window_added (GtkApplication *application,
GtkWindow *window)
{
EosApplication *self = EOS_APPLICATION (application);
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
GTK_APPLICATION_CLASS (eos_application_parent_class)->window_added (
application, window);
@@ -207,12 +208,12 @@ eos_application_window_added (GtkApplication *application,
it should be raised when the application is activated */
if (EOS_IS_WINDOW (window))
{
- if (self->priv->main_application_window != NULL)
+ if (priv->main_application_window != NULL)
{
g_error ("You should not add more than one application window.");
}
g_object_ref (window);
- self->priv->main_application_window = EOS_WINDOW (window);
+ priv->main_application_window = EOS_WINDOW (window);
}
}
@@ -221,23 +222,24 @@ eos_application_window_removed (GtkApplication *application,
GtkWindow *window)
{
EosApplication *self = EOS_APPLICATION (application);
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
GTK_APPLICATION_CLASS (eos_application_parent_class)->window_removed (
application, window);
if (EOS_IS_WINDOW (window))
{
- if (self->priv->main_application_window == NULL)
+ if (priv->main_application_window == NULL)
{
g_warning ("EosWindow is being removed from EosApplication, although "
"none was added.");
return;
}
- if (self->priv->main_application_window != EOS_WINDOW (window))
+ if (priv->main_application_window != EOS_WINDOW (window))
g_warning ("A different EosWindow is being removed from EosApplication "
"than the one that was added.");
g_object_unref (window);
- self->priv->main_application_window = NULL;
+ priv->main_application_window = NULL;
}
}
@@ -262,8 +264,6 @@ eos_application_class_init (EosApplicationClass *klass)
GApplicationClass *g_application_class = G_APPLICATION_CLASS (klass);
GtkApplicationClass *gtk_application_class = GTK_APPLICATION_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosApplicationPrivate));
-
object_class->get_property = eos_application_get_property;
object_class->finalize = eos_application_finalize;
g_application_class->activate = eos_application_activate;
@@ -293,8 +293,8 @@ eos_application_class_init (EosApplicationClass *klass)
static void
eos_application_init (EosApplication *self)
{
- self->priv = APPLICATION_PRIVATE (self);
- self->priv->init_config_dir_once = (GOnce)G_ONCE_INIT;
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
+ priv->init_config_dir_once = (GOnce)G_ONCE_INIT;
g_signal_connect (self, "notify::application-id",
G_CALLBACK (on_app_id_set), self);
}
@@ -348,7 +348,8 @@ eos_application_new (const gchar *application_id,
GFile *
eos_application_get_config_dir (EosApplication *self)
{
- g_once (&self->priv->init_config_dir_once,
+ EosApplicationPrivate *priv = eos_application_get_instance_private (self);
+ g_once (&priv->init_config_dir_once,
(GThreadFunc)ensure_config_dir_exists_and_is_writable, self);
- return self->priv->config_dir;
+ return priv->config_dir;
}
diff --git a/endless/eosapplication.h b/endless/eosapplication.h
index 0ce6553..36afc80 100644
--- a/endless/eosapplication.h
+++ b/endless/eosapplication.h
@@ -35,7 +35,6 @@
typedef struct _EosApplication EosApplication;
typedef struct _EosApplicationClass EosApplicationClass;
-typedef struct _EosApplicationPrivate EosApplicationPrivate;
/**
* EosApplication:
@@ -46,8 +45,6 @@ struct _EosApplication
{
/*< private >*/
GtkApplication parent;
-
- EosApplicationPrivate *priv;
};
struct _EosApplicationClass
diff --git a/endless/eosflexygrid.c b/endless/eosflexygrid.c
index 81cf3ba..cb7f285 100644
--- a/endless/eosflexygrid.c
+++ b/endless/eosflexygrid.c
@@ -63,9 +63,6 @@ enum
LAST_SIGNAL
};
-#define EOS_FLEXY_GRID_GET_PRIV(obj) \
- ((EosFlexyGridPrivate *) eos_flexy_grid_get_instance_private ((EosFlexyGrid *) (obj)))
-
G_DEFINE_TYPE_WITH_PRIVATE (EosFlexyGrid, eos_flexy_grid, GTK_TYPE_CONTAINER)
static guint grid_signals[LAST_SIGNAL] = { 0, };
@@ -75,7 +72,7 @@ static void
eos_flexy_grid_update_cell_prelight (EosFlexyGrid *grid,
EosFlexyGridCell *cell)
{
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
if (cell == priv->prelight_cell)
return;
@@ -392,7 +389,7 @@ eos_flexy_grid_get_preferred_width (GtkWidget *widget,
gint *minimum_width_out,
gint *natural_width_out)
{
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (widget)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (widget));
int minimum_width, natural_width;
int target_column_size = priv->cell_size < 0 ? DEFAULT_CELL_SIZE : priv->cell_size;
@@ -462,7 +459,7 @@ eos_flexy_grid_get_preferred_height_for_width (GtkWidget *widget,
gint *minimum_height_out,
gint *natural_height_out)
{
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (widget)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (widget));
int cell_size = priv->cell_size < 0 ? DEFAULT_CELL_SIZE : priv->cell_size;
int cell_spacing = priv->cell_spacing < 0 ? DEFAULT_SPACING : priv->cell_spacing;
@@ -502,7 +499,7 @@ eos_flexy_grid_size_allocate (GtkWidget *widget,
allocation->width,
allocation->height);
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (widget)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (widget));
int cell_size = priv->cell_size < 0 ? DEFAULT_CELL_SIZE : priv->cell_size;
int cell_spacing = priv->cell_spacing < 0 ? DEFAULT_SPACING : priv->cell_spacing;
@@ -575,7 +572,7 @@ eos_flexy_grid_remove (GtkContainer *container,
return;
}
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (container)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (container));
EosFlexyGridCell *cell = EOS_FLEXY_GRID_CELL (widget);
GSequenceIter *iter = eos_flexy_grid_cell_get_iter (cell);
@@ -614,7 +611,7 @@ eos_flexy_grid_forall (GtkContainer *container,
GtkCallback callback,
gpointer data)
{
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (container)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (container));
GSequenceIter *iter = g_sequence_get_begin_iter (priv->children);
while (!g_sequence_iter_is_end (iter))
@@ -670,7 +667,7 @@ eos_flexy_grid_button_press (GtkWidget *widget,
return GDK_EVENT_PROPAGATE;
EosFlexyGrid *self = EOS_FLEXY_GRID (widget);
- EosFlexyGridPrivate *priv = self->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (self);
priv->active_cell = NULL;
@@ -717,7 +714,7 @@ eos_flexy_grid_button_release (GtkWidget *widget,
if (event->button == GDK_BUTTON_PRIMARY)
{
EosFlexyGrid *grid = EOS_FLEXY_GRID (widget);
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
if (priv->active_cell != NULL)
{
@@ -742,7 +739,7 @@ eos_flexy_grid_enter_notify (GtkWidget *widget,
if (event->window != gtk_widget_get_window (widget))
return GDK_EVENT_PROPAGATE;
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (widget)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (widget));
priv->in_widget = TRUE;
@@ -761,7 +758,7 @@ eos_flexy_grid_leave_notify (GtkWidget *widget,
if (event->window != gtk_widget_get_window (widget))
return GDK_EVENT_PROPAGATE;
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (widget)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (widget));
EosFlexyGridCell *cell;
if (event->detail != GDK_NOTIFY_INFERIOR)
@@ -828,7 +825,7 @@ eos_flexy_grid_get_property (GObject *gobject,
static void
eos_flexy_grid_finalize (GObject *gobject)
{
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (gobject)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (gobject));
if (priv->sort_notify != NULL)
priv->sort_notify (priv->sort_data);
@@ -935,7 +932,7 @@ eos_flexy_grid_class_init (EosFlexyGridClass *klass)
static void
eos_flexy_grid_init (EosFlexyGrid *self)
{
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID_GET_PRIV (self);
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (self);
priv->children = g_sequence_new (NULL);
@@ -943,9 +940,6 @@ eos_flexy_grid_init (EosFlexyGrid *self)
priv->cell_size = -1;
priv->cell_spacing = DEFAULT_SPACING;
- /* XXX: once we depend on GTK 3.10 and GLib 2.38, we should remove this */
- self->priv = priv;
-
GtkWidget *widget = GTK_WIDGET (self);
gtk_widget_set_has_window (widget, TRUE);
gtk_widget_set_redraw_on_allocate (widget, TRUE);
@@ -995,7 +989,7 @@ eos_flexy_grid_set_sort_func (EosFlexyGrid *grid,
{
g_return_if_fail (EOS_IS_FLEXY_GRID (grid));
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
if (priv->sort_notify != NULL)
priv->sort_notify (priv->sort_data);
@@ -1019,7 +1013,7 @@ eos_flexy_grid_set_cell_size (EosFlexyGrid *grid,
{
g_return_if_fail (EOS_IS_FLEXY_GRID (grid));
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
if (priv->cell_size == size)
return;
@@ -1041,7 +1035,7 @@ eos_flexy_grid_get_cell_size (EosFlexyGrid *grid)
{
g_return_val_if_fail (EOS_IS_FLEXY_GRID (grid), 0);
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
if (priv->cell_size < 0)
return DEFAULT_CELL_SIZE;
@@ -1064,7 +1058,7 @@ eos_flexy_grid_set_cell_spacing (EosFlexyGrid *grid,
{
g_return_if_fail (EOS_IS_FLEXY_GRID (grid));
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
if (priv->cell_spacing == spacing)
return;
@@ -1086,7 +1080,7 @@ eos_flexy_grid_get_cell_spacing (EosFlexyGrid *grid)
{
g_return_val_if_fail (EOS_IS_FLEXY_GRID (grid), 0);
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
if (priv->cell_spacing < 0)
return DEFAULT_SPACING;
@@ -1099,7 +1093,7 @@ do_grid_sort (gconstpointer row_a,
gconstpointer row_b,
gpointer data)
{
- EosFlexyGridPrivate *priv = EOS_FLEXY_GRID (data)->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (EOS_FLEXY_GRID (data));
return priv->sort_func ((EosFlexyGridCell *) row_a,
(EosFlexyGridCell *) row_b,
@@ -1141,7 +1135,7 @@ eos_flexy_grid_insert (EosFlexyGrid *grid,
gtk_widget_show (GTK_WIDGET (cell));
}
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
GSequenceIter *iter;
if (priv->sort_func != NULL)
@@ -1186,7 +1180,7 @@ eos_flexy_grid_get_cell_at_coords (EosFlexyGrid *grid,
{
g_return_val_if_fail (EOS_IS_FLEXY_GRID (grid), NULL);
- EosFlexyGridPrivate *priv = grid->priv;
+ EosFlexyGridPrivate *priv = eos_flexy_grid_get_instance_private (grid);
GSequenceIter *iter;
/* naive hit detection */
diff --git a/endless/eosflexygrid.h b/endless/eosflexygrid.h
index 56c15ab..87fedc8 100644
--- a/endless/eosflexygrid.h
+++ b/endless/eosflexygrid.h
@@ -73,8 +73,6 @@ struct _EosFlexyGrid
{
/*< private >*/
GtkContainer parent_instance;
-
- gpointer priv;
};
struct _EosFlexyGridClass
diff --git a/endless/eosmainarea-private.h b/endless/eosmainarea-private.h
index c0c6582..9edb535 100644
--- a/endless/eosmainarea-private.h
+++ b/endless/eosmainarea-private.h
@@ -33,13 +33,10 @@ G_BEGIN_DECLS
typedef struct _EosMainArea EosMainArea;
typedef struct _EosMainAreaClass EosMainAreaClass;
-typedef struct _EosMainAreaPrivate EosMainAreaPrivate;
struct _EosMainArea
{
GtkContainer parent;
-
- EosMainAreaPrivate *priv;
};
struct _EosMainAreaClass
diff --git a/endless/eosmainarea.c b/endless/eosmainarea.c
index cf6911d..81920d8 100644
--- a/endless/eosmainarea.c
+++ b/endless/eosmainarea.c
@@ -17,18 +17,14 @@
* area will not appear unless set.
*/
-G_DEFINE_TYPE (EosMainArea, eos_main_area, GTK_TYPE_CONTAINER)
-
-#define MAIN_AREA_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_MAIN_AREA, EosMainAreaPrivate))
-
-struct _EosMainAreaPrivate
-{
+typedef struct {
GtkWidget *toolbox;
GtkWidget *content;
GtkWidget *actions_standin;
guint actions_visible : 1;
-};
+} EosMainAreaPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosMainArea, eos_main_area, GTK_TYPE_CONTAINER)
static void
eos_main_area_get_preferred_width (GtkWidget *widget,
@@ -36,12 +32,14 @@ eos_main_area_get_preferred_width (GtkWidget *widget,
gint *natural)
{
EosMainArea *self = EOS_MAIN_AREA (widget);
- GtkWidget *toolbox = self->priv->toolbox;
- GtkWidget *content = self->priv->content;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
+
+ GtkWidget *toolbox = priv->toolbox;
+ GtkWidget *content = priv->content;
*minimal = *natural = 0;
if ((toolbox && gtk_widget_get_visible (toolbox)) ||
- self->priv->actions_visible)
+ priv->actions_visible)
{
gint toolbox_minimal, toolbox_natural;
gtk_widget_get_preferred_width (toolbox,
@@ -68,8 +66,10 @@ eos_main_area_get_preferred_height (GtkWidget *widget,
gint *natural)
{
EosMainArea *self = EOS_MAIN_AREA (widget);
- GtkWidget *toolbox = self->priv->toolbox;
- GtkWidget *content = self->priv->content;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
+
+ GtkWidget *toolbox = priv->toolbox;
+ GtkWidget *content = priv->content;
*minimal = *natural = 0;
if (toolbox && gtk_widget_get_visible (toolbox))
@@ -99,8 +99,10 @@ eos_main_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
EosMainArea *self = EOS_MAIN_AREA (widget);
- GtkWidget *toolbox = self->priv->toolbox;
- GtkWidget *content = self->priv->content;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
+
+ GtkWidget *toolbox = priv->toolbox;
+ GtkWidget *content = priv->content;
gtk_widget_set_allocation (widget, allocation);
@@ -109,7 +111,7 @@ eos_main_area_size_allocate (GtkWidget *widget,
gboolean toolbox_visible = toolbox && gtk_widget_get_visible (toolbox);
if (toolbox_visible)
num_sidebars++;
- if (self->priv->actions_visible)
+ if (priv->actions_visible)
num_sidebars++;
gint toolbox_min_width = 0, toolbox_nat_width = 0;
@@ -167,14 +169,14 @@ eos_main_area_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (toolbox, &toolbox_allocation);
x += toolbox_allocation.width;
}
- if (self->priv->actions_visible)
+ if (priv->actions_visible)
{
GtkAllocation actions_allocation;
actions_allocation.x = allocation->x + allocation->width - sidebar_width;
actions_allocation.y = y;
actions_allocation.width = sidebar_width;
actions_allocation.height = allocation->height;
- gtk_widget_size_allocate (self->priv->actions_standin,
+ gtk_widget_size_allocate (priv->actions_standin,
&actions_allocation);
}
if (content_visible)
@@ -205,7 +207,7 @@ eos_main_area_remove (GtkContainer *container,
GtkWidget *widget)
{
EosMainArea *self = EOS_MAIN_AREA(container);
- EosMainAreaPrivate *priv = self->priv;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
if (priv->content == widget)
eos_main_area_set_content (self, NULL);
@@ -220,7 +222,7 @@ eos_main_area_forall(GtkContainer *container,
gpointer callback_data)
{
EosMainArea *self = EOS_MAIN_AREA (container);
- EosMainAreaPrivate *priv = self->priv;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
if (priv->toolbox)
(*callback) (priv->toolbox, callback_data);
@@ -236,8 +238,9 @@ static void
eos_main_area_destroy (GtkWidget *widget)
{
EosMainArea *self = EOS_MAIN_AREA (widget);
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- gtk_widget_destroy (self->priv->actions_standin);
+ gtk_widget_destroy (priv->actions_standin);
GTK_WIDGET_CLASS (eos_main_area_parent_class)->destroy (widget);
}
@@ -248,8 +251,6 @@ eos_main_area_class_init (EosMainAreaClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosMainAreaPrivate));
-
widget_class->get_preferred_width = eos_main_area_get_preferred_width;
widget_class->get_preferred_height = eos_main_area_get_preferred_height;
widget_class->size_allocate = eos_main_area_size_allocate;
@@ -263,16 +264,16 @@ eos_main_area_class_init (EosMainAreaClass *klass)
static void
eos_main_area_init (EosMainArea *self)
{
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
gtk_widget_set_has_window(GTK_WIDGET(self), FALSE);
- self->priv = MAIN_AREA_PRIVATE (self);
- self->priv->actions_standin = gtk_event_box_new ();
- g_object_ref_sink (self->priv->actions_standin);
+ priv->actions_standin = gtk_event_box_new ();
+ g_object_ref_sink (priv->actions_standin);
GdkRGBA red = { 1.0, 0.0, 0.0, 1.0 };
- gtk_widget_override_background_color (self->priv->actions_standin,
+ gtk_widget_override_background_color (priv->actions_standin,
GTK_STATE_FLAG_NORMAL,
&red);
- gtk_widget_show (self->priv->actions_standin);
+ gtk_widget_show (priv->actions_standin);
}
/* Internal Public API */
@@ -306,7 +307,7 @@ eos_main_area_set_toolbox (EosMainArea *self,
g_return_if_fail (EOS_IS_MAIN_AREA (self));
g_return_if_fail (toolbox == NULL || GTK_IS_WIDGET (toolbox));
- EosMainAreaPrivate *priv = self->priv;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
GtkWidget *self_widget = GTK_WIDGET (self);
if (priv->toolbox == toolbox)
@@ -336,7 +337,8 @@ GtkWidget *
eos_main_area_get_toolbox (EosMainArea *self)
{
g_return_val_if_fail (EOS_IS_MAIN_AREA (self), NULL);
- return self->priv->toolbox;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
+ return priv->toolbox;
}
/*
@@ -354,7 +356,7 @@ eos_main_area_set_content (EosMainArea *self,
g_return_if_fail (content == NULL || GTK_IS_WIDGET (content));
g_return_if_fail (content == NULL || gtk_widget_get_parent (content) == NULL);
- EosMainAreaPrivate *priv = self->priv;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
GtkWidget *self_widget = GTK_WIDGET (self);
if (priv->content == content)
@@ -381,7 +383,8 @@ GtkWidget *
eos_main_area_get_content (EosMainArea *self)
{
g_return_val_if_fail (EOS_IS_MAIN_AREA (self), NULL);
- return self->priv->content;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
+ return priv->content;
}
/*
@@ -399,7 +402,7 @@ eos_main_area_set_actions (EosMainArea *self,
{
g_return_if_fail (EOS_IS_MAIN_AREA (self));
- EosMainAreaPrivate *priv = self->priv;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
GtkWidget *self_widget = GTK_WIDGET (self);
actions_visible = actions_visible != FALSE;
@@ -427,5 +430,6 @@ gboolean
eos_main_area_get_actions (EosMainArea *self)
{
g_return_val_if_fail (EOS_IS_MAIN_AREA (self), FALSE);
- return self->priv->actions_visible;
+ EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
+ return priv->actions_visible;
}
diff --git a/endless/eospagemanager.c b/endless/eospagemanager.c
index d8b7ea5..bb0878f 100644
--- a/endless/eospagemanager.c
+++ b/endless/eospagemanager.c
@@ -90,14 +90,7 @@
#define DEFAULT_BACKGROUND_SIZE "100% 100%"
#define DEFAULT_BACKGROUND_POSITION "0% 0%"
-G_DEFINE_TYPE (EosPageManager, eos_page_manager, GTK_TYPE_CONTAINER)
-
-#define PAGE_MANAGER_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_PAGE_MANAGER, EosPageManagerPrivate))
-
-typedef struct _EosPageManagerPageInfo EosPageManagerPageInfo;
-struct _EosPageManagerPageInfo
-{
+typedef struct {
GtkWidget *page;
gchar *name;
gboolean fake_page_actions_visible;
@@ -108,17 +101,18 @@ struct _EosPageManagerPageInfo
gchar *background_size;
gchar *background_position;
gboolean background_repeats;
-};
+} EosPageManagerPageInfo;
-struct _EosPageManagerPrivate
-{
+typedef struct {
GtkWidget *stack;
GList *page_info; /* GList<EosPageManagerPageInfo> */
GHashTable *pages_by_name; /* GHashTable<gchar *, EosPageManagerPageInfo *> */
GHashTable *pages_by_widget; /* GHashTable<GtkWidget *, EosPageManagerPageInfo *> */
EosPageManagerPageInfo *visible_page_info;
EosPageManagerTransitionType transition_type;
-};
+} EosPageManagerPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosPageManager, eos_page_manager, GTK_TYPE_CONTAINER)
GType
eos_page_manager_transition_type_get_type (void)
@@ -198,7 +192,8 @@ static EosPageManagerPageInfo *
find_page_info_by_widget (EosPageManager *self,
GtkWidget *page)
{
- return g_hash_table_lookup (self->priv->pages_by_widget, page);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ return g_hash_table_lookup (priv->pages_by_widget, page);
}
/*
@@ -215,7 +210,8 @@ static EosPageManagerPageInfo *
find_page_info_by_name (EosPageManager *self,
const gchar *name)
{
- return g_hash_table_lookup (self->priv->pages_by_name, name);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ return g_hash_table_lookup (priv->pages_by_name, name);
}
/* Convenience function, since this warning occurs at several places */
@@ -247,13 +243,14 @@ static void
assert_internal_state (EosPageManager *self)
{
#ifdef DEBUG
- guint list_length = g_list_length (self->priv->page_info);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ guint list_length = g_list_length (priv->page_info);
g_assert_cmpuint (list_length,
==,
- g_hash_table_size (self->priv->pages_by_widget));
+ g_hash_table_size (priv->pages_by_widget));
g_assert_cmpuint (list_length,
>=,
- g_hash_table_size (self->priv->pages_by_name));
+ g_hash_table_size (priv->pages_by_name));
#endif
}
@@ -261,10 +258,11 @@ static void
set_visible_page_from_info (EosPageManager *self,
EosPageManagerPageInfo *info)
{
- GtkStack *stack = GTK_STACK (self->priv->stack);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ GtkStack *stack = GTK_STACK (priv->stack);
gtk_stack_set_visible_child (stack, info->page);
- self->priv->visible_page_info = info;
+ priv->visible_page_info = info;
GObject *self_object = G_OBJECT (self);
g_object_notify(self_object, "visible-page");
@@ -337,8 +335,9 @@ static void
eos_page_manager_dispose (GObject *object)
{
EosPageManager *self = EOS_PAGE_MANAGER (object);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- g_list_foreach (self->priv->page_info, (GFunc)top_bars_unref, NULL);
+ g_list_foreach (priv->page_info, (GFunc)top_bars_unref, NULL);
G_OBJECT_CLASS (eos_page_manager_parent_class)->dispose (object);
}
@@ -347,10 +346,11 @@ static void
eos_page_manager_finalize (GObject *object)
{
EosPageManager *self = EOS_PAGE_MANAGER (object);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- g_list_foreach (self->priv->page_info, (GFunc)page_info_free, NULL);
- g_hash_table_destroy(self->priv->pages_by_widget);
- g_hash_table_destroy(self->priv->pages_by_name);
+ g_list_foreach (priv->page_info, (GFunc)page_info_free, NULL);
+ g_hash_table_destroy(priv->pages_by_widget);
+ g_hash_table_destroy(priv->pages_by_name);
G_OBJECT_CLASS (eos_page_manager_parent_class)->finalize (object);
}
@@ -359,8 +359,9 @@ static GtkSizeRequestMode
eos_page_manager_get_request_mode (GtkWidget *widget)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- return gtk_widget_get_request_mode (self->priv->stack);
+ return gtk_widget_get_request_mode (priv->stack);
}
static void
@@ -369,8 +370,9 @@ eos_page_manager_get_preferred_height (GtkWidget *widget,
gint *natural)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- gtk_widget_get_preferred_height (self->priv->stack, minimum, natural);
+ gtk_widget_get_preferred_height (priv->stack, minimum, natural);
}
static void
@@ -380,8 +382,9 @@ eos_page_manager_get_preferred_width_for_height (GtkWidget *widget,
gint *natural)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- gtk_widget_get_preferred_height_for_width (self->priv->stack, height,
+ gtk_widget_get_preferred_height_for_width (priv->stack, height,
minimum, natural);
}
@@ -391,8 +394,9 @@ eos_page_manager_get_preferred_width (GtkWidget *widget,
gint *natural)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- gtk_widget_get_preferred_width (self->priv->stack, minimum, natural);
+ gtk_widget_get_preferred_width (priv->stack, minimum, natural);
}
static void
@@ -402,8 +406,9 @@ eos_page_manager_get_preferred_height_for_width (GtkWidget *widget,
gint *natural)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- gtk_widget_get_preferred_height_for_width (self->priv->stack, width,
+ gtk_widget_get_preferred_height_for_width (priv->stack, width,
minimum, natural);
}
@@ -412,28 +417,31 @@ eos_page_manager_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
gtk_widget_set_allocation (widget, allocation);
- gtk_widget_size_allocate (self->priv->stack, allocation);
+ gtk_widget_size_allocate (priv->stack, allocation);
}
static void
eos_page_manager_show_all (GtkWidget *widget)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
GTK_WIDGET_CLASS (eos_page_manager_parent_class)->show (widget);
- if (self->priv->stack != NULL)
- gtk_widget_show_all (self->priv->stack);
+ if (priv->stack != NULL)
+ gtk_widget_show_all (priv->stack);
}
static void
eos_page_manager_map (GtkWidget *widget)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- if (self->priv->stack != NULL && gtk_widget_get_visible (self->priv->stack))
- gtk_widget_map (self->priv->stack);
+ if (priv->stack != NULL && gtk_widget_get_visible (priv->stack))
+ gtk_widget_map (priv->stack);
GTK_WIDGET_CLASS (eos_page_manager_parent_class)->map (widget);
}
@@ -441,9 +449,10 @@ static void
eos_page_manager_unmap (GtkWidget *widget)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- if (self->priv->stack != NULL)
- gtk_widget_unmap (self->priv->stack);
+ if (priv->stack != NULL)
+ gtk_widget_unmap (priv->stack);
GTK_WIDGET_CLASS (eos_page_manager_parent_class)->unmap (widget);
}
@@ -452,9 +461,10 @@ eos_page_manager_draw (GtkWidget *widget,
cairo_t *cr)
{
EosPageManager *self = EOS_PAGE_MANAGER (widget);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- if (self->priv->stack != NULL)
- gtk_widget_draw (self->priv->stack, cr);
+ if (priv->stack != NULL)
+ gtk_widget_draw (priv->stack, cr);
return FALSE;
}
@@ -464,18 +474,19 @@ eos_page_manager_add (GtkContainer *container,
GtkWidget *new_page)
{
EosPageManager *self = EOS_PAGE_MANAGER (container);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- gtk_container_add (GTK_CONTAINER (self->priv->stack), new_page);
+ gtk_container_add (GTK_CONTAINER (priv->stack), new_page);
EosPageManagerPageInfo *info = g_slice_new0 (EosPageManagerPageInfo);
info->background_size = g_strdup (DEFAULT_BACKGROUND_SIZE);
info->background_position = g_strdup (DEFAULT_BACKGROUND_POSITION);
info->background_repeats = TRUE;
info->page = new_page;
- self->priv->page_info = g_list_prepend (self->priv->page_info, info);
- g_hash_table_insert (self->priv->pages_by_widget, new_page, info);
+ priv->page_info = g_list_prepend (priv->page_info, info);
+ g_hash_table_insert (priv->pages_by_widget, new_page, info);
/* If there were no pages yet, then this one must become the visible one */
- if (self->priv->visible_page_info == NULL)
+ if (priv->visible_page_info == NULL)
eos_page_manager_set_visible_page (self, new_page);
assert_internal_state (self);
@@ -486,32 +497,33 @@ eos_page_manager_remove (GtkContainer *container,
GtkWidget *page)
{
EosPageManager *self = EOS_PAGE_MANAGER (container);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- gtk_container_remove (GTK_CONTAINER (self->priv->stack), page);
+ gtk_container_remove (GTK_CONTAINER (priv->stack), page);
EosPageManagerPageInfo *info = find_page_info_by_widget (self, page);
if (info == NULL)
{
warn_page_widget_not_found (self, page);
return;
}
- self->priv->page_info = g_list_remove (self->priv->page_info, info);
- g_hash_table_remove (self->priv->pages_by_widget, page);
+ priv->page_info = g_list_remove (priv->page_info, info);
+ g_hash_table_remove (priv->pages_by_widget, page);
if (info->name != NULL)
- g_hash_table_remove (self->priv->pages_by_name, info->name);
+ g_hash_table_remove (priv->pages_by_name, info->name);
- if (self->priv->visible_page_info == info)
+ if (priv->visible_page_info == info)
{
/* If this was the only page */
- if (self->priv->page_info == NULL)
+ if (priv->page_info == NULL)
{
- self->priv->visible_page_info = NULL;
+ priv->visible_page_info = NULL;
}
/* Otherwise set visible page as the first in our list. */
else
{
g_critical ("Removing the currently visible page %p from the page manager.",
page);
- EosPageManagerPageInfo *visible_info = g_list_first (self->priv->page_info)->data;
+ EosPageManagerPageInfo *visible_info = g_list_first (priv->page_info)->data;
set_visible_page_from_info (self, visible_info);
}
@@ -529,17 +541,18 @@ eos_page_manager_forall (GtkContainer *container,
gpointer callback_data)
{
EosPageManager *self = EOS_PAGE_MANAGER (container);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
- if (self->priv->stack == NULL)
+ if (priv->stack == NULL)
return;
- GtkContainerClass *stack_class = GTK_CONTAINER_GET_CLASS (self->priv->stack);
- stack_class->forall (GTK_CONTAINER (self->priv->stack),
+ GtkContainerClass *stack_class = GTK_CONTAINER_GET_CLASS (priv->stack);
+ stack_class->forall (GTK_CONTAINER (priv->stack),
include_internals,
callback,
callback_data);
if (include_internals)
- callback (self->priv->stack, callback_data);
+ callback (priv->stack, callback_data);
}
static void
@@ -678,8 +691,6 @@ eos_page_manager_class_init (EosPageManagerClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosPageManagerPrivate));
-
object_class->get_property = eos_page_manager_get_property;
object_class->set_property = eos_page_manager_set_property;
object_class->dispose = eos_page_manager_dispose;
@@ -892,20 +903,19 @@ eos_page_manager_class_init (EosPageManagerClass *klass)
static void
eos_page_manager_init (EosPageManager *self)
{
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
GtkWidget *self_widget = GTK_WIDGET (self);
- self->priv = PAGE_MANAGER_PRIVATE (self);
- self->priv->pages_by_widget = g_hash_table_new (g_direct_hash,
- g_direct_equal);
- self->priv->pages_by_name = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- NULL);
+ priv->pages_by_widget = g_hash_table_new (g_direct_hash,
+ g_direct_equal);
+ priv->pages_by_name = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
gtk_widget_set_has_window (self_widget, FALSE);
- /* TODO replace with GtkStack */
- self->priv->stack = gtk_stack_new ();
- gtk_widget_set_parent (self->priv->stack, self_widget);
+ priv->stack = gtk_stack_new ();
+ gtk_widget_set_parent (priv->stack, self_widget);
}
/* Public API */
@@ -938,10 +948,11 @@ eos_page_manager_get_visible_page (EosPageManager *self)
{
g_return_val_if_fail (EOS_IS_PAGE_MANAGER (self), NULL);
- if (self->priv->visible_page_info == NULL)
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ if (priv->visible_page_info == NULL)
return NULL;
- return self->priv->visible_page_info->page;
+ return priv->visible_page_info->page;
}
/**
@@ -984,10 +995,11 @@ eos_page_manager_get_visible_page_name (EosPageManager *self)
{
g_return_val_if_fail (EOS_IS_PAGE_MANAGER (self), NULL);
- if (self->priv->visible_page_info == NULL)
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ if (priv->visible_page_info == NULL)
return NULL;
- return self->priv->visible_page_info->name;
+ return priv->visible_page_info->name;
}
/**
@@ -1061,6 +1073,7 @@ eos_page_manager_set_page_name (EosPageManager *self,
GtkWidget *page,
const gchar *name)
{
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
EosPageManagerPageInfo *info;
g_return_if_fail (EOS_IS_PAGE_MANAGER (self));
@@ -1090,11 +1103,11 @@ eos_page_manager_set_page_name (EosPageManager *self,
return;
if (info->name != NULL)
- g_hash_table_remove (self->priv->pages_by_name, info->name);
+ g_hash_table_remove (priv->pages_by_name, info->name);
g_free (info->name);
info->name = g_strdup (name);
if (name != NULL)
- g_hash_table_insert (self->priv->pages_by_name, g_strdup (name), info);
+ g_hash_table_insert (priv->pages_by_name, g_strdup (name), info);
gtk_container_child_notify (GTK_CONTAINER (self), page, "name");
@@ -1601,7 +1614,8 @@ eos_page_manager_get_transition_duration (EosPageManager *self)
{
g_return_val_if_fail (EOS_IS_PAGE_MANAGER (self), 0);
- return gtk_stack_get_transition_duration (GTK_STACK (self->priv->stack));
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ return gtk_stack_get_transition_duration (GTK_STACK (priv->stack));
}
/**
@@ -1618,7 +1632,8 @@ eos_page_manager_set_transition_duration (EosPageManager *self,
{
g_return_if_fail (EOS_IS_PAGE_MANAGER (self));
- gtk_stack_set_transition_duration (GTK_STACK (self->priv->stack), duration);
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ gtk_stack_set_transition_duration (GTK_STACK (priv->stack), duration);
g_object_notify (G_OBJECT (self), "transition-duration");
}
@@ -1636,7 +1651,8 @@ eos_page_manager_get_transition_type (EosPageManager *self)
{
g_return_val_if_fail (EOS_IS_PAGE_MANAGER (self), EOS_PAGE_MANAGER_TRANSITION_TYPE_NONE);
- return self->priv->transition_type;
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ return priv->transition_type;
}
@@ -1654,7 +1670,8 @@ eos_page_manager_set_transition_type (EosPageManager *self,
{
g_return_if_fail (EOS_IS_PAGE_MANAGER (self));
- self->priv->transition_type = transition_type;
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ priv->transition_type = transition_type;
GtkStackTransitionType gtk_stack_transition;
switch (transition_type)
{
@@ -1664,13 +1681,13 @@ eos_page_manager_set_transition_type (EosPageManager *self,
case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_LEFT:
case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_UP:
case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_DOWN:
- gtk_stack_transition = (GtkStackTransitionType)self->priv->transition_type;
+ gtk_stack_transition = (GtkStackTransitionType)priv->transition_type;
break;
default:
gtk_stack_transition = GTK_STACK_TRANSITION_TYPE_NONE;
break;
}
- gtk_stack_set_transition_type (GTK_STACK (self->priv->stack),
+ gtk_stack_set_transition_type (GTK_STACK (priv->stack),
gtk_stack_transition);
g_object_notify (G_OBJECT (self), "transition-type");
}
@@ -1684,5 +1701,6 @@ eos_page_manager_set_transition_type (EosPageManager *self,
GtkStackTransitionType
eos_page_manager_get_gtk_stack_transition_type (EosPageManager *self)
{
- return gtk_stack_get_transition_type (GTK_STACK (self->priv->stack));
+ EosPageManagerPrivate *priv = eos_page_manager_get_instance_private (self);
+ return gtk_stack_get_transition_type (GTK_STACK (priv->stack));
}
diff --git a/endless/eospagemanager.h b/endless/eospagemanager.h
index 3c86eac..7ec4d97 100644
--- a/endless/eospagemanager.h
+++ b/endless/eospagemanager.h
@@ -37,7 +37,6 @@ G_BEGIN_DECLS
typedef struct _EosPageManager EosPageManager;
typedef struct _EosPageManagerClass EosPageManagerClass;
-typedef struct _EosPageManagerPrivate EosPageManagerPrivate;
#define EOS_TYPE_PAGE_MANAGER_TRANSITION_TYPE (eos_page_manager_transition_type_get_type ())
@@ -70,8 +69,6 @@ typedef enum {
struct _EosPageManager
{
GtkContainer parent;
-
- EosPageManagerPrivate *priv;
};
struct _EosPageManagerClass
diff --git a/endless/eossplashpagemanager.c b/endless/eossplashpagemanager.c
index bbaf898..bd13645 100644
--- a/endless/eossplashpagemanager.c
+++ b/endless/eossplashpagemanager.c
@@ -42,17 +42,13 @@
* ]|
*/
-G_DEFINE_TYPE (EosSplashPageManager, eos_splash_page_manager, EOS_TYPE_PAGE_MANAGER)
-
-#define SPLASH_PAGE_MANAGER_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_SPLASH_PAGE_MANAGER, EosSplashPageManagerPrivate))
-
-struct _EosSplashPageManagerPrivate
-{
+typedef struct {
GtkWidget *splash_page;
GtkWidget *main_page;
gboolean main_page_shown;
-};
+} EosSplashPageManagerPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosSplashPageManager, eos_splash_page_manager, EOS_TYPE_PAGE_MANAGER)
enum
{
@@ -115,7 +111,8 @@ eos_splash_page_manager_add (GtkContainer *container,
GtkWidget *new_page)
{
EosSplashPageManager *self = EOS_SPLASH_PAGE_MANAGER (container);
- if (self->priv->splash_page != NULL)
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
+ if (priv->splash_page != NULL)
{
g_critical ("Not adding page %p to splash page manager. You already added"
"a splash page.", new_page);
@@ -131,11 +128,12 @@ eos_splash_page_manager_remove (GtkContainer *container,
GtkWidget *page)
{
EosSplashPageManager *self = EOS_SPLASH_PAGE_MANAGER (container);
- if (page == self->priv->splash_page)
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
+ if (page == priv->splash_page)
{
eos_splash_page_manager_set_splash_page (self, NULL);
}
- if (page == self->priv->main_page)
+ if (page == priv->main_page)
{
eos_splash_page_manager_set_main_page (self, NULL);
}
@@ -147,8 +145,6 @@ eos_splash_page_manager_class_init (EosSplashPageManagerClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosSplashPageManagerPrivate));
-
object_class->get_property = eos_splash_page_manager_get_property;
object_class->set_property = eos_splash_page_manager_set_property;
@@ -186,7 +182,6 @@ eos_splash_page_manager_class_init (EosSplashPageManagerClass *klass)
static void
eos_splash_page_manager_init (EosSplashPageManager *self)
{
- self->priv = SPLASH_PAGE_MANAGER_PRIVATE (self);
}
/* Public API */
@@ -219,7 +214,8 @@ eos_splash_page_manager_get_splash_page (EosSplashPageManager *self)
{
g_return_val_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self), NULL);
- return self->priv->splash_page;
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
+ return priv->splash_page;
}
/**
@@ -240,18 +236,19 @@ eos_splash_page_manager_set_splash_page (EosSplashPageManager *self,
g_return_if_fail (page == NULL || GTK_IS_WIDGET (page));
g_return_if_fail (page == NULL || gtk_widget_get_parent (page) == NULL);
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
- if (self->priv->splash_page != page)
+ if (priv->splash_page != page)
{
- if (self->priv->splash_page != NULL)
- gtk_container_remove (GTK_CONTAINER (self), self->priv->splash_page);
+ if (priv->splash_page != NULL)
+ gtk_container_remove (GTK_CONTAINER (self), priv->splash_page);
if (page != NULL)
{
GTK_CONTAINER_CLASS (eos_splash_page_manager_parent_class)->add (GTK_CONTAINER (self), page);
- if (!self->priv->main_page_shown)
+ if (!priv->main_page_shown)
eos_page_manager_set_visible_page (EOS_PAGE_MANAGER (self), page);
}
- self->priv->splash_page = page;
+ priv->splash_page = page;
g_object_notify( G_OBJECT (self), "splash-page");
}
}
@@ -272,7 +269,8 @@ eos_splash_page_manager_get_main_page (EosSplashPageManager *self)
{
g_return_val_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self), NULL);
- return self->priv->main_page;
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
+ return priv->main_page;
}
/**
@@ -293,14 +291,15 @@ eos_splash_page_manager_set_main_page (EosSplashPageManager *self,
g_return_if_fail (page == NULL || GTK_IS_WIDGET (page));
g_return_if_fail (page == NULL || gtk_widget_get_parent (page) == NULL);
- if (self->priv->main_page != page)
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
+ if (priv->main_page != page)
{
- if (self->priv->main_page != NULL)
- gtk_container_remove (GTK_CONTAINER (self), self->priv->main_page);
+ if (priv->main_page != NULL)
+ gtk_container_remove (GTK_CONTAINER (self), priv->main_page);
// Call page manager add not our own.
if (page != NULL)
GTK_CONTAINER_CLASS (eos_splash_page_manager_parent_class)->add (GTK_CONTAINER (self), page);
- self->priv->main_page = page;
+ priv->main_page = page;
g_object_notify( G_OBJECT (self), "main-page");
}
}
@@ -315,13 +314,15 @@ void
eos_splash_page_manager_show_main_page (EosSplashPageManager *self)
{
g_return_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self));
- if (self->priv->main_page == NULL)
+
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
+ if (priv->main_page == NULL)
{
g_critical ("Main page is null, have you set it?");
return;
}
- self->priv->main_page_shown = TRUE;
- eos_page_manager_set_visible_page (EOS_PAGE_MANAGER (self), self->priv->main_page);
+ priv->main_page_shown = TRUE;
+ eos_page_manager_set_visible_page (EOS_PAGE_MANAGER (self), priv->main_page);
}
/**
@@ -336,11 +337,13 @@ void
eos_splash_page_manager_show_splash_page (EosSplashPageManager *self)
{
g_return_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self));
- if (self->priv->splash_page == NULL)
+
+ EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self);
+ if (priv->splash_page == NULL)
{
g_critical ("Splash page is null, have you set it?");
return;
}
- self->priv->main_page_shown = FALSE;
- eos_page_manager_set_visible_page (EOS_PAGE_MANAGER (self), self->priv->splash_page);
+ priv->main_page_shown = FALSE;
+ eos_page_manager_set_visible_page (EOS_PAGE_MANAGER (self), priv->splash_page);
}
diff --git a/endless/eossplashpagemanager.h b/endless/eossplashpagemanager.h
index 4e88d7d..061176e 100644
--- a/endless/eossplashpagemanager.h
+++ b/endless/eossplashpagemanager.h
@@ -39,7 +39,6 @@ G_BEGIN_DECLS
typedef struct _EosSplashPageManager EosSplashPageManager;
typedef struct _EosSplashPageManagerClass EosSplashPageManagerClass;
-typedef struct _EosSplashPageManagerPrivate EosSplashPageManagerPrivate;
/**
* EosSplashPageManager:
@@ -49,8 +48,6 @@ typedef struct _EosSplashPageManagerPrivate EosSplashPageManagerPrivate;
struct _EosSplashPageManager
{
EosPageManager parent;
-
- EosSplashPageManagerPrivate *priv;
};
struct _EosSplashPageManagerClass
diff --git a/endless/eostopbar-private.h b/endless/eostopbar-private.h
index 02ac6c7..cabb414 100644
--- a/endless/eostopbar-private.h
+++ b/endless/eostopbar-private.h
@@ -33,13 +33,10 @@ G_BEGIN_DECLS
typedef struct _EosTopBar EosTopBar;
typedef struct _EosTopBarClass EosTopBarClass;
-typedef struct _EosTopBarPrivate EosTopBarPrivate;
struct _EosTopBar
{
GtkEventBox parent;
-
- EosTopBarPrivate *priv;
};
struct _EosTopBarClass
diff --git a/endless/eostopbar.c b/endless/eostopbar.c
index 4d6f42a..81edee6 100644
--- a/endless/eostopbar.c
+++ b/endless/eostopbar.c
@@ -27,13 +27,7 @@
#define _EOS_TOP_BAR_MINIMIZE_ICON_NAME "window-minimize-symbolic"
#define _EOS_TOP_BAR_CLOSE_ICON_NAME "window-close-symbolic"
-G_DEFINE_TYPE (EosTopBar, eos_top_bar, GTK_TYPE_EVENT_BOX)
-
-#define TOP_BAR_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_TOP_BAR, EosTopBarPrivate))
-
-struct _EosTopBarPrivate
-{
+typedef struct {
GtkWidget *actions_grid;
GtkWidget *left_top_bar_attach;
GtkWidget *center_top_bar_attach;
@@ -45,7 +39,9 @@ struct _EosTopBarPrivate
GtkWidget *minimize_icon;
GtkWidget *close_button;
GtkWidget *close_icon;
-};
+} EosTopBarPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosTopBar, eos_top_bar, GTK_TYPE_EVENT_BOX)
enum {
CLOSE_CLICKED,
@@ -122,8 +118,6 @@ eos_top_bar_class_init (EosTopBarClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosTopBarPrivate));
-
widget_class->button_press_event = eos_top_bar_button_press_event;
widget_class->get_preferred_height = eos_top_bar_get_preferred_height;
widget_class->draw = eos_top_bar_draw;
@@ -171,15 +165,14 @@ static void
eos_top_bar_init (EosTopBar *self)
{
GtkStyleContext *context;
-
- self->priv = TOP_BAR_PRIVATE (self);
+ EosTopBarPrivate *priv = eos_top_bar_get_instance_private (self);
context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_add_class (context, _EOS_STYLE_CLASS_TOP_BAR);
gtk_widget_set_hexpand (GTK_WIDGET (self), TRUE);
- self->priv->actions_grid =
+ priv->actions_grid =
g_object_new (GTK_TYPE_GRID,
"orientation", GTK_ORIENTATION_HORIZONTAL,
"hexpand", TRUE,
@@ -191,60 +184,60 @@ eos_top_bar_init (EosTopBar *self)
"margin-right", _EOS_TOP_BAR_HORIZONTAL_BUTTON_MARGIN_PX,
NULL);
- self->priv->left_top_bar_attach = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- self->priv->center_top_bar_attach = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- gtk_widget_set_hexpand (self->priv->center_top_bar_attach, TRUE);
- gtk_widget_set_halign (self->priv->center_top_bar_attach, GTK_ALIGN_CENTER);
+ priv->left_top_bar_attach = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+ priv->center_top_bar_attach = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+ gtk_widget_set_hexpand (priv->center_top_bar_attach, TRUE);
+ gtk_widget_set_halign (priv->center_top_bar_attach, GTK_ALIGN_CENTER);
/* TODO implement adding actions and widgets to the actions_grid */
- self->priv->minimize_button =
+ priv->minimize_button =
g_object_new (GTK_TYPE_BUTTON,
"halign", GTK_ALIGN_END,
"valign", GTK_ALIGN_CENTER,
NULL);
- self->priv->minimize_icon =
+ priv->minimize_icon =
gtk_image_new_from_icon_name (_EOS_TOP_BAR_MINIMIZE_ICON_NAME,
GTK_ICON_SIZE_SMALL_TOOLBAR);
- g_object_set(self->priv->minimize_icon,
+ g_object_set(priv->minimize_icon,
"pixel-size", _EOS_TOP_BAR_ICON_SIZE_PX,
"margin", _EOS_TOP_BAR_BUTTON_PADDING_PX,
NULL);
- gtk_container_add (GTK_CONTAINER (self->priv->minimize_button),
- self->priv->minimize_icon);
+ gtk_container_add (GTK_CONTAINER (priv->minimize_button),
+ priv->minimize_icon);
- self->priv->close_button =
+ priv->close_button =
g_object_new (GTK_TYPE_BUTTON,
"halign", GTK_ALIGN_END,
"valign", GTK_ALIGN_CENTER,
NULL);
- self->priv->close_icon =
+ priv->close_icon =
gtk_image_new_from_icon_name (_EOS_TOP_BAR_CLOSE_ICON_NAME,
GTK_ICON_SIZE_SMALL_TOOLBAR);
- g_object_set(self->priv->close_icon,
+ g_object_set(priv->close_icon,
"pixel-size", _EOS_TOP_BAR_ICON_SIZE_PX,
"margin", _EOS_TOP_BAR_BUTTON_PADDING_PX,
NULL);
- gtk_container_add (GTK_CONTAINER (self->priv->close_button),
- self->priv->close_icon);
+ gtk_container_add (GTK_CONTAINER (priv->close_button),
+ priv->close_icon);
- gtk_container_add (GTK_CONTAINER (self->priv->actions_grid),
- self->priv->left_top_bar_attach);
- gtk_container_add (GTK_CONTAINER (self->priv->actions_grid),
- self->priv->center_top_bar_attach);
- gtk_container_add (GTK_CONTAINER (self->priv->actions_grid),
- self->priv->minimize_button);
- gtk_container_add (GTK_CONTAINER (self->priv->actions_grid),
- self->priv->close_button);
+ gtk_container_add (GTK_CONTAINER (priv->actions_grid),
+ priv->left_top_bar_attach);
+ gtk_container_add (GTK_CONTAINER (priv->actions_grid),
+ priv->center_top_bar_attach);
+ gtk_container_add (GTK_CONTAINER (priv->actions_grid),
+ priv->minimize_button);
+ gtk_container_add (GTK_CONTAINER (priv->actions_grid),
+ priv->close_button);
- gtk_container_add (GTK_CONTAINER (self), self->priv->actions_grid);
+ gtk_container_add (GTK_CONTAINER (self), priv->actions_grid);
gtk_widget_set_hexpand (GTK_WIDGET (self), TRUE);
gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_FILL);
- g_signal_connect (self->priv->minimize_button, "clicked",
+ g_signal_connect (priv->minimize_button, "clicked",
G_CALLBACK (on_minimize_clicked_cb), self);
- g_signal_connect (self->priv->close_button, "clicked",
+ g_signal_connect (priv->close_button, "clicked",
G_CALLBACK (on_close_clicked_cb), self);
}
@@ -268,7 +261,7 @@ eos_top_bar_set_left_widget (EosTopBar *self,
g_return_if_fail (EOS_IS_TOP_BAR (self));
g_return_if_fail (left_top_bar_widget == NULL || GTK_IS_WIDGET (left_top_bar_widget));
- EosTopBarPrivate *priv = self->priv;
+ EosTopBarPrivate *priv = eos_top_bar_get_instance_private (self);
if (priv->left_top_bar_widget == left_top_bar_widget)
return;
@@ -299,7 +292,7 @@ eos_top_bar_set_center_widget (EosTopBar *self,
g_return_if_fail (EOS_IS_TOP_BAR (self));
g_return_if_fail (center_top_bar_widget == NULL || GTK_IS_WIDGET (center_top_bar_widget));
- EosTopBarPrivate *priv = self->priv;
+ EosTopBarPrivate *priv = eos_top_bar_get_instance_private (self);
if (priv->center_top_bar_widget == center_top_bar_widget)
return;
diff --git a/endless/eoswindow.c b/endless/eoswindow.c
index d026e6b..3037e4f 100644
--- a/endless/eoswindow.c
+++ b/endless/eoswindow.c
@@ -54,13 +54,7 @@
#define _EOS_TOP_BAR_EDGE_FINISHING_HEIGHT_PX 2
-G_DEFINE_TYPE (EosWindow, eos_window, GTK_TYPE_APPLICATION_WINDOW)
-
-#define WINDOW_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EOS_TYPE_WINDOW, EosWindowPrivate))
-
-struct _EosWindowPrivate
-{
+typedef struct {
EosApplication *application;
GtkWidget *top_bar;
@@ -79,7 +73,9 @@ struct _EosWindowPrivate
gulong visible_page_property_handler;
GtkCssProvider *background_provider;
gchar *current_background_css_props;
-};
+} EosWindowPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (EosWindow, eos_window, GTK_TYPE_APPLICATION_WINDOW)
enum
{
@@ -94,13 +90,14 @@ static GParamSpec *eos_window_props[NPROPS] = { NULL, };
static void
override_background_css(EosWindow *self, gchar *background_css)
{
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
// Override the css
GtkStyleProvider *provider =
- GTK_STYLE_PROVIDER (self->priv->background_provider);
+ GTK_STYLE_PROVIDER (priv->background_provider);
GdkScreen *screen = gdk_screen_get_default ();
GError *error = NULL;
gtk_style_context_remove_provider_for_screen (screen, provider);
- gtk_css_provider_load_from_data (self->priv->background_provider,
+ gtk_css_provider_load_from_data (priv->background_provider,
background_css, -1, &error);
gtk_style_context_add_provider_for_screen (screen, provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
@@ -116,9 +113,10 @@ override_background_css(EosWindow *self, gchar *background_css)
static void
update_page_actions (EosWindow *self)
{
- EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
- EosMainArea *ma = EOS_MAIN_AREA (self->priv->main_area);
- GtkWidget *page = self->priv->current_page;
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager);
+ EosMainArea *ma = EOS_MAIN_AREA (priv->main_area);
+ GtkWidget *page = priv->current_page;
if (page != NULL)
{
@@ -141,9 +139,10 @@ update_page_actions (EosWindow *self)
static void
update_page_toolbox (EosWindow *self)
{
- EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
- EosMainArea *ma = EOS_MAIN_AREA (self->priv->main_area);
- GtkWidget *page = self->priv->current_page;
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager);
+ EosMainArea *ma = EOS_MAIN_AREA (priv->main_area);
+ GtkWidget *page = priv->current_page;
if (page != NULL)
{
@@ -167,9 +166,10 @@ update_page_toolbox (EosWindow *self)
static void
update_page_left_topbar (EosWindow *self)
{
- EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
- EosTopBar *tb = EOS_TOP_BAR (self->priv->top_bar);
- GtkWidget *page = self->priv->current_page;
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager);
+ EosTopBar *tb = EOS_TOP_BAR (priv->top_bar);
+ GtkWidget *page = priv->current_page;
if (page != NULL)
{
@@ -193,9 +193,10 @@ update_page_left_topbar (EosWindow *self)
static void
update_page_center_topbar (EosWindow *self)
{
- EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
- EosTopBar *tb = EOS_TOP_BAR (self->priv->top_bar);
- GtkWidget *page = self->priv->current_page;
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager);
+ EosTopBar *tb = EOS_TOP_BAR (priv->top_bar);
+ GtkWidget *page = priv->current_page;
if (page != NULL)
{
@@ -212,10 +213,11 @@ update_page_center_topbar (EosWindow *self)
static void
sync_stack_animation (EosWindow *self)
{
- EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
- gtk_stack_set_transition_type (GTK_STACK (self->priv->background_stack),
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager);
+ gtk_stack_set_transition_type (GTK_STACK (priv->background_stack),
eos_page_manager_get_gtk_stack_transition_type (pm));
- gtk_stack_set_transition_duration (GTK_STACK (self->priv->background_stack),
+ gtk_stack_set_transition_duration (GTK_STACK (priv->background_stack),
eos_page_manager_get_transition_duration (pm));
}
@@ -252,8 +254,9 @@ format_background_css (EosPageManager *pm,
static void
update_page_background (EosWindow *self)
{
- EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
- GtkWidget *page = self->priv->current_page;
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager);
+ GtkWidget *page = priv->current_page;
// If no page set, do not transition
if (page == NULL)
return;
@@ -261,21 +264,21 @@ update_page_background (EosWindow *self)
gchar *next_background_css_props = format_background_css (pm,
page);
// If page background are exactly the same, do not transition
- if (g_strcmp0 (self->priv->current_background_css_props, next_background_css_props) == 0)
+ if (g_strcmp0 (priv->current_background_css_props, next_background_css_props) == 0)
return;
gchar *background_css = g_strdup_printf(CSS_TEMPLATE,
- gtk_widget_get_name (self->priv->current_background),
- self->priv->current_background_css_props,
- gtk_widget_get_name (self->priv->next_background),
+ gtk_widget_get_name (priv->current_background),
+ priv->current_background_css_props,
+ gtk_widget_get_name (priv->next_background),
next_background_css_props);
override_background_css (self, background_css);
- gtk_stack_set_visible_child (GTK_STACK (self->priv->background_stack),
- self->priv->next_background);
+ gtk_stack_set_visible_child (GTK_STACK (priv->background_stack),
+ priv->next_background);
// Swap our background frames for next animation
- GtkWidget *temp = self->priv->next_background;
- self->priv->next_background = self->priv->current_background;
- self->priv->current_background = temp;
- self->priv->current_background_css_props = next_background_css_props;
+ GtkWidget *temp = priv->next_background;
+ priv->next_background = priv->current_background;
+ priv->current_background = temp;
+ priv->current_background_css_props = next_background_css_props;
}
/*
@@ -319,14 +322,15 @@ update_visible_page_properties (GtkWidget *widget,
static void
update_page (EosWindow *self)
{
- EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager);
- if (self->priv->current_page)
+ if (priv->current_page)
{
- g_signal_handler_disconnect (self->priv->current_page,
- self->priv->visible_page_property_handler);
+ g_signal_handler_disconnect (priv->current_page,
+ priv->visible_page_property_handler);
}
- self->priv->current_page = eos_page_manager_get_visible_page (pm);
+ priv->current_page = eos_page_manager_get_visible_page (pm);
update_page_actions (self);
update_page_toolbox (self);
@@ -334,13 +338,13 @@ update_page (EosWindow *self)
update_page_left_topbar (self);
update_page_center_topbar (self);
update_page_background (self);
- gtk_stack_set_transition_type (GTK_STACK (self->priv->background_stack),
+ gtk_stack_set_transition_type (GTK_STACK (priv->background_stack),
GTK_STACK_TRANSITION_TYPE_NONE);
- if (self->priv->current_page)
+ if (priv->current_page)
{
- self->priv->visible_page_property_handler =
- g_signal_connect (self->priv->current_page,
+ priv->visible_page_property_handler =
+ g_signal_connect (priv->current_page,
"child-notify",
G_CALLBACK (update_visible_page_properties),
self);
@@ -354,11 +358,12 @@ eos_window_get_property (GObject *object,
GParamSpec *pspec)
{
EosWindow *self = EOS_WINDOW (object);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
switch (property_id)
{
case PROP_APPLICATION:
- g_value_set_object (value, self->priv->application);
+ g_value_set_object (value, priv->application);
break;
case PROP_PAGE_MANAGER:
@@ -374,10 +379,11 @@ static void
set_application (EosWindow *self,
EosApplication *application)
{
- self->priv->application = application;
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ priv->application = application;
gtk_window_set_application (GTK_WINDOW (self),
- GTK_APPLICATION (self->priv->application));
- if (self->priv->application == NULL)
+ GTK_APPLICATION (priv->application));
+ if (priv->application == NULL)
{
g_error ("In order to create a window, you must have an application "
"for it to connect to.");
@@ -416,11 +422,12 @@ eos_window_get_preferred_height (GtkWidget *widget,
int *natural_height)
{
EosWindow *self = EOS_WINDOW (widget);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
int top_bar_minimum, top_bar_natural;
GTK_WIDGET_CLASS (eos_window_parent_class)->get_preferred_height (widget,
minimum_height, natural_height);
- gtk_widget_get_preferred_height (self->priv->top_bar,
+ gtk_widget_get_preferred_height (priv->top_bar,
&top_bar_minimum, &top_bar_natural);
if (minimum_height != NULL)
*minimum_height += top_bar_minimum;
@@ -435,23 +442,24 @@ eos_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
EosWindow *self = EOS_WINDOW (widget);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
GtkWidget *child;
GtkAllocation child_allocation = *allocation;
gtk_widget_set_allocation (widget, allocation);
- if (self->priv->top_bar != NULL)
+ if (priv->top_bar != NULL)
{
int top_bar_natural;
GtkAllocation top_bar_allocation = *allocation;
- gtk_widget_get_preferred_height (self->priv->top_bar,
+ gtk_widget_get_preferred_height (priv->top_bar,
NULL, &top_bar_natural);
top_bar_allocation.height = MIN(top_bar_natural, allocation->height);
child_allocation.y += top_bar_allocation.height;
child_allocation.height -= top_bar_allocation.height;
- gtk_widget_size_allocate (self->priv->top_bar, &top_bar_allocation);
+ gtk_widget_size_allocate (priv->top_bar, &top_bar_allocation);
}
/* We can't chain up to GtkWindow's implementation of size_allocate() here,
@@ -465,12 +473,13 @@ static void
eos_window_map (GtkWidget *widget)
{
EosWindow *self = EOS_WINDOW (widget);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
GTK_WIDGET_CLASS (eos_window_parent_class)->map (widget);
- if (self->priv->top_bar != NULL
- && gtk_widget_get_visible (self->priv->top_bar))
+ if (priv->top_bar != NULL
+ && gtk_widget_get_visible (priv->top_bar))
{
- gtk_widget_map (self->priv->top_bar);
+ gtk_widget_map (priv->top_bar);
}
}
@@ -478,21 +487,22 @@ static void
eos_window_unmap (GtkWidget *widget)
{
EosWindow *self = EOS_WINDOW (widget);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
GTK_WIDGET_CLASS (eos_window_parent_class)->unmap (widget);
- if (self->priv->top_bar != NULL)
- gtk_widget_unmap (self->priv->top_bar);
+ if (priv->top_bar != NULL)
+ gtk_widget_unmap (priv->top_bar);
}
static void
eos_window_show (GtkWidget *widget)
{
EosWindow *self = EOS_WINDOW (widget);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
GTK_WIDGET_CLASS (eos_window_parent_class)->show (widget);
- if (self->priv->top_bar != NULL)
- gtk_widget_show_all (self->priv->top_bar);
-
+ if (priv->top_bar != NULL)
+ gtk_widget_show_all (priv->top_bar);
}
/* The top bar is an internal child, so include it in our list of internal
@@ -504,9 +514,10 @@ eos_window_forall (GtkContainer *container,
gpointer callback_data)
{
EosWindow *self = EOS_WINDOW (container);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
- if (include_internals && self->priv->top_bar != NULL)
- (*callback) (self->priv->top_bar, callback_data);
+ if (include_internals && priv->top_bar != NULL)
+ (*callback) (priv->top_bar, callback_data);
GTK_CONTAINER_CLASS (eos_window_parent_class)->forall (container,
include_internals,
callback,
@@ -529,8 +540,6 @@ eos_window_class_init (EosWindowClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (EosWindowPrivate));
-
object_class->get_property = eos_window_get_property;
object_class->set_property = eos_window_set_property;
/* Overriding the following six functions is because we treat the top bar as
@@ -623,68 +632,68 @@ on_edge_finishing_draw_cb (GtkWidget *edge_finishing,
static void
eos_window_init (EosWindow *self)
{
- self->priv = WINDOW_PRIVATE (self);
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
- self->priv->top_bar = eos_top_bar_new ();
- gtk_widget_set_parent (self->priv->top_bar, GTK_WIDGET (self));
+ priv->top_bar = eos_top_bar_new ();
+ gtk_widget_set_parent (priv->top_bar, GTK_WIDGET (self));
- self->priv->overlay = gtk_overlay_new ();
- gtk_container_add (GTK_CONTAINER (self), self->priv->overlay);
+ priv->overlay = gtk_overlay_new ();
+ gtk_container_add (GTK_CONTAINER (self), priv->overlay);
- self->priv->background_stack = gtk_stack_new ();
- gtk_container_add (GTK_CONTAINER (self->priv->overlay), self->priv->background_stack);
+ priv->background_stack = gtk_stack_new ();
+ gtk_container_add (GTK_CONTAINER (priv->overlay), priv->background_stack);
gchar *background_name1 = g_strdup_printf (BACKGROUND_FRAME_NAME_TEMPLATE, 1);
- self->priv->next_background = g_object_new (GTK_TYPE_FRAME, "name", background_name1, NULL);
- gtk_container_add (GTK_CONTAINER (self->priv->background_stack), self->priv->next_background);
+ priv->next_background = g_object_new (GTK_TYPE_FRAME, "name", background_name1, NULL);
+ gtk_container_add (GTK_CONTAINER (priv->background_stack), priv->next_background);
// Add the current background to the stack second. I think the latest added
// will be the first visible page in the stack
gchar *background_name0 = g_strdup_printf (BACKGROUND_FRAME_NAME_TEMPLATE, 0);
- self->priv->current_background = g_object_new (GTK_TYPE_FRAME, "name", background_name0, NULL);
- gtk_container_add (GTK_CONTAINER (self->priv->background_stack), self->priv->current_background);
+ priv->current_background = g_object_new (GTK_TYPE_FRAME, "name", background_name0, NULL);
+ gtk_container_add (GTK_CONTAINER (priv->background_stack), priv->current_background);
- self->priv->background_provider = gtk_css_provider_new ();
+ priv->background_provider = gtk_css_provider_new ();
// We start all the background frames transparent with no styling
- self->priv->current_background_css_props = TRANSPARENT_FRAME_CSS_PROPERTIES;
+ priv->current_background_css_props = TRANSPARENT_FRAME_CSS_PROPERTIES;
gchar *background_css = g_strdup_printf(CSS_TEMPLATE,
- gtk_widget_get_name (self->priv->current_background),
+ gtk_widget_get_name (priv->current_background),
TRANSPARENT_FRAME_CSS_PROPERTIES,
- gtk_widget_get_name (self->priv->next_background),
+ gtk_widget_get_name (priv->next_background),
TRANSPARENT_FRAME_CSS_PROPERTIES);
override_background_css (self, background_css);
- self->priv->main_area = eos_main_area_new ();
- gtk_overlay_add_overlay (GTK_OVERLAY (self->priv->overlay), self->priv->main_area);
+ priv->main_area = eos_main_area_new ();
+ gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->main_area);
// We want the overlay to size to the main area, the widget on top. The
// overlay gets its size request from the widget on the bottom, the
// background frame with no minimum size. So we use a size group.
- self->priv->overlay_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
- gtk_size_group_add_widget (self->priv->overlay_size_group, self->priv->background_stack);
- gtk_size_group_add_widget (self->priv->overlay_size_group, self->priv->main_area);
+ priv->overlay_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ gtk_size_group_add_widget (priv->overlay_size_group, priv->background_stack);
+ gtk_size_group_add_widget (priv->overlay_size_group, priv->main_area);
- self->priv->edge_finishing = gtk_drawing_area_new ();
- gtk_widget_set_vexpand (self->priv->edge_finishing, FALSE);
- gtk_widget_set_valign (self->priv->edge_finishing, GTK_ALIGN_START);
+ priv->edge_finishing = gtk_drawing_area_new ();
+ gtk_widget_set_vexpand (priv->edge_finishing, FALSE);
+ gtk_widget_set_valign (priv->edge_finishing, GTK_ALIGN_START);
/* has_window == FALSE is necessary for not catching input events */
- gtk_widget_set_has_window (self->priv->edge_finishing, FALSE);
- gtk_widget_set_size_request (self->priv->edge_finishing,
+ gtk_widget_set_has_window (priv->edge_finishing, FALSE);
+ gtk_widget_set_size_request (priv->edge_finishing,
-1, _EOS_TOP_BAR_EDGE_FINISHING_HEIGHT_PX);
- g_signal_connect_after (self->priv->edge_finishing, "realize",
+ g_signal_connect_after (priv->edge_finishing, "realize",
G_CALLBACK (after_edge_finishing_realize_cb), NULL);
- g_signal_connect (self->priv->edge_finishing, "draw",
+ g_signal_connect (priv->edge_finishing, "draw",
G_CALLBACK (on_edge_finishing_draw_cb), NULL);
- gtk_overlay_add_overlay (GTK_OVERLAY (self->priv->overlay),
- self->priv->edge_finishing);
+ gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay),
+ priv->edge_finishing);
gtk_window_set_decorated (GTK_WINDOW (self), FALSE);
gtk_window_maximize (GTK_WINDOW (self));
gtk_window_set_default_size (GTK_WINDOW (self), DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
- g_signal_connect (self->priv->top_bar, "minimize-clicked",
+ g_signal_connect (priv->top_bar, "minimize-clicked",
G_CALLBACK (on_minimize_clicked_cb), NULL);
- g_signal_connect (self->priv->top_bar, "close-clicked",
+ g_signal_connect (priv->top_bar, "close-clicked",
G_CALLBACK (on_close_clicked_cb), NULL);
eos_window_set_page_manager (self,
@@ -722,8 +731,8 @@ EosPageManager *
eos_window_get_page_manager (EosWindow *self)
{
g_return_val_if_fail (self != NULL && EOS_IS_WINDOW (self), NULL);
-
- return self->priv->page_manager;
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
+ return priv->page_manager;
}
/**
@@ -737,18 +746,19 @@ void
eos_window_set_page_manager (EosWindow *self,
EosPageManager *page_manager)
{
+ EosWindowPrivate *priv = eos_window_get_instance_private (self);
g_return_if_fail (self != NULL && EOS_IS_WINDOW (self));
g_return_if_fail (page_manager != NULL && EOS_IS_PAGE_MANAGER (page_manager));
- EosMainArea *main_area = EOS_MAIN_AREA (self->priv->main_area);
+ EosMainArea *main_area = EOS_MAIN_AREA (priv->main_area);
- self->priv->page_manager = page_manager;
+ priv->page_manager = page_manager;
eos_main_area_set_content (main_area,
- GTK_WIDGET (self->priv->page_manager));
+ GTK_WIDGET (priv->page_manager));
update_page (self);
- g_signal_connect_swapped (self->priv->page_manager, "notify::visible-page",
+ g_signal_connect_swapped (priv->page_manager, "notify::visible-page",
G_CALLBACK (update_page), self);
}
diff --git a/endless/eoswindow.h b/endless/eoswindow.h
index bbbf2b5..820aa09 100644
--- a/endless/eoswindow.h
+++ b/endless/eoswindow.h
@@ -38,7 +38,6 @@ G_BEGIN_DECLS
typedef struct _EosWindow EosWindow;
typedef struct _EosWindowClass EosWindowClass;
-typedef struct _EosWindowPrivate EosWindowPrivate;
/**
* EosWindow:
@@ -49,8 +48,6 @@ struct _EosWindow
{
/*< private >*/
GtkApplicationWindow parent;
-
- EosWindowPrivate *priv;
};
struct _EosWindowClass