diff --git a/src/core/screen.c b/src/core/screen.c index b44a3adf9..46daa5a00 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -69,8 +69,50 @@ static void meta_screen_sn_event (SnMonitorEvent *event, void *user_data); #endif +enum +{ + PROP_N_WORKSPACES = 1 +}; + G_DEFINE_TYPE (MetaScreen, meta_screen, G_TYPE_OBJECT); +static void +meta_screen_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ +#if 0 + MetaScreen *screen = META_SCREEN (object); +#endif + + switch (prop_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +meta_screen_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MetaScreen *screen = META_SCREEN (object); + + switch (prop_id) + { + case PROP_N_WORKSPACES: + g_value_set_int (value, meta_screen_get_n_workspaces (screen)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + static void meta_screen_finalize (GObject *object) { @@ -81,8 +123,21 @@ static void meta_screen_class_init (MetaScreenClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + GParamSpec *pspec; + object_class->get_property = meta_screen_get_property; + object_class->set_property = meta_screen_set_property; object_class->finalize = meta_screen_finalize; + + pspec = g_param_spec_int ("n-workspaces", + "N Workspaces", + "Number of workspaces", + 1, G_MAXINT, 1, + G_PARAM_READABLE); + + g_object_class_install_property (object_class, + PROP_N_WORKSPACES, + pspec); } static void @@ -1169,6 +1224,8 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace, set_number_of_spaces_hint (screen, g_list_length (screen->workspaces)); meta_screen_queue_workarea_recalc (screen); + + g_object_notify (G_OBJECT (screen), "n-workspaces"); } MetaWorkspace * @@ -1190,6 +1247,8 @@ meta_screen_append_new_workspace (MetaScreen *screen, gboolean activate, meta_screen_queue_workarea_recalc (screen); + g_object_notify (G_OBJECT (screen), "n-workspaces"); + return w; } @@ -1274,6 +1333,8 @@ update_num_workspaces (MetaScreen *screen, set_number_of_spaces_hint (screen, new_num); meta_screen_queue_workarea_recalc (screen); + + g_object_notify (G_OBJECT (screen), "n-workspaces"); } static void