Skip to content

Commit

Permalink
Avoid deprecated g_type_class_add_private
Browse files Browse the repository at this point in the history
- caja-connect-server-dialog
- caja-navigation-window
- caja-property-browser
- caja-sidebar-title
- caja-trash-bar
- caja-window
- caja-zoom-action
- caja-zoom-control
- fm-desktop-icon-view
- fm-properties-window
  • Loading branch information
yetist authored and lukefromdc committed Jan 28, 2019
1 parent 331a0e1 commit e8f124d
Show file tree
Hide file tree
Showing 21 changed files with 81 additions and 118 deletions.
9 changes: 3 additions & 6 deletions src/caja-connect-server-dialog.c
Expand Up @@ -45,7 +45,7 @@
* - NetworkManager integration
*/

struct _CajaConnectServerDialogDetails
struct _CajaConnectServerDialogPrivate
{
CajaApplication *application;

Expand Down Expand Up @@ -79,7 +79,7 @@ struct _CajaConnectServerDialogDetails
gboolean should_destroy;
};

G_DEFINE_TYPE (CajaConnectServerDialog, caja_connect_server_dialog,
G_DEFINE_TYPE_WITH_PRIVATE (CajaConnectServerDialog, caja_connect_server_dialog,
GTK_TYPE_DIALOG)

static void sensitive_entry_changed_callback (GtkEditable *editable,
Expand Down Expand Up @@ -851,8 +851,7 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
gchar *str;
int i;

dialog->details = G_TYPE_INSTANCE_GET_PRIVATE (dialog, CAJA_TYPE_CONNECT_SERVER_DIALOG,
CajaConnectServerDialogDetails);
dialog->details = caja_connect_server_dialog_get_instance_private (dialog);

content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));

Expand Down Expand Up @@ -1167,8 +1166,6 @@ caja_connect_server_dialog_class_init (CajaConnectServerDialogClass *class)

oclass = G_OBJECT_CLASS (class);
oclass->finalize = caja_connect_server_dialog_finalize;

g_type_class_add_private (class, sizeof (CajaConnectServerDialogDetails));
}

GtkWidget *
Expand Down
4 changes: 2 additions & 2 deletions src/caja-connect-server-dialog.h
Expand Up @@ -42,12 +42,12 @@

typedef struct _CajaConnectServerDialog CajaConnectServerDialog;
typedef struct _CajaConnectServerDialogClass CajaConnectServerDialogClass;
typedef struct _CajaConnectServerDialogDetails CajaConnectServerDialogDetails;
typedef struct _CajaConnectServerDialogPrivate CajaConnectServerDialogPrivate;

struct _CajaConnectServerDialog
{
GtkDialog parent;
CajaConnectServerDialogDetails *details;
CajaConnectServerDialogPrivate *details;
};

struct _CajaConnectServerDialogClass
Expand Down
6 changes: 2 additions & 4 deletions src/caja-navigation-window.c
Expand Up @@ -88,7 +88,7 @@ static void use_extra_mouse_buttons_changed (gpointer
static CajaWindowSlot *create_extra_pane (CajaNavigationWindow *window);


G_DEFINE_TYPE (CajaNavigationWindow, caja_navigation_window, CAJA_TYPE_WINDOW)
G_DEFINE_TYPE_WITH_PRIVATE (CajaNavigationWindow, caja_navigation_window, CAJA_TYPE_WINDOW)
#define parent_class caja_navigation_window_parent_class

static const struct
Expand All @@ -115,7 +115,7 @@ caja_navigation_window_init (CajaNavigationWindow *window)

win = CAJA_WINDOW (window);

window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_NAVIGATION_WINDOW, CajaNavigationWindowDetails);
window->details = caja_navigation_window_get_instance_private (window);

GtkStyleContext *context;

Expand Down Expand Up @@ -1286,8 +1286,6 @@ caja_navigation_window_class_init (CajaNavigationWindowClass *class)
CAJA_WINDOW_CLASS (class)->open_slot = real_open_slot;
CAJA_WINDOW_CLASS (class)->close_slot = real_close_slot;

g_type_class_add_private (G_OBJECT_CLASS (class), sizeof (CajaNavigationWindowDetails));

g_signal_connect_swapped (caja_preferences,
"changed::" CAJA_PREFERENCES_MOUSE_BACK_BUTTON,
G_CALLBACK(mouse_back_button_changed),
Expand Down
4 changes: 2 additions & 2 deletions src/caja-navigation-window.h
Expand Up @@ -53,14 +53,14 @@

typedef struct _CajaNavigationWindow CajaNavigationWindow;
typedef struct _CajaNavigationWindowClass CajaNavigationWindowClass;
typedef struct _CajaNavigationWindowDetails CajaNavigationWindowDetails;
typedef struct _CajaNavigationWindowPrivate CajaNavigationWindowPrivate;


struct _CajaNavigationWindow
{
CajaWindow parent_object;

CajaNavigationWindowDetails *details;
CajaNavigationWindowPrivate *details;

/** UI stuff **/
CajaSidePane *sidebar;
Expand Down
10 changes: 3 additions & 7 deletions src/caja-property-browser.c
Expand Up @@ -66,7 +66,7 @@ typedef enum
CAJA_PROPERTY_EMBLEM
} CajaPropertyType;

struct CajaPropertyBrowserDetails
struct _CajaPropertyBrowserPrivate
{
GtkWidget *container;

Expand Down Expand Up @@ -194,7 +194,7 @@ static GtkTargetEntry drag_types[] =
};


G_DEFINE_TYPE (CajaPropertyBrowser, caja_property_browser, GTK_TYPE_WINDOW)
G_DEFINE_TYPE_WITH_PRIVATE (CajaPropertyBrowser, caja_property_browser, GTK_TYPE_WINDOW)


/* Destroy the three dialogs for adding patterns/colors/emblems if any of them
Expand Down Expand Up @@ -253,8 +253,6 @@ caja_property_browser_class_init (CajaPropertyBrowserClass *klass)
widget_class->drag_begin = caja_property_browser_drag_begin;
widget_class->drag_data_get = caja_property_browser_drag_data_get;
widget_class->drag_end = caja_property_browser_drag_end;

g_type_class_add_private (klass, sizeof (CajaPropertyBrowserDetails));
}

/* initialize the instance's fields, create the necessary subviews, etc. */
Expand All @@ -270,9 +268,7 @@ caja_property_browser_init (CajaPropertyBrowser *property_browser)

widget = GTK_WIDGET (property_browser);

property_browser->details = G_TYPE_INSTANCE_GET_PRIVATE (property_browser,
CAJA_TYPE_PROPERTY_BROWSER,
CajaPropertyBrowserDetails);
property_browser->details = caja_property_browser_get_instance_private (property_browser);

property_browser->details->category = g_strdup ("patterns");
property_browser->details->category_type = CAJA_PROPERTY_PATTERN;
Expand Down
4 changes: 2 additions & 2 deletions src/caja-property-browser.h
Expand Up @@ -49,12 +49,12 @@ typedef struct CajaPropertyBrowserClass CajaPropertyBrowserClass;
#define CAJA_PROPERTY_BROWSER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_PROPERTY_BROWSER, CajaPropertyBrowserClass))

typedef struct CajaPropertyBrowserDetails CajaPropertyBrowserDetails;
typedef struct _CajaPropertyBrowserPrivate CajaPropertyBrowserPrivate;

struct CajaPropertyBrowser
{
GtkWindow window;
CajaPropertyBrowserDetails *details;
CajaPropertyBrowserPrivate *details;
};

struct CajaPropertyBrowserClass
Expand Down
10 changes: 3 additions & 7 deletions src/caja-sidebar-title.c
Expand Up @@ -80,7 +80,7 @@ enum
LAST_LABEL_COLOR
};

struct CajaSidebarTitleDetails
struct _CajaSidebarTitlePrivate
{
CajaFile *file;
guint file_changed_connection;
Expand All @@ -97,7 +97,7 @@ struct CajaSidebarTitleDetails
gboolean determined_icon;
};

G_DEFINE_TYPE (CajaSidebarTitle, caja_sidebar_title, GTK_TYPE_BOX)
G_DEFINE_TYPE_WITH_PRIVATE (CajaSidebarTitle, caja_sidebar_title, GTK_TYPE_BOX)

static void
style_updated (GtkWidget *widget)
Expand All @@ -116,9 +116,7 @@ style_updated (GtkWidget *widget)
static void
caja_sidebar_title_init (CajaSidebarTitle *sidebar_title)
{
sidebar_title->details = G_TYPE_INSTANCE_GET_PRIVATE (sidebar_title,
CAJA_TYPE_SIDEBAR_TITLE,
CajaSidebarTitleDetails);
sidebar_title->details = caja_sidebar_title_get_instance_private (sidebar_title);

gtk_orientable_set_orientation (GTK_ORIENTABLE (sidebar_title), GTK_ORIENTATION_VERTICAL);

Expand Down Expand Up @@ -220,8 +218,6 @@ caja_sidebar_title_class_init (CajaSidebarTitleClass *klass)
"Color used for information text against a light background",
GDK_TYPE_RGBA,
G_PARAM_READABLE));

g_type_class_add_private (klass, sizeof (CajaSidebarTitleDetails));
}

/* return a new index title object */
Expand Down
4 changes: 2 additions & 2 deletions src/caja-sidebar-title.h
Expand Up @@ -45,12 +45,12 @@
#define CAJA_SIDEBAR_TITLE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_SIDEBAR_TITLE, CajaSidebarTitleClass))

typedef struct CajaSidebarTitleDetails CajaSidebarTitleDetails;
typedef struct _CajaSidebarTitlePrivate CajaSidebarTitlePrivate;

typedef struct
{
GtkBox box;
CajaSidebarTitleDetails *details;
CajaSidebarTitlePrivate *details;
} CajaSidebarTitle;

typedef struct
Expand Down
8 changes: 3 additions & 5 deletions src/caja-trash-bar.c
Expand Up @@ -42,7 +42,7 @@ enum
NUM_PROPERTIES
};

struct CajaTrashBarPrivate
struct _CajaTrashBarPrivate
{
GtkWidget *empty_button;
GtkWidget *restore_button;
Expand All @@ -51,7 +51,7 @@ struct CajaTrashBarPrivate
gulong selection_handler_id;
};

G_DEFINE_TYPE (CajaTrashBar, caja_trash_bar, GTK_TYPE_BOX);
G_DEFINE_TYPE_WITH_PRIVATE (CajaTrashBar, caja_trash_bar, GTK_TYPE_BOX);

static void
restore_button_clicked_cb (GtkWidget *button,
Expand Down Expand Up @@ -163,8 +163,6 @@ caja_trash_bar_class_init (CajaTrashBarClass *klass)
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));

g_type_class_add_private (klass, sizeof (CajaTrashBarPrivate));
}

static void
Expand All @@ -183,7 +181,7 @@ caja_trash_bar_init (CajaTrashBar *bar)
GtkWidget *label;
GtkWidget *hbox;

bar->priv = CAJA_TRASH_BAR_GET_PRIVATE (bar);
bar->priv = caja_trash_bar_get_instance_private (bar);

hbox = GTK_WIDGET (bar);

Expand Down
29 changes: 12 additions & 17 deletions src/caja-trash-bar.h
Expand Up @@ -27,9 +27,7 @@

#include <gtk/gtk.h>

