hotplug-sniffer: Modernize GObject usage
This commit is contained in:
parent
a539e6236a
commit
ede81017ec
@ -43,8 +43,6 @@
|
||||
#define DIRECTORY_LOAD_ITEMS_PER_CALLBACK 100
|
||||
#define HIGH_SCORE_RATIO 0.10
|
||||
|
||||
G_DEFINE_TYPE (ShellMimeSniffer, shell_mime_sniffer, G_TYPE_OBJECT);
|
||||
|
||||
enum {
|
||||
PROP_FILE = 1,
|
||||
NUM_PROPERTIES
|
||||
@ -72,6 +70,15 @@ typedef struct {
|
||||
gint total_items;
|
||||
} DeepCountState;
|
||||
|
||||
typedef struct _ShellMimeSnifferPrivate ShellMimeSnifferPrivate;
|
||||
|
||||
struct _ShellMimeSniffer
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
ShellMimeSnifferPrivate *priv;
|
||||
};
|
||||
|
||||
struct _ShellMimeSnifferPrivate {
|
||||
GFile *file;
|
||||
|
||||
@ -82,6 +89,8 @@ struct _ShellMimeSnifferPrivate {
|
||||
gchar **sniffed_mime;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellMimeSniffer, shell_mime_sniffer, G_TYPE_OBJECT);
|
||||
|
||||
static void deep_count_load (DeepCountState *state,
|
||||
GFile *file);
|
||||
|
||||
@ -550,17 +559,13 @@ shell_mime_sniffer_class_init (ShellMimeSnifferClass *klass)
|
||||
G_TYPE_FILE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellMimeSnifferPrivate));
|
||||
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_mime_sniffer_init (ShellMimeSniffer *self)
|
||||
{
|
||||
self->priv =
|
||||
G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
SHELL_TYPE_MIME_SNIFFER,
|
||||
ShellMimeSnifferPrivate);
|
||||
self->priv = shell_mime_sniffer_get_instance_private (self);
|
||||
init_mimetypes ();
|
||||
}
|
||||
|
||||
|
@ -27,30 +27,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SHELL_TYPE_MIME_SNIFFER (shell_mime_sniffer_get_type ())
|
||||
#define SHELL_MIME_SNIFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_MIME_SNIFFER, ShellMimeSniffer))
|
||||
#define SHELL_IS_MIME_SNIFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_MIME_SNIFFER))
|
||||
#define SHELL_MIME_SNIFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_MIME_SNIFFER, ShellMimeSnifferClass))
|
||||
#define SHELL_IS_MIME_SNIFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_MIME_SNIFFER))
|
||||
#define SHELL_MIME_SNIFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_MIME_SNIFFER, ShellMimeSnifferClass))
|
||||
|
||||
typedef struct _ShellMimeSniffer ShellMimeSniffer;
|
||||
typedef struct _ShellMimeSnifferPrivate ShellMimeSnifferPrivate;
|
||||
typedef struct _ShellMimeSnifferClass ShellMimeSnifferClass;
|
||||
|
||||
struct _ShellMimeSniffer
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
ShellMimeSnifferPrivate *priv;
|
||||
};
|
||||
|
||||
struct _ShellMimeSnifferClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType shell_mime_sniffer_get_type (void) G_GNUC_CONST;
|
||||
#define SHELL_TYPE_MIME_SNIFFER (shell_mime_sniffer_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (ShellMimeSniffer, shell_mime_sniffer,
|
||||
SHELL, MIME_SNIFFER, GObject)
|
||||
|
||||
ShellMimeSniffer *shell_mime_sniffer_new (GFile *file);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user