summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-01-26 12:13:16 +0800
committerlukefromdc <[email protected]>2019-01-31 19:37:15 +0000
commit7920f9788dc8a142472c358d693bb7532c46b609 (patch)
tree298d23f361e2c18be424b7d573a8abb5d9f64848 /libcaja-private
parent0b073710ad39202758525b9dd0a08f35fa84481d (diff)
downloadcaja-7920f9788dc8a142472c358d693bb7532c46b609.tar.bz2
caja-7920f9788dc8a142472c358d693bb7532c46b609.tar.xz
Avoid deprecated g_type_class_add_private under libcaja-private
Changed CajaIconCanvasItem, CajaTrashMonitor and CajaUndoStackManager
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-icon-canvas-item.c38
-rw-r--r--libcaja-private/caja-icon-canvas-item.h12
-rw-r--r--libcaja-private/caja-trash-monitor.c10
-rw-r--r--libcaja-private/caja-trash-monitor.h4
-rw-r--r--libcaja-private/caja-undostack-manager.c10
5 files changed, 29 insertions, 45 deletions
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 8f0630a9..b1c66822 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -78,7 +78,7 @@
*/
/* Private part of the CajaIconCanvasItem structure. */
-struct CajaIconCanvasItemDetails
+struct _CajaIconCanvasItemPrivate
{
/* The image, text, font. */
double x, y;
@@ -191,6 +191,7 @@ static void caja_icon_canvas_item_text_interface_init (EelAccessibleTextIface *i
static GType caja_icon_canvas_item_accessible_factory_get_type (void);
G_DEFINE_TYPE_WITH_CODE (CajaIconCanvasItem, caja_icon_canvas_item, EEL_TYPE_CANVAS_ITEM,
+ G_ADD_PRIVATE (CajaIconCanvasItem)
G_IMPLEMENT_INTERFACE (EEL_TYPE_ACCESSIBLE_TEXT,
caja_icon_canvas_item_text_interface_init));
@@ -244,14 +245,14 @@ caja_icon_canvas_item_init (CajaIconCanvasItem *icon_item)
setup_auto_enums = TRUE;
}
- icon_item->details = G_TYPE_INSTANCE_GET_PRIVATE ((icon_item), CAJA_TYPE_ICON_CANVAS_ITEM, CajaIconCanvasItemDetails);
+ icon_item->details = caja_icon_canvas_item_get_instance_private (icon_item);
caja_icon_canvas_item_invalidate_label_size (icon_item);
}
static void
caja_icon_canvas_item_finalize (GObject *object)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
g_assert (CAJA_IS_ICON_CANVAS_ITEM (object));
@@ -356,7 +357,7 @@ caja_icon_canvas_item_set_property (GObject *object,
GParamSpec *pspec)
{
CajaIconCanvasItem *item;
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
AtkObject *accessible;
item = CAJA_ICON_CANVAS_ITEM (object);
@@ -460,7 +461,7 @@ caja_icon_canvas_item_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
details = CAJA_ICON_CANVAS_ITEM (object)->details;
@@ -608,7 +609,7 @@ void
caja_icon_canvas_item_set_image (CajaIconCanvasItem *item,
GdkPixbuf *image)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
g_return_if_fail (CAJA_IS_ICON_CANVAS_ITEM (item));
g_return_if_fail (image == NULL || pixbuf_is_acceptable (image));
@@ -1058,7 +1059,7 @@ static void
prepare_pango_layout_for_draw (CajaIconCanvasItem *item,
PangoLayout *layout)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
CajaIconContainer *container;
gboolean needs_highlight;
@@ -1095,7 +1096,7 @@ prepare_pango_layout_for_draw (CajaIconCanvasItem *item,
static void
measure_label_text (CajaIconCanvasItem *item)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
CajaIconContainer *container;
gint editable_height, editable_height_for_layout, editable_height_for_entire_text, editable_width, editable_dx;
gint additional_height, additional_width, additional_dx;
@@ -1236,7 +1237,7 @@ draw_label_text (CajaIconCanvasItem *item,
gboolean create_mask,
EelIRect icon_rect)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
CajaIconContainer *container;
PangoLayout *editable_layout;
PangoLayout *additional_layout;
@@ -1894,7 +1895,7 @@ caja_icon_canvas_item_draw (EelCanvasItem *item,
{
CajaIconContainer *container;
CajaIconCanvasItem *icon_item;
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
EelIRect icon_rect, emblem_rect;
EmblemLayout emblem_layout;
GdkPixbuf *emblem_pixbuf;
@@ -2203,7 +2204,7 @@ hit_test_pixbuf (GdkPixbuf *pixbuf, EelIRect pixbuf_location, EelIRect probe_rec
static gboolean
hit_test (CajaIconCanvasItem *icon_item, EelIRect canvas_rect)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
EelIRect emblem_rect;
EmblemLayout emblem_layout;
GdkPixbuf *emblem_pixbuf;
@@ -2282,7 +2283,7 @@ static void
caja_icon_canvas_item_translate (EelCanvasItem *item, double dx, double dy)
{
CajaIconCanvasItem *icon_item;
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
icon_item = CAJA_ICON_CANVAS_ITEM (item);
details = icon_item->details;
@@ -2295,7 +2296,7 @@ void
caja_icon_canvas_item_get_bounds_for_layout (CajaIconCanvasItem *icon_item,
double *x1, double *y1, double *x2, double *y2)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
EelIRect *total_rect;
details = icon_item->details;
@@ -2328,7 +2329,7 @@ void
caja_icon_canvas_item_get_bounds_for_entire_item (CajaIconCanvasItem *icon_item,
double *x1, double *y1, double *x2, double *y2)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
EelIRect *total_rect;
details = icon_item->details;
@@ -2363,7 +2364,7 @@ caja_icon_canvas_item_bounds (EelCanvasItem *item,
double *x1, double *y1, double *x2, double *y2)
{
CajaIconCanvasItem *icon_item;
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
EelIRect *total_rect;
icon_item = CAJA_ICON_CANVAS_ITEM (item);
@@ -2389,7 +2390,7 @@ caja_icon_canvas_item_bounds (EelCanvasItem *item,
static void
caja_icon_canvas_item_ensure_bounds_up_to_date (CajaIconCanvasItem *icon_item)
{
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
EelIRect icon_rect, emblem_rect, icon_rect_raw;
EelIRect text_rect, text_rect_for_layout, text_rect_for_entire_text;
EelIRect total_rect, total_rect_for_layout, total_rect_for_entire_text;
@@ -2799,8 +2800,6 @@ caja_icon_canvas_item_class_init (CajaIconCanvasItemClass *class)
atk_registry_set_factory_type (atk_get_default_registry (),
CAJA_TYPE_ICON_CANVAS_ITEM,
caja_icon_canvas_item_accessible_factory_get_type ());
-
- g_type_class_add_private (class, sizeof (CajaIconCanvasItemDetails));
}
static GailTextUtil *
@@ -3469,6 +3468,7 @@ typedef struct {
G_DEFINE_TYPE_WITH_CODE (CajaIconCanvasItemAccessible,
caja_icon_canvas_item_accessible,
eel_canvas_item_accessible_get_type (),
+ G_ADD_PRIVATE (CajaIconCanvasItemAccessible)
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,
caja_icon_canvas_item_accessible_image_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
@@ -3566,8 +3566,6 @@ caja_icon_canvas_item_accessible_class_init (CajaIconCanvasItemAccessibleClass *
aclass->get_parent = caja_icon_canvas_item_accessible_get_parent;
aclass->get_index_in_parent = caja_icon_canvas_item_accessible_get_index_in_parent;
aclass->ref_state_set = caja_icon_canvas_item_accessible_ref_state_set;
-
- g_type_class_add_private (klass, sizeof (CajaIconCanvasItemAccessiblePrivate));
}
static void
diff --git a/libcaja-private/caja-icon-canvas-item.h b/libcaja-private/caja-icon-canvas-item.h
index d6eb4ee5..507fd8ad 100644
--- a/libcaja-private/caja-icon-canvas-item.h
+++ b/libcaja-private/caja-icon-canvas-item.h
@@ -28,9 +28,7 @@
#include <eel/eel-canvas.h>
#include <eel/eel-art-extensions.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_ICON_CANVAS_ITEM caja_icon_canvas_item_get_type()
#define CAJA_ICON_CANVAS_ITEM(obj) \
@@ -46,12 +44,12 @@ extern "C" {
typedef struct CajaIconCanvasItem CajaIconCanvasItem;
typedef struct CajaIconCanvasItemClass CajaIconCanvasItemClass;
- typedef struct CajaIconCanvasItemDetails CajaIconCanvasItemDetails;
+ typedef struct _CajaIconCanvasItemPrivate CajaIconCanvasItemPrivate;
struct CajaIconCanvasItem
{
EelCanvasItem item;
- CajaIconCanvasItemDetails *details;
+ CajaIconCanvasItemPrivate *details;
gpointer user_data;
};
@@ -116,8 +114,6 @@ extern "C" {
void caja_icon_canvas_item_set_entire_text (CajaIconCanvasItem *icon_item,
gboolean entire_text);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* CAJA_ICON_CANVAS_ITEM_H */
diff --git a/libcaja-private/caja-trash-monitor.c b/libcaja-private/caja-trash-monitor.c
index 2e6aeb78..9fe9e715 100644
--- a/libcaja-private/caja-trash-monitor.c
+++ b/libcaja-private/caja-trash-monitor.c
@@ -34,7 +34,7 @@
#include <gio/gio.h>
#include <string.h>
-struct CajaTrashMonitorDetails
+struct _CajaTrashMonitorPrivate
{
gboolean empty;
GIcon *icon;
@@ -50,7 +50,7 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
static CajaTrashMonitor *caja_trash_monitor = NULL;
-G_DEFINE_TYPE(CajaTrashMonitor, caja_trash_monitor, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (CajaTrashMonitor, caja_trash_monitor, G_TYPE_OBJECT)
static void
caja_trash_monitor_finalize (GObject *object)
@@ -89,8 +89,6 @@ caja_trash_monitor_class_init (CajaTrashMonitorClass *klass)
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
-
- g_type_class_add_private (object_class, sizeof(CajaTrashMonitorDetails));
}
static void
@@ -181,9 +179,7 @@ caja_trash_monitor_init (CajaTrashMonitor *trash_monitor)
{
GFile *location;
- trash_monitor->details = G_TYPE_INSTANCE_GET_PRIVATE (trash_monitor,
- CAJA_TYPE_TRASH_MONITOR,
- CajaTrashMonitorDetails);
+ trash_monitor->details = caja_trash_monitor_get_instance_private (trash_monitor);
trash_monitor->details->empty = TRUE;
trash_monitor->details->icon = g_themed_icon_new (CAJA_ICON_TRASH);
diff --git a/libcaja-private/caja-trash-monitor.h b/libcaja-private/caja-trash-monitor.h
index c3aa7c9a..2468548c 100644
--- a/libcaja-private/caja-trash-monitor.h
+++ b/libcaja-private/caja-trash-monitor.h
@@ -31,7 +31,7 @@
typedef struct CajaTrashMonitor CajaTrashMonitor;
typedef struct CajaTrashMonitorClass CajaTrashMonitorClass;
-typedef struct CajaTrashMonitorDetails CajaTrashMonitorDetails;
+typedef struct _CajaTrashMonitorPrivate CajaTrashMonitorPrivate;
#define CAJA_TYPE_TRASH_MONITOR caja_trash_monitor_get_type()
#define CAJA_TRASH_MONITOR(obj) \
@@ -48,7 +48,7 @@ typedef struct CajaTrashMonitorDetails CajaTrashMonitorDetails;
struct CajaTrashMonitor
{
GObject object;
- CajaTrashMonitorDetails *details;
+ CajaTrashMonitorPrivate *details;
};
struct CajaTrashMonitorClass
diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c
index b1d15505..8ce41a21 100644
--- a/libcaja-private/caja-undostack-manager.c
+++ b/libcaja-private/caja-undostack-manager.c
@@ -104,9 +104,6 @@ struct _CajaUndoStackManagerPrivate
gboolean confirm_delete;
};
-#define CAJA_UNDOSTACK_MANAGER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CAJA_UNDOSTACK_MANAGER, CajaUndoStackManagerPrivate))
-
/* *****************************************************************
Properties management prototypes
***************************************************************** */
@@ -131,7 +128,7 @@ static void caja_undostack_manager_dispose (GObject * object);
/* *****************************************************************
Type definition
***************************************************************** */
-G_DEFINE_TYPE (CajaUndoStackManager, caja_undostack_manager,
+G_DEFINE_TYPE_WITH_PRIVATE (CajaUndoStackManager, caja_undostack_manager,
G_TYPE_OBJECT);
/* *****************************************************************
@@ -218,9 +215,6 @@ caja_undostack_manager_class_init (CajaUndoStackManagerClass * klass)
GParamSpec *confirm_delete;
GObjectClass *g_object_class;
- /* Add private structure */
- g_type_class_add_private (klass, sizeof (CajaUndoStackManagerPrivate));
-
/* Create properties */
undo_levels = g_param_spec_uint ("undo-levels", "undo levels",
"Number of undo levels to be stored",
@@ -261,7 +255,7 @@ caja_undostack_manager_init (CajaUndoStackManager * self)
{
CajaUndoStackManagerPrivate *priv;
- priv = CAJA_UNDOSTACK_MANAGER_GET_PRIVATE (self);
+ priv = caja_undostack_manager_get_instance_private (self);
self->priv = priv;