meta-plugin: Remove some unused features
And don't use properties for no reason.
This commit is contained in:
@ -100,7 +100,9 @@ meta_plugin_manager_new (MetaScreen *screen)
|
|||||||
|
|
||||||
plugin_mgr = g_new0 (MetaPluginManager, 1);
|
plugin_mgr = g_new0 (MetaPluginManager, 1);
|
||||||
plugin_mgr->screen = screen;
|
plugin_mgr->screen = screen;
|
||||||
plugin_mgr->plugin = plugin = g_object_new (plugin_type, "screen", screen, NULL);
|
plugin_mgr->plugin = plugin = g_object_new (plugin_type, NULL);
|
||||||
|
|
||||||
|
_meta_plugin_set_screen (plugin, screen);
|
||||||
|
|
||||||
klass = META_PLUGIN_GET_CLASS (plugin);
|
klass = META_PLUGIN_GET_CLASS (plugin);
|
||||||
|
|
||||||
@ -165,8 +167,6 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
|
|||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
||||||
actor);
|
actor);
|
||||||
|
|
||||||
_meta_plugin_effect_started (plugin);
|
|
||||||
klass->minimize (plugin, actor);
|
klass->minimize (plugin, actor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -176,8 +176,6 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
|
|||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
||||||
actor);
|
actor);
|
||||||
|
|
||||||
_meta_plugin_effect_started (plugin);
|
|
||||||
klass->map (plugin, actor);
|
klass->map (plugin, actor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -185,7 +183,6 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
|
|||||||
if (klass->destroy)
|
if (klass->destroy)
|
||||||
{
|
{
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
_meta_plugin_effect_started (plugin);
|
|
||||||
klass->destroy (plugin, actor);
|
klass->destroy (plugin, actor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -230,8 +227,6 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr,
|
|||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
||||||
actor);
|
actor);
|
||||||
|
|
||||||
_meta_plugin_effect_started (plugin);
|
|
||||||
klass->maximize (plugin, actor,
|
klass->maximize (plugin, actor,
|
||||||
target_x, target_y,
|
target_x, target_y,
|
||||||
target_width, target_height);
|
target_width, target_height);
|
||||||
@ -243,8 +238,6 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr,
|
|||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
meta_plugin_manager_kill_window_effects (plugin_mgr,
|
||||||
actor);
|
actor);
|
||||||
|
|
||||||
_meta_plugin_effect_started (plugin);
|
|
||||||
klass->unmaximize (plugin, actor,
|
klass->unmaximize (plugin, actor,
|
||||||
target_x, target_y,
|
target_x, target_y,
|
||||||
target_width, target_height);
|
target_width, target_height);
|
||||||
@ -283,8 +276,6 @@ meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
|
|||||||
{
|
{
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
meta_plugin_manager_kill_switch_workspace (plugin_mgr);
|
meta_plugin_manager_kill_switch_workspace (plugin_mgr);
|
||||||
|
|
||||||
_meta_plugin_effect_started (plugin);
|
|
||||||
klass->switch_workspace (plugin, from, to, direction);
|
klass->switch_workspace (plugin, from, to, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,91 +47,15 @@ G_DEFINE_ABSTRACT_TYPE (MetaPlugin, meta_plugin, G_TYPE_OBJECT);
|
|||||||
#define META_PLUGIN_GET_PRIVATE(obj) \
|
#define META_PLUGIN_GET_PRIVATE(obj) \
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate))
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PROP_0,
|
|
||||||
PROP_SCREEN,
|
|
||||||
PROP_DEBUG_MODE,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MetaPluginPrivate
|
struct _MetaPluginPrivate
|
||||||
{
|
{
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
|
|
||||||
gint running;
|
|
||||||
gboolean debug : 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
meta_plugin_set_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
MetaPluginPrivate *priv = META_PLUGIN (object)->priv;
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_SCREEN:
|
|
||||||
priv->screen = g_value_get_object (value);
|
|
||||||
break;
|
|
||||||
case PROP_DEBUG_MODE:
|
|
||||||
priv->debug = g_value_get_boolean (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_plugin_get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
MetaPluginPrivate *priv = META_PLUGIN (object)->priv;
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_SCREEN:
|
|
||||||
g_value_set_object (value, priv->screen);
|
|
||||||
break;
|
|
||||||
case PROP_DEBUG_MODE:
|
|
||||||
g_value_set_boolean (value, priv->debug);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_plugin_class_init (MetaPluginClass *klass)
|
meta_plugin_class_init (MetaPluginClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
g_type_class_add_private (klass, sizeof (MetaPluginPrivate));
|
||||||
|
|
||||||
gobject_class->set_property = meta_plugin_set_property;
|
|
||||||
gobject_class->get_property = meta_plugin_get_property;
|
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
|
||||||
PROP_SCREEN,
|
|
||||||
g_param_spec_object ("screen",
|
|
||||||
"MetaScreen",
|
|
||||||
"MetaScreen",
|
|
||||||
META_TYPE_SCREEN,
|
|
||||||
G_PARAM_READWRITE));
|
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
|
||||||
PROP_DEBUG_MODE,
|
|
||||||
g_param_spec_boolean ("debug-mode",
|
|
||||||
"Debug Mode",
|
|
||||||
"Debug Mode",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE));
|
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof (MetaPluginPrivate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -140,22 +64,6 @@ meta_plugin_init (MetaPlugin *self)
|
|||||||
self->priv = META_PLUGIN_GET_PRIVATE (self);
|
self->priv = META_PLUGIN_GET_PRIVATE (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_plugin_running (MetaPlugin *plugin)
|
|
||||||
{
|
|
||||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
|
||||||
|
|
||||||
return (priv->running > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_plugin_debug_mode (MetaPlugin *plugin)
|
|
||||||
{
|
|
||||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
|
||||||
|
|
||||||
return priv->debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MetaPluginInfo *
|
const MetaPluginInfo *
|
||||||
meta_plugin_get_info (MetaPlugin *plugin)
|
meta_plugin_get_info (MetaPlugin *plugin)
|
||||||
{
|
{
|
||||||
@ -167,21 +75,6 @@ meta_plugin_get_info (MetaPlugin *plugin)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* _meta_plugin_effect_started:
|
|
||||||
* @plugin: the plugin
|
|
||||||
*
|
|
||||||
* Mark that an effect has started for the plugin. This is called
|
|
||||||
* internally by MetaPluginManager.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_meta_plugin_effect_started (MetaPlugin *plugin)
|
|
||||||
{
|
|
||||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
|
||||||
|
|
||||||
priv->running++;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_meta_plugin_xevent_filter (MetaPlugin *plugin,
|
_meta_plugin_xevent_filter (MetaPlugin *plugin,
|
||||||
XEvent *xev)
|
XEvent *xev)
|
||||||
@ -208,15 +101,8 @@ void
|
|||||||
meta_plugin_switch_workspace_completed (MetaPlugin *plugin)
|
meta_plugin_switch_workspace_completed (MetaPlugin *plugin)
|
||||||
{
|
{
|
||||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||||
|
|
||||||
MetaScreen *screen = priv->screen;
|
MetaScreen *screen = priv->screen;
|
||||||
|
|
||||||
if (priv->running-- < 0)
|
|
||||||
{
|
|
||||||
g_warning ("Error in running effect accounting, adjusting.");
|
|
||||||
priv->running = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_switch_workspace_completed (screen);
|
meta_switch_workspace_completed (screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,26 +111,6 @@ meta_plugin_window_effect_completed (MetaPlugin *plugin,
|
|||||||
MetaWindowActor *actor,
|
MetaWindowActor *actor,
|
||||||
unsigned long event)
|
unsigned long event)
|
||||||
{
|
{
|
||||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
|
||||||
|
|
||||||
if (priv->running-- < 0)
|
|
||||||
{
|
|
||||||
g_warning ("Error in running effect accounting, adjusting.");
|
|
||||||
priv->running = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!actor)
|
|
||||||
{
|
|
||||||
const MetaPluginInfo *info;
|
|
||||||
const gchar *name = NULL;
|
|
||||||
|
|
||||||
if (plugin && (info = meta_plugin_get_info (plugin)))
|
|
||||||
name = info->name;
|
|
||||||
|
|
||||||
g_warning ("Plugin [%s] passed NULL for actor!",
|
|
||||||
name ? name : "unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_window_actor_effect_completed (actor, event);
|
meta_window_actor_effect_completed (actor, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,9 +205,7 @@ meta_plugin_end_modal (MetaPlugin *plugin,
|
|||||||
* meta_plugin_get_screen:
|
* meta_plugin_get_screen:
|
||||||
* @plugin: a #MetaPlugin
|
* @plugin: a #MetaPlugin
|
||||||
*
|
*
|
||||||
* Gets the #MetaScreen corresponding to a plugin. Each plugin instance
|
* Gets the #MetaScreen corresponding to a plugin.
|
||||||
* is associated with exactly one screen; if Metacity is managing
|
|
||||||
* multiple screens, multiple plugin instances will be created.
|
|
||||||
*
|
*
|
||||||
* Return value: (transfer none): the #MetaScreen for the plugin
|
* Return value: (transfer none): the #MetaScreen for the plugin
|
||||||
*/
|
*/
|
||||||
@ -353,6 +217,15 @@ meta_plugin_get_screen (MetaPlugin *plugin)
|
|||||||
return priv->screen;
|
return priv->screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_meta_plugin_set_screen (MetaPlugin *plugin,
|
||||||
|
MetaScreen *screen)
|
||||||
|
{
|
||||||
|
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||||
|
|
||||||
|
priv->screen = screen;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_plugin_complete_display_change (MetaPlugin *plugin,
|
meta_plugin_complete_display_change (MetaPlugin *plugin,
|
||||||
gboolean ok)
|
gboolean ok)
|
||||||
|
@ -254,9 +254,6 @@ struct _MetaPluginInfo
|
|||||||
|
|
||||||
GType meta_plugin_get_type (void);
|
GType meta_plugin_get_type (void);
|
||||||
|
|
||||||
gboolean meta_plugin_running (MetaPlugin *plugin);
|
|
||||||
gboolean meta_plugin_debug_mode (MetaPlugin *plugin);
|
|
||||||
|
|
||||||
const MetaPluginInfo * meta_plugin_get_info (MetaPlugin *plugin);
|
const MetaPluginInfo * meta_plugin_get_info (MetaPlugin *plugin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -408,8 +405,7 @@ meta_plugin_end_modal (MetaPlugin *plugin,
|
|||||||
|
|
||||||
MetaScreen *meta_plugin_get_screen (MetaPlugin *plugin);
|
MetaScreen *meta_plugin_get_screen (MetaPlugin *plugin);
|
||||||
|
|
||||||
void
|
void _meta_plugin_set_screen (MetaPlugin *plugin, MetaScreen *screen);
|
||||||
_meta_plugin_effect_started (MetaPlugin *plugin);
|
|
||||||
|
|
||||||
/* XXX: Putting this in here so it's in the public header. */
|
/* XXX: Putting this in here so it's in the public header. */
|
||||||
void meta_plugin_manager_set_plugin_type (GType gtype);
|
void meta_plugin_manager_set_plugin_type (GType gtype);
|
||||||
|
Reference in New Issue
Block a user