summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-01-26 12:34:01 +0800
committerlukefromdc <[email protected]>2019-02-02 07:07:50 +0000
commit3daa55c6e6716cdf1e15b2ca2d53096372a0e1c1 (patch)
tree46f9de104840fa2dee33910818f7f1e29f3aa602 /src
parent4e42def6ff1c846d54e93260d116dc69eac97d2f (diff)
downloadcaja-3daa55c6e6716cdf1e15b2ca2d53096372a0e1c1.tar.bz2
caja-3daa55c6e6716cdf1e15b2ca2d53096372a0e1c1.tar.xz
Avoid deprecated g_type_class_add_private under src
Changed CajaInformationPanel, CajaLocationBar and CajaNavigationAction
Diffstat (limited to 'src')
-rw-r--r--src/caja-information-panel.c9
-rw-r--r--src/caja-information-panel.h4
-rw-r--r--src/caja-location-bar.c9
-rw-r--r--src/caja-location-bar.h4
-rw-r--r--src/caja-navigation-action.c46
-rw-r--r--src/caja-navigation-action.h2
6 files changed, 17 insertions, 57 deletions
diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c
index 2ba15deb..e91ca103 100644
--- a/src/caja-information-panel.c
+++ b/src/caja-information-panel.c
@@ -49,7 +49,7 @@
#include <libcaja-private/caja-sidebar-provider.h>
#include <libcaja-private/caja-module.h>
-struct CajaInformationPanelDetails
+struct _CajaInformationPanelPrivate
{
GtkWidget *container;
CajaWindowInfo *window;
@@ -142,6 +142,7 @@ typedef struct
G_DEFINE_TYPE_WITH_CODE (CajaInformationPanel, caja_information_panel, EEL_TYPE_BACKGROUND_BOX,
+ G_ADD_PRIVATE (CajaInformationPanel)
G_IMPLEMENT_INTERFACE (CAJA_TYPE_SIDEBAR,
caja_information_panel_iface_init));
@@ -217,8 +218,6 @@ caja_information_panel_class_init (CajaInformationPanelClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
-
- g_type_class_add_private (klass, sizeof (CajaInformationPanelDetails));
}
/* utility routine to allocate the box the holds the command buttons */
@@ -244,9 +243,7 @@ make_button_box (CajaInformationPanel *information_panel)
static void
caja_information_panel_init (CajaInformationPanel *information_panel)
{
- information_panel->details = G_TYPE_INSTANCE_GET_PRIVATE (information_panel,
- CAJA_TYPE_INFORMATION_PANEL,
- CajaInformationPanelDetails);
+ information_panel->details = caja_information_panel_get_instance_private (information_panel);
/* load the default background */
caja_information_panel_read_defaults (information_panel);
diff --git a/src/caja-information-panel.h b/src/caja-information-panel.h
index 75bcfcbb..5ccdd9d6 100644
--- a/src/caja-information-panel.h
+++ b/src/caja-information-panel.h
@@ -42,14 +42,14 @@
#define CAJA_INFORMATION_PANEL_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_INFORMATION_PANEL, CajaInformationPanelClass))
-typedef struct CajaInformationPanelDetails CajaInformationPanelDetails;
+typedef struct _CajaInformationPanelPrivate CajaInformationPanelPrivate;
#define CAJA_INFORMATION_PANEL_ID "information"
typedef struct
{
EelBackgroundBox parent_slot;
- CajaInformationPanelDetails *details;
+ CajaInformationPanelPrivate *details;
} CajaInformationPanel;
typedef struct
diff --git a/src/caja-location-bar.c b/src/caja-location-bar.c
index 53a2946f..7763f40b 100644
--- a/src/caja-location-bar.c
+++ b/src/caja-location-bar.c
@@ -59,7 +59,7 @@ static const char untranslated_go_to_label[] = N_("Go To:");
#define LOCATION_LABEL _(untranslated_location_label)
#define GO_TO_LABEL _(untranslated_go_to_label)
-struct CajaLocationBarDetails
+struct _CajaLocationBarPrivate
{
GtkLabel *label;
CajaEntry *entry;
@@ -97,7 +97,7 @@ static const GtkTargetEntry drop_types [] =
{ CAJA_DND_TEXT_PLAIN_TYPE, 0, CAJA_DND_TEXT_PLAIN },
};
-G_DEFINE_TYPE (CajaLocationBar, caja_location_bar, GTK_TYPE_BOX);
+G_DEFINE_TYPE_WITH_PRIVATE (CajaLocationBar, caja_location_bar, GTK_TYPE_BOX);
static CajaNavigationWindow *
caja_location_bar_get_window (GtkWidget *bar)
@@ -468,8 +468,6 @@ caja_location_bar_class_init (CajaLocationBarClass *klass)
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "cancel", 0);
-
- g_type_class_add_private (klass, sizeof (CajaLocationBarDetails));
}
static void
@@ -479,8 +477,7 @@ caja_location_bar_init (CajaLocationBar *bar)
GtkWidget *entry;
GtkWidget *event_box;
- bar->details = G_TYPE_INSTANCE_GET_PRIVATE (bar, CAJA_TYPE_LOCATION_BAR,
- CajaLocationBarDetails);
+ bar->details = caja_location_bar_get_instance_private (bar);
gtk_orientable_set_orientation (GTK_ORIENTABLE (bar),
GTK_ORIENTATION_HORIZONTAL);
diff --git a/src/caja-location-bar.h b/src/caja-location-bar.h
index aa2a9521..628f2f4b 100644
--- a/src/caja-location-bar.h
+++ b/src/caja-location-bar.h
@@ -47,12 +47,12 @@
#define CAJA_LOCATION_BAR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_LOCATION_BAR, CajaLocationBarClass))
-typedef struct CajaLocationBarDetails CajaLocationBarDetails;
+typedef struct _CajaLocationBarPrivate CajaLocationBarPrivate;
typedef struct CajaLocationBar
{
GtkHBox parent;
- CajaLocationBarDetails *details;
+ CajaLocationBarPrivate *details;
} CajaLocationBar;
typedef struct
diff --git a/src/caja-navigation-action.c b/src/caja-navigation-action.c
index 8fbecfe9..6acc8eac 100644
--- a/src/caja-navigation-action.c
+++ b/src/caja-navigation-action.c
@@ -39,11 +39,7 @@
static void caja_navigation_action_init (CajaNavigationAction *action);
static void caja_navigation_action_class_init (CajaNavigationActionClass *class);
-static GObjectClass *parent_class = NULL;
-
-#define CAJA_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), CAJA_TYPE_NAVIGATION_ACTION, CajaNavigationActionPrivate))
-
-struct CajaNavigationActionPrivate
+struct _CajaNavigationActionPrivate
{
CajaNavigationWindow *window;
CajaNavigationDirection direction;
@@ -58,33 +54,7 @@ enum
PROP_WINDOW
};
-GType
-caja_navigation_action_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0)
- {
- const GTypeInfo type_info =
- {
- sizeof (CajaNavigationActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) caja_navigation_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (CajaNavigationAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) caja_navigation_action_init,
- };
-
- type = g_type_register_static (GTK_TYPE_ACTION,
- "CajaNavigationAction",
- &type_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE (CajaNavigationAction, caja_navigation_action, GTK_TYPE_ACTION)
static gboolean
should_open_in_new_tab (void)
@@ -279,7 +249,7 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
g_signal_connect (child, "button-release-event", G_CALLBACK (proxy_button_release_event_cb), NULL);
}
- (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (caja_navigation_action_parent_class)->connect_proxy) (action, proxy);
}
static void
@@ -296,7 +266,7 @@ disconnect_proxy (GtkAction *action, GtkWidget *proxy)
g_signal_handlers_disconnect_by_func (child, G_CALLBACK (proxy_button_release_event_cb), NULL);
}
- (* GTK_ACTION_CLASS (parent_class)->disconnect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (caja_navigation_action_parent_class)->disconnect_proxy) (action, proxy);
}
static void
@@ -306,7 +276,7 @@ caja_navigation_action_finalize (GObject *object)
g_free (action->priv->arrow_tooltip);
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* G_OBJECT_CLASS (caja_navigation_action_parent_class)->finalize) (object);
}
static void
@@ -368,8 +338,6 @@ caja_navigation_action_class_init (CajaNavigationActionClass *class)
object_class->set_property = caja_navigation_action_set_property;
object_class->get_property = caja_navigation_action_get_property;
- parent_class = g_type_class_peek_parent (class);
-
action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
action_class->connect_proxy = connect_proxy;
action_class->disconnect_proxy = disconnect_proxy;
@@ -397,12 +365,10 @@ caja_navigation_action_class_init (CajaNavigationActionClass *class)
"The navigation window",
G_TYPE_OBJECT,
G_PARAM_READWRITE));
-
- g_type_class_add_private (object_class, sizeof(CajaNavigationActionPrivate));
}
static void
caja_navigation_action_init (CajaNavigationAction *action)
{
- action->priv = CAJA_NAVIGATION_ACTION_GET_PRIVATE (action);
+ action->priv = caja_navigation_action_get_instance_private (action);
}
diff --git a/src/caja-navigation-action.h b/src/caja-navigation-action.h
index 2b3a9b88..4e3b7dd6 100644
--- a/src/caja-navigation-action.h
+++ b/src/caja-navigation-action.h
@@ -42,7 +42,7 @@
typedef struct _CajaNavigationAction CajaNavigationAction;
typedef struct _CajaNavigationActionClass CajaNavigationActionClass;
-typedef struct CajaNavigationActionPrivate CajaNavigationActionPrivate;
+typedef struct _CajaNavigationActionPrivate CajaNavigationActionPrivate;
typedef enum
{