shell: Use G_DEFINE_TYPE_WITH_PRIVATE() and friends
This commit is contained in:
parent
ffe4eaf00d
commit
e25502aeb2
@ -45,7 +45,7 @@ struct _ShellAppSystemPrivate {
|
||||
|
||||
static void shell_app_system_finalize (GObject *object);
|
||||
|
||||
G_DEFINE_TYPE(ShellAppSystem, shell_app_system, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellAppSystem, shell_app_system, G_TYPE_OBJECT);
|
||||
|
||||
static void shell_app_system_class_init(ShellAppSystemClass *klass)
|
||||
{
|
||||
@ -67,8 +67,6 @@ static void shell_app_system_class_init(ShellAppSystemClass *klass)
|
||||
G_STRUCT_OFFSET (ShellAppSystemClass, installed_changed),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (ShellAppSystemPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -147,9 +145,7 @@ shell_app_system_init (ShellAppSystem *self)
|
||||
ShellAppSystemPrivate *priv;
|
||||
GAppInfoMonitor *monitor;
|
||||
|
||||
self->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
SHELL_TYPE_APP_SYSTEM,
|
||||
ShellAppSystemPrivate);
|
||||
self->priv = priv = shell_app_system_get_instance_private (self);
|
||||
|
||||
priv->running_apps = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
|
||||
priv->id_to_app = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
|
@ -23,8 +23,6 @@
|
||||
* - Actor is mapped [actor and all parents visible, actor in stage]
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE (ShellEmbeddedWindow, shell_embedded_window, GTK_TYPE_WINDOW);
|
||||
|
||||
enum {
|
||||
PROP_0
|
||||
};
|
||||
@ -35,6 +33,10 @@ struct _ShellEmbeddedWindowPrivate {
|
||||
GdkRectangle position;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellEmbeddedWindow,
|
||||
shell_embedded_window,
|
||||
GTK_TYPE_WINDOW);
|
||||
|
||||
/*
|
||||
* The normal gtk_window_show() starts all of the complicated asynchronous
|
||||
* window resizing code running; we don't want or need any of that.
|
||||
@ -134,8 +136,6 @@ shell_embedded_window_class_init (ShellEmbeddedWindowClass *klass)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellEmbeddedWindowPrivate));
|
||||
|
||||
object_class->constructor = shell_embedded_window_constructor;
|
||||
|
||||
widget_class->show = shell_embedded_window_show;
|
||||
@ -148,8 +148,7 @@ shell_embedded_window_class_init (ShellEmbeddedWindowClass *klass)
|
||||
static void
|
||||
shell_embedded_window_init (ShellEmbeddedWindow *window)
|
||||
{
|
||||
window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, SHELL_TYPE_EMBEDDED_WINDOW,
|
||||
ShellEmbeddedWindowPrivate);
|
||||
window->priv = shell_embedded_window_get_instance_private (window);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -23,16 +23,17 @@
|
||||
|
||||
static void shell_generic_container_iface_init (ClutterContainerIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(ShellGenericContainer,
|
||||
shell_generic_container,
|
||||
ST_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
|
||||
shell_generic_container_iface_init));
|
||||
|
||||
struct _ShellGenericContainerPrivate {
|
||||
GHashTable *skip_paint;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(ShellGenericContainer,
|
||||
shell_generic_container,
|
||||
ST_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (ShellGenericContainer)
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
|
||||
shell_generic_container_iface_init));
|
||||
|
||||
/* Signals */
|
||||
enum
|
||||
{
|
||||
@ -385,8 +386,6 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, CLUTTER_TYPE_ACTOR_BOX, CLUTTER_TYPE_ALLOCATION_FLAGS);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (ShellGenericContainerPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -407,8 +406,7 @@ shell_generic_container_iface_init (ClutterContainerIface *iface)
|
||||
static void
|
||||
shell_generic_container_init (ShellGenericContainer *area)
|
||||
{
|
||||
area->priv = G_TYPE_INSTANCE_GET_PRIVATE (area, SHELL_TYPE_GENERIC_CONTAINER,
|
||||
ShellGenericContainerPrivate);
|
||||
area->priv = shell_generic_container_get_instance_private (area);
|
||||
area->priv->skip_paint = g_hash_table_new (NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
#include <cogl/cogl.h>
|
||||
#include "shell-glsl-quad.h"
|
||||
|
||||
G_DEFINE_TYPE (ShellGLSLQuad, shell_glsl_quad, CLUTTER_TYPE_ACTOR);
|
||||
|
||||
struct _ShellGLSLQuadPrivate
|
||||
{
|
||||
CoglPipeline *pipeline;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellGLSLQuad, shell_glsl_quad, CLUTTER_TYPE_ACTOR);
|
||||
|
||||
static gboolean
|
||||
shell_glsl_quad_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
@ -116,7 +116,7 @@ shell_glsl_quad_dispose (GObject *gobject)
|
||||
static void
|
||||
shell_glsl_quad_init (ShellGLSLQuad *quad)
|
||||
{
|
||||
quad->priv = G_TYPE_INSTANCE_GET_PRIVATE (quad, SHELL_TYPE_GLSL_QUAD, ShellGLSLQuadPrivate);
|
||||
quad->priv = shell_glsl_quad_get_instance_private (quad);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -161,8 +161,6 @@ shell_glsl_quad_class_init (ShellGLSLQuadClass *klass)
|
||||
|
||||
actor_class->get_paint_volume = shell_glsl_quad_get_paint_volume;
|
||||
actor_class->paint = shell_glsl_quad_paint;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellGLSLQuadPrivate));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ struct _ShellGtkEmbedPrivate
|
||||
guint window_created_handler;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ShellGtkEmbed, shell_gtk_embed, CLUTTER_TYPE_CLONE);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellGtkEmbed, shell_gtk_embed, CLUTTER_TYPE_CLONE);
|
||||
|
||||
static void shell_gtk_embed_set_window (ShellGtkEmbed *embed,
|
||||
ShellEmbeddedWindow *window);
|
||||
@ -327,8 +327,6 @@ shell_gtk_embed_class_init (ShellGtkEmbedClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellGtkEmbedPrivate));
|
||||
|
||||
object_class->get_property = shell_gtk_embed_get_property;
|
||||
object_class->set_property = shell_gtk_embed_set_property;
|
||||
object_class->dispose = shell_gtk_embed_dispose;
|
||||
@ -351,8 +349,7 @@ shell_gtk_embed_class_init (ShellGtkEmbedClass *klass)
|
||||
static void
|
||||
shell_gtk_embed_init (ShellGtkEmbed *embed)
|
||||
{
|
||||
embed->priv = G_TYPE_INSTANCE_GET_PRIVATE (embed, SHELL_TYPE_GTK_EMBED,
|
||||
ShellGtkEmbedPrivate);
|
||||
embed->priv = shell_gtk_embed_get_instance_private (embed);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -33,7 +33,6 @@
|
||||
* the GPid array to JS).
|
||||
* See https://bugzilla.gnome.org/show_bug.cgi?id=645978
|
||||
*/
|
||||
G_DEFINE_TYPE (ShellMountOperation, shell_mount_operation, G_TYPE_MOUNT_OPERATION);
|
||||
|
||||
enum {
|
||||
SHOW_PROCESSES_2,
|
||||
@ -48,11 +47,12 @@ struct _ShellMountOperationPrivate {
|
||||
gchar *message;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellMountOperation, shell_mount_operation, G_TYPE_MOUNT_OPERATION);
|
||||
|
||||
static void
|
||||
shell_mount_operation_init (ShellMountOperation *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, SHELL_TYPE_MOUNT_OPERATION,
|
||||
ShellMountOperationPrivate);
|
||||
self->priv = shell_mount_operation_get_instance_private (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -135,8 +135,6 @@ shell_mount_operation_class_init (ShellMountOperationClass *klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellMountOperationPrivate));
|
||||
}
|
||||
|
||||
GMountOperation *
|
||||
|
@ -60,7 +60,7 @@ struct _ShellNetworkAgentPrivate {
|
||||
GHashTable *requests;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ShellNetworkAgent, shell_network_agent, NM_TYPE_SECRET_AGENT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellNetworkAgent, shell_network_agent, NM_TYPE_SECRET_AGENT)
|
||||
|
||||
static const SecretSchema network_agent_schema = {
|
||||
"org.freedesktop.NetworkManager.Connection",
|
||||
@ -114,8 +114,7 @@ shell_network_agent_init (ShellNetworkAgent *agent)
|
||||
{
|
||||
ShellNetworkAgentPrivate *priv;
|
||||
|
||||
priv = agent->priv = G_TYPE_INSTANCE_GET_PRIVATE (agent, SHELL_TYPE_NETWORK_AGENT, ShellNetworkAgentPrivate);
|
||||
|
||||
priv = agent->priv = shell_network_agent_get_instance_private (agent);
|
||||
priv->requests = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, shell_agent_request_free);
|
||||
}
|
||||
@ -853,6 +852,4 @@ shell_network_agent_class_init (ShellNetworkAgentClass *klass)
|
||||
G_TYPE_NONE,
|
||||
1, /* n_params */
|
||||
G_TYPE_STRING);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellNetworkAgentPrivate));
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include <telepathy-glib/telepathy-glib.h>
|
||||
|
||||
G_DEFINE_TYPE(ShellTpClient, shell_tp_client, TP_TYPE_BASE_CLIENT)
|
||||
|
||||
struct _ShellTpClientPrivate
|
||||
{
|
||||
ShellTpClientObserveChannelsImpl observe_impl;
|
||||
@ -23,6 +21,8 @@ struct _ShellTpClientPrivate
|
||||
GDestroyNotify destroy_handle_channels;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellTpClient, shell_tp_client, TP_TYPE_BASE_CLIENT)
|
||||
|
||||
/**
|
||||
* ShellTpClientObserveChannelsImpl:
|
||||
* @client: a #ShellTpClient instance
|
||||
@ -84,8 +84,7 @@ shell_tp_client_init (ShellTpClient *self)
|
||||
{
|
||||
GHashTable *filter;
|
||||
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, SHELL_TYPE_TP_CLIENT,
|
||||
ShellTpClientPrivate);
|
||||
self->priv = shell_tp_client_get_instance_private (self);
|
||||
|
||||
/* We only care about single-user text-based chats */
|
||||
filter = tp_asv_new (
|
||||
@ -198,8 +197,6 @@ shell_tp_client_class_init (ShellTpClientClass *cls)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (cls);
|
||||
TpBaseClientClass *base_clt_cls = TP_BASE_CLIENT_CLASS (cls);
|
||||
|
||||
g_type_class_add_private (cls, sizeof (ShellTpClientPrivate));
|
||||
|
||||
object_class->dispose = shell_tp_client_dispose;
|
||||
|
||||
base_clt_cls->observe_channels = observe_channels;
|
||||
|
@ -25,7 +25,7 @@ struct _ShellTrayIconPrivate
|
||||
char *title, *wm_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ShellTrayIcon, shell_tray_icon, SHELL_TYPE_GTK_EMBED);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellTrayIcon, shell_tray_icon, SHELL_TYPE_GTK_EMBED);
|
||||
|
||||
static void
|
||||
shell_tray_icon_finalize (GObject *object)
|
||||
@ -117,8 +117,6 @@ shell_tray_icon_class_init (ShellTrayIconClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellTrayIconPrivate));
|
||||
|
||||
object_class->get_property = shell_tray_icon_get_property;
|
||||
object_class->constructed = shell_tray_icon_constructed;
|
||||
object_class->finalize = shell_tray_icon_finalize;
|
||||
@ -149,8 +147,7 @@ shell_tray_icon_class_init (ShellTrayIconClass *klass)
|
||||
static void
|
||||
shell_tray_icon_init (ShellTrayIcon *icon)
|
||||
{
|
||||
icon->priv = G_TYPE_INSTANCE_GET_PRIVATE (icon, SHELL_TYPE_TRAY_ICON,
|
||||
ShellTrayIconPrivate);
|
||||
icon->priv = shell_tray_icon_get_instance_private (icon);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -43,7 +43,7 @@ enum
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ShellTrayManager, shell_tray_manager, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ShellTrayManager, shell_tray_manager, G_TYPE_OBJECT);
|
||||
|
||||
static guint shell_tray_manager_signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
@ -114,8 +114,8 @@ shell_tray_manager_get_property(GObject *object,
|
||||
static void
|
||||
shell_tray_manager_init (ShellTrayManager *manager)
|
||||
{
|
||||
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, SHELL_TYPE_TRAY_MANAGER,
|
||||
ShellTrayManagerPrivate);
|
||||
manager->priv = shell_tray_manager_get_instance_private (manager);
|
||||
|
||||
manager->priv->na_manager = na_tray_manager_new ();
|
||||
|
||||
manager->priv->icons = g_hash_table_new_full (NULL, NULL,
|
||||
@ -144,8 +144,6 @@ shell_tray_manager_class_init (ShellTrayManagerClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (ShellTrayManagerPrivate));
|
||||
|
||||
gobject_class->finalize = shell_tray_manager_finalize;
|
||||
gobject_class->set_property = shell_tray_manager_set_property;
|
||||
gobject_class->get_property = shell_tray_manager_get_property;
|
||||
|
Loading…
Reference in New Issue
Block a user