#ifdef __cplusplus
extern "C" {
#endif
G_BEGIN_DECLS

#define CAJA_TYPE_TRASH_BAR (caja_trash_bar_get_type ())
#define CAJA_TRASH_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CAJA_TYPE_TRASH_BAR, CajaTrashBar))
Expand All @@ -38,27 +36,24 @@ extern "C" {
#define CAJA_IS_TRASH_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CAJA_TYPE_TRASH_BAR))
#define CAJA_TRASH_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CAJA_TYPE_TRASH_BAR, CajaTrashBarClass))

typedef struct CajaTrashBarPrivate CajaTrashBarPrivate;
typedef struct _CajaTrashBarPrivate CajaTrashBarPrivate;

typedef struct
{
typedef struct
{
GtkBox box;
CajaTrashBarPrivate *priv;
} CajaTrashBar;
} CajaTrashBar;

typedef struct
{
GtkBoxClass parent_class;
typedef struct
{
GtkBoxClass parent_class;

} CajaTrashBarClass;
} CajaTrashBarClass;

GType caja_trash_bar_get_type (void) G_GNUC_CONST;
GType caja_trash_bar_get_type (void) G_GNUC_CONST;

GtkWidget *caja_trash_bar_new (CajaWindow *window);
GtkWidget *caja_trash_bar_new (CajaWindow *window);


#ifdef __cplusplus
}
#endif
G_END_DECLS

#endif /* __GS_TRASH_BAR_H */
4 changes: 2 additions & 2 deletions src/caja-window-private.h
Expand Up @@ -40,7 +40,7 @@
struct _CajaNavigationWindowPane;

/* FIXME bugzilla.gnome.org 42575: Migrate more fields into here. */
struct CajaWindowDetails
struct _CajaWindowPrivate
{
GtkWidget *grid;

Expand Down Expand Up @@ -91,7 +91,7 @@ struct CajaWindowDetails
gboolean initiated_unmount;
};

struct _CajaNavigationWindowDetails
struct _CajaNavigationWindowPrivate
{
GtkWidget *content_paned;
GtkWidget *content_box;
Expand Down
7 changes: 2 additions & 5 deletions src/caja-window.c
Expand Up @@ -100,6 +100,7 @@ static void action_view_as_callback (GtkAction *action,
static GList *history_list;

G_DEFINE_TYPE_WITH_CODE (CajaWindow, caja_window, GTK_TYPE_WINDOW,
G_ADD_PRIVATE (CajaWindow)
G_IMPLEMENT_INTERFACE (CAJA_TYPE_WINDOW_INFO,
caja_window_info_iface_init));

Expand Down Expand Up @@ -152,7 +153,7 @@ caja_window_init (CajaWindow *window)
}

g_object_unref (provider);
window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_WINDOW, CajaWindowDetails);
window->details = caja_window_get_instance_private (window);

window->details->panes = NULL;
window->details->active_pane = NULL;
Expand Down Expand Up @@ -2186,8 +2187,4 @@ caja_window_class_init (CajaWindowClass *class)

class->reload = caja_window_reload;
class->go_up = caja_window_go_up_signal;



g_type_class_add_private (G_OBJECT_CLASS (class), sizeof (CajaWindowDetails));
}
4 changes: 2 additions & 2 deletions src/caja-window.h
Expand Up @@ -79,7 +79,7 @@ enum CajaWindowOpenSlotFlags
CAJA_WINDOW_OPEN_SLOT_APPEND = 1
};

typedef struct CajaWindowDetails CajaWindowDetails;
typedef struct _CajaWindowPrivate CajaWindowPrivate;

typedef struct
{
Expand Down Expand Up @@ -120,7 +120,7 @@ struct CajaWindow
{
GtkWindow parent_object;

CajaWindowDetails *details;
CajaWindowPrivate *details;

CajaApplication *application;
};
Expand Down
12 changes: 4 additions & 8 deletions src/caja-zoom-action.c
Expand Up @@ -33,16 +33,12 @@
#include <gtk/gtk.h>
#include <eel/eel-gtk-extensions.h>

G_DEFINE_TYPE (CajaZoomAction, caja_zoom_action, GTK_TYPE_ACTION)

static void caja_zoom_action_init (CajaZoomAction *action);
static void caja_zoom_action_class_init (CajaZoomActionClass *class);

static GObjectClass *parent_class = NULL;

#define CAJA_ZOOM_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), CAJA_TYPE_ZOOM_ACTION, CajaZoomActionPrivate))

struct CajaZoomActionPrivate
struct _CajaZoomActionPrivate
{
CajaNavigationWindow *window;
};
Expand All @@ -53,6 +49,8 @@ enum
PROP_WINDOW
};

G_DEFINE_TYPE_WITH_PRIVATE (CajaZoomAction, caja_zoom_action, GTK_TYPE_ACTION)

static void
zoom_changed_callback (CajaWindow *window,
CajaZoomLevel zoom_level,
Expand Down Expand Up @@ -199,12 +197,10 @@ caja_zoom_action_class_init (CajaZoomActionClass *class)
"The navigation window",
G_TYPE_OBJECT,
G_PARAM_READWRITE));

g_type_class_add_private (object_class, sizeof(CajaZoomActionPrivate));
}

static void
caja_zoom_action_init (CajaZoomAction *action)
{
action->priv = CAJA_ZOOM_ACTION_GET_PRIVATE (action);
action->priv = caja_zoom_action_get_instance_private (action);
}
2 changes: 1 addition & 1 deletion src/caja-zoom-action.h
Expand Up @@ -37,7 +37,7 @@

typedef struct _CajaZoomAction CajaZoomAction;
typedef struct _CajaZoomActionClass CajaZoomActionClass;
typedef struct CajaZoomActionPrivate CajaZoomActionPrivate;
typedef struct _CajaZoomActionPrivate CajaZoomActionPrivate;

struct _CajaZoomAction
{
Expand Down

0 comments on commit e8f124d

Please sign in to comment.