Commit 9447578b authored by Martin Blanchard's avatar Martin Blanchard Committed by Cosimo Cecchi

Replace usage of deprecated g_type_class_add_private()

Stop declaring privates with g_type_class_add_private() and use the
G_DECLARE_FINAL_TYPE() / G_DEFINE_TYPE_WITH_PRIVATE() pair.
parent 24a144cb
......@@ -43,7 +43,7 @@
#include "font-utils.h"
#include "sushi-font-loader.h"
struct _FontViewModelPrivate {
typedef struct {
/* list of fonts in fontconfig database */
FcFontSet *font_list;
GMutex font_list_mutex;
......@@ -56,6 +56,13 @@ struct _FontViewModelPrivate {
gint scale_factor;
guint font_list_idle_id;
guint fontconfig_update_id;
} FontViewModelPrivate;
struct _FontViewModel
{
GtkListStore parent_instance;
FontViewModelPrivate *priv;
};
enum {
......@@ -65,7 +72,8 @@ enum {
static guint signals[NUM_SIGNALS] = { 0, };
G_DEFINE_TYPE (FontViewModel, font_view_model, GTK_TYPE_LIST_STORE);
G_DEFINE_TYPE_WITH_PRIVATE (FontViewModel, font_view_model,
GTK_TYPE_LIST_STORE)
#define ATTRIBUTES_FOR_CREATING_THUMBNAIL \
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE"," \
......@@ -651,8 +659,6 @@ font_view_model_class_init (FontViewModelClass *klass)
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_type_class_add_private (klass, sizeof (FontViewModelPrivate));
}
GtkTreeModel *
......
......@@ -39,23 +39,14 @@ typedef enum {
NUM_COLUMNS
} FontViewModelColumns;
typedef struct _FontViewModelPrivate FontViewModelPrivate;
#define FONT_VIEW_TYPE_MODEL (font_view_model_get_type ())
#define FONT_VIEW_TYPE_MODEL font_view_model_get_type()
#define FONT_VIEW_MODEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_VIEW_TYPE_MODEL, FontViewModel))
typedef struct {
GtkListStore parent;
FontViewModelPrivate *priv;
} FontViewModel;
typedef struct {
GtkListStoreClass parent_class;
} FontViewModelClass;
G_DECLARE_FINAL_TYPE (FontViewModel, font_view_model,
FONT_VIEW, MODEL,
GtkListStore)
GType font_view_model_get_type (void);
GtkTreeModel * font_view_model_new (void);
gboolean font_view_model_get_iter_for_face (FontViewModel *self,
......
......@@ -41,13 +41,14 @@
#include "font-model.h"
#include "sushi-font-widget.h"
#define FONT_VIEW_TYPE_APPLICATION font_view_application_get_type()
#define FONT_VIEW_APPLICATION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_VIEW_TYPE_APPLICATION, FontViewApplication))
#define FONT_VIEW_TYPE_APPLICATION (font_view_application_get_type ())
#define FONT_VIEW_ICON_NAME "org.gnome.font-viewer"
typedef struct {
G_DECLARE_FINAL_TYPE (FontViewApplication, sushi_font_widget,
FONT_VIEW, APPLICATION,
GtkApplication)
struct _FontViewApplication {
GtkApplication parent;
GtkWidget *main_window;
......@@ -72,11 +73,7 @@ typedef struct {
GtkTreeModel *filter_model;
GFile *font_file;
} FontViewApplication;
typedef struct {
GtkApplicationClass parent_class;
} FontViewApplicationClass;
};
static gboolean
_print_version_and_exit (const gchar *option_name,
......@@ -96,7 +93,8 @@ static const GOptionEntry goption_options[] =
{ NULL }
};
G_DEFINE_TYPE (FontViewApplication, font_view_application, GTK_TYPE_APPLICATION);
G_DEFINE_TYPE (FontViewApplication, font_view_application,
GTK_TYPE_APPLICATION)
static void font_view_application_do_overview (FontViewApplication *self);
static void ensure_window (FontViewApplication *self);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment