summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Xiaotian <yetist@gmail.com>2019-01-26 12:35:44 +0800
committerlukefromdc <lukefromdc@hushmail.com>2019-01-31 19:37:54 +0000
commite99050ad48b89cb8e1a5eaafbb9fdf2ffd418485 (patch)
tree42ebc76b8668815a60a946ad2b9b4cc6b30c9e51
parent7920f9788dc8a142472c358d693bb7532c46b609 (diff)
downloadcaja-e99050ad48b89cb8e1a5eaafbb9fdf2ffd418485.tar.bz2
caja-e99050ad48b89cb8e1a5eaafbb9fdf2ffd418485.tar.xz
Avoid deprecated g_type_class_add_private under src
Changed CajaSidePane, CajaSpatialWindow, CajaViewAsAction and CajaXContentBar
-rw-r--r--src/caja-side-pane.c23
-rw-r--r--src/caja-side-pane.h12
-rw-r--r--src/caja-spatial-window.c11
-rw-r--r--src/caja-spatial-window.h4
-rw-r--r--src/caja-view-as-action.c12
-rw-r--r--src/caja-view-as-action.h2
-rw-r--r--src/caja-x-content-bar.c10
-rw-r--r--src/caja-x-content-bar.h10
8 files changed, 29 insertions, 55 deletions
diff --git a/src/caja-side-pane.c b/src/caja-side-pane.c
index b306bacc..34cc9dc3 100644
--- a/src/caja-side-pane.c
+++ b/src/caja-side-pane.c
@@ -40,7 +40,7 @@ typedef struct
GtkWidget *shortcut;
} SidePanel;
-struct _CajaSidePaneDetails
+struct _CajaSidePanePrivate
{
GtkWidget *notebook;
GtkWidget *menu;
@@ -52,7 +52,7 @@ struct _CajaSidePaneDetails
};
static void caja_side_pane_class_init (CajaSidePaneClass *klass);
-static void caja_side_pane_init (GObject *object);
+static void caja_side_pane_init (CajaSidePane *side_pane);
static void caja_side_pane_dispose (GObject *object);
static void caja_side_pane_finalize (GObject *object);
@@ -65,7 +65,7 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
-EEL_CLASS_BOILERPLATE (CajaSidePane, caja_side_pane, GTK_TYPE_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE (CajaSidePane, caja_side_pane, GTK_TYPE_BOX)
static SidePanel *
panel_for_widget (CajaSidePane *side_pane, GtkWidget *widget)
@@ -160,8 +160,6 @@ caja_side_pane_class_init (CajaSidePaneClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
-
- g_type_class_add_private (gobject_class, sizeof (CajaSidePaneDetails));
}
static void
@@ -274,9 +272,8 @@ menu_detach_callback (GtkWidget *widget,
}
static void
-caja_side_pane_init (GObject *object)
+caja_side_pane_init (CajaSidePane *side_pane)
{
- CajaSidePane *side_pane;
GtkWidget *hbox;
GtkWidget *close_button;
GtkWidget *select_button;
@@ -284,20 +281,18 @@ caja_side_pane_init (GObject *object)
GtkWidget *arrow;
GtkWidget *image;
- side_pane = CAJA_SIDE_PANE (object);
-
- side_pane->details = G_TYPE_INSTANCE_GET_PRIVATE (object, CAJA_TYPE_SIDE_PANE, CajaSidePaneDetails);
+ side_pane->details = caja_side_pane_get_instance_private (side_pane);
GtkStyleContext *context;
- context = gtk_widget_get_style_context (GTK_WIDGET (object));
+ context = gtk_widget_get_style_context (GTK_WIDGET (side_pane));
gtk_style_context_add_class (context, "caja-side-pane");
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
side_pane->details->title_hbox = hbox;
gtk_widget_show (hbox);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (object), GTK_ORIENTATION_VERTICAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (side_pane), GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (side_pane), hbox, FALSE, FALSE, 0);
select_button = gtk_toggle_button_new ();
@@ -401,7 +396,7 @@ caja_side_pane_dispose (GObject *object)
side_pane->details->menu = NULL;
}
- EEL_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+ G_OBJECT_CLASS (caja_side_pane_parent_class)->dispose (object);
}
static void
@@ -419,7 +414,7 @@ caja_side_pane_finalize (GObject *object)
g_list_free (side_pane->details->panels);
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
+ G_OBJECT_CLASS (caja_side_pane_parent_class)->finalize (object);
}
CajaSidePane *
diff --git a/src/caja-side-pane.h b/src/caja-side-pane.h
index 0a693f4c..a3fbfc64 100644
--- a/src/caja-side-pane.h
+++ b/src/caja-side-pane.h
@@ -26,9 +26,7 @@
#include <gtk/gtk.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_SIDE_PANE caja_side_pane_get_type()
#define CAJA_SIDE_PANE(obj) \
@@ -42,12 +40,12 @@ extern "C" {
#define CAJA_SIDE_PANE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_SIDE_PANE, CajaSidePaneClass))
- typedef struct _CajaSidePaneDetails CajaSidePaneDetails;
+ typedef struct _CajaSidePanePrivate CajaSidePanePrivate;
typedef struct
{
GtkBox parent;
- CajaSidePaneDetails *details;
+ CajaSidePanePrivate *details;
} CajaSidePane;
typedef struct
@@ -75,8 +73,6 @@ extern "C" {
GtkWidget *caja_side_pane_get_current_panel (CajaSidePane *side_pane);
GtkWidget *caja_side_pane_get_title (CajaSidePane *side_pane);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* CAJA_SIDE_PANE_H */
diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c
index f0f32914..ec088035 100644
--- a/src/caja-spatial-window.c
+++ b/src/caja-spatial-window.c
@@ -69,7 +69,7 @@
#define SPATIAL_ACTION_CLOSE_ALL_FOLDERS "Close All Folders"
#define MENU_PATH_SPATIAL_BOOKMARKS_PLACEHOLDER "/MenuBar/Other Menus/Places/Bookmarks Placeholder"
-struct _CajaSpatialWindowDetails
+struct _CajaSpatialWindowPrivate
{
GtkActionGroup *spatial_action_group; /* owned by ui_manager */
char *last_geometry;
@@ -88,8 +88,7 @@ static const GtkTargetEntry location_button_drag_types[] =
{ CAJA_ICON_DND_URI_LIST_TYPE, 0, CAJA_ICON_DND_URI_LIST },
};
-G_DEFINE_TYPE(CajaSpatialWindow, caja_spatial_window, CAJA_TYPE_WINDOW)
-#define parent_class caja_spatial_window_parent_class
+G_DEFINE_TYPE_WITH_PRIVATE (CajaSpatialWindow, caja_spatial_window, CAJA_TYPE_WINDOW)
static void caja_spatial_window_save_geometry (CajaSpatialWindow *window,
CajaFile *viewed_file);
@@ -987,9 +986,7 @@ caja_spatial_window_init (CajaSpatialWindow *window)
CajaWindow *win;
CajaWindowPane *pane;
- window->details = G_TYPE_INSTANCE_GET_PRIVATE (window,
- CAJA_TYPE_SPATIAL_WINDOW,
- CajaSpatialWindowDetails);
+ window->details = caja_spatial_window_get_instance_private (window);
win = CAJA_WINDOW (window);
@@ -1124,6 +1121,4 @@ caja_spatial_window_class_init (CajaSpatialWindowClass *klass)
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, GDK_SHIFT_MASK | GDK_MOD1_MASK,
"go_up", 1,
G_TYPE_BOOLEAN, TRUE);
-
- g_type_class_add_private (klass, sizeof(CajaSpatialWindowDetails));
}
diff --git a/src/caja-spatial-window.h b/src/caja-spatial-window.h
index a012e88e..58d9b2a4 100644
--- a/src/caja-spatial-window.h
+++ b/src/caja-spatial-window.h
@@ -47,13 +47,13 @@
typedef struct _CajaSpatialWindow CajaSpatialWindow;
#endif
typedef struct _CajaSpatialWindowClass CajaSpatialWindowClass;
-typedef struct _CajaSpatialWindowDetails CajaSpatialWindowDetails;
+typedef struct _CajaSpatialWindowPrivate CajaSpatialWindowPrivate;
struct _CajaSpatialWindow
{
CajaWindow parent_object;
- CajaSpatialWindowDetails *details;
+ CajaSpatialWindowPrivate *details;
};
struct _CajaSpatialWindowClass
diff --git a/src/caja-view-as-action.c b/src/caja-view-as-action.c
index 7baed932..ee30ddc8 100644
--- a/src/caja-view-as-action.c
+++ b/src/caja-view-as-action.c
@@ -33,20 +33,18 @@
#include <eel/eel-gtk-extensions.h>
#include <libcaja-private/caja-view-factory.h>
-G_DEFINE_TYPE (CajaViewAsAction, caja_view_as_action, GTK_TYPE_ACTION)
-
static void caja_view_as_action_init (CajaViewAsAction *action);
static void caja_view_as_action_class_init (CajaViewAsActionClass *class);
static GObjectClass *parent_class = NULL;
-#define CAJA_VIEW_AS_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), CAJA_TYPE_VIEW_AS_ACTION, CajaViewAsActionPrivate))
-
-struct CajaViewAsActionPrivate
+struct _CajaViewAsActionPrivate
{
CajaNavigationWindow *window;
};
+G_DEFINE_TYPE_WITH_PRIVATE (CajaViewAsAction, caja_view_as_action, GTK_TYPE_ACTION)
+
enum
{
PROP_0,
@@ -276,12 +274,10 @@ caja_view_as_action_class_init (CajaViewAsActionClass *class)
"The navigation window",
G_TYPE_OBJECT,
G_PARAM_READWRITE));
-
- g_type_class_add_private (object_class, sizeof(CajaViewAsActionPrivate));
}
static void
caja_view_as_action_init (CajaViewAsAction *action)
{
- action->priv = CAJA_VIEW_AS_ACTION_GET_PRIVATE (action);
+ action->priv = caja_view_as_action_get_instance_private (action);
}
diff --git a/src/caja-view-as-action.h b/src/caja-view-as-action.h
index c9252ac3..3fd4fbc5 100644
--- a/src/caja-view-as-action.h
+++ b/src/caja-view-as-action.h
@@ -37,7 +37,7 @@
typedef struct _CajaViewAsAction CajaViewAsAction;
typedef struct _CajaViewAsActionClass CajaViewAsActionClass;
-typedef struct CajaViewAsActionPrivate CajaViewAsActionPrivate;
+typedef struct _CajaViewAsActionPrivate CajaViewAsActionPrivate;
struct _CajaViewAsAction
{
diff --git a/src/caja-x-content-bar.c b/src/caja-x-content-bar.c
index e38c75d8..73a58b70 100644
--- a/src/caja-x-content-bar.c
+++ b/src/caja-x-content-bar.c
@@ -32,9 +32,7 @@
#include <libcaja-private/caja-autorun.h>
#include <libcaja-private/caja-icon-info.h>
-#define CAJA_X_CONTENT_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CAJA_TYPE_X_CONTENT_BAR, CajaXContentBarPrivate))
-
-struct CajaXContentBarPrivate
+struct _CajaXContentBarPrivate
{
GtkWidget *label;
GtkWidget *button;
@@ -50,7 +48,7 @@ enum
PROP_X_CONTENT_TYPE,
};
-G_DEFINE_TYPE (CajaXContentBar, caja_x_content_bar, GTK_TYPE_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE (CajaXContentBar, caja_x_content_bar, GTK_TYPE_BOX)
void
caja_x_content_bar_set_x_content_type (CajaXContentBar *bar, const char *x_content_type)
@@ -256,8 +254,6 @@ caja_x_content_bar_class_init (CajaXContentBarClass *klass)
object_class->set_property = caja_x_content_bar_set_property;
object_class->finalize = caja_x_content_bar_finalize;
- g_type_class_add_private (klass, sizeof (CajaXContentBarPrivate));
-
g_object_class_install_property (object_class,
PROP_MOUNT,
g_param_spec_object (
@@ -299,7 +295,7 @@ caja_x_content_bar_init (CajaXContentBar *bar)
{
GtkWidget *hbox;
- bar->priv = CAJA_X_CONTENT_BAR_GET_PRIVATE (bar);
+ bar->priv = caja_x_content_bar_get_instance_private (bar);
hbox = GTK_WIDGET (bar);
diff --git a/src/caja-x-content-bar.h b/src/caja-x-content-bar.h
index 50639e4e..a69fae13 100644
--- a/src/caja-x-content-bar.h
+++ b/src/caja-x-content-bar.h
@@ -28,9 +28,7 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_X_CONTENT_BAR (caja_x_content_bar_get_type ())
#define CAJA_X_CONTENT_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CAJA_TYPE_X_CONTENT_BAR, CajaXContentBar))
@@ -39,7 +37,7 @@ extern "C" {
#define CAJA_IS_X_CONTENT_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CAJA_TYPE_X_CONTENT_BAR))
#define CAJA_X_CONTENT_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CAJA_TYPE_X_CONTENT_BAR, CajaXContentBarClass))
- typedef struct CajaXContentBarPrivate CajaXContentBarPrivate;
+ typedef struct _CajaXContentBarPrivate CajaXContentBarPrivate;
typedef struct
{
@@ -64,8 +62,6 @@ extern "C" {
GMount *mount);
GMount *caja_x_content_bar_get_mount (CajaXContentBar *bar);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __CAJA_X_CONTENT_BAR_H */