shell: Add getter/setters for all properties
Traditionally, getter/setter functions have been considered a C convenience, and we therefore didn't bother to add them for many properties that are only consumed from JS. However now that gjs optimizes property accesses by calling the appropriate getter/setter instead, it makes sense to add them. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3620>
This commit is contained in:
parent
51b5358b71
commit
01824a6d4e
@ -137,8 +137,7 @@ shell_app_get_property (GObject *gobject,
|
||||
g_value_set_object (value, shell_app_get_icon (app));
|
||||
break;
|
||||
case PROP_ACTION_GROUP:
|
||||
if (app->running_state)
|
||||
g_value_set_object (value, app->running_state->muxer);
|
||||
g_value_set_object (value, shell_app_get_action_group (app));
|
||||
break;
|
||||
case PROP_APP_INFO:
|
||||
if (app->info)
|
||||
@ -211,6 +210,21 @@ shell_app_get_icon (ShellApp *app)
|
||||
return app->fallback_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_get_action_group:
|
||||
*
|
||||
* Return value: (transfer none) (nullable):
|
||||
*/
|
||||
GActionGroup *
|
||||
shell_app_get_action_group (ShellApp *app)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_APP (app), NULL);
|
||||
|
||||
if (app->running_state)
|
||||
return G_ACTION_GROUP (app->running_state->muxer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_create_icon_texture:
|
||||
*
|
||||
|
@ -33,6 +33,8 @@ const char *shell_app_get_name (ShellApp *app);
|
||||
const char *shell_app_get_description (ShellApp *app);
|
||||
gboolean shell_app_is_window_backed (ShellApp *app);
|
||||
|
||||
GActionGroup * shell_app_get_action_group (ShellApp *app);
|
||||
|
||||
void shell_app_activate_window (ShellApp *app, MetaWindow *window, guint32 timestamp);
|
||||
|
||||
void shell_app_activate (ShellApp *app);
|
||||
|
@ -456,3 +456,10 @@ error:
|
||||
g_message ("Failed to start camera monitor");
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_camera_monitor_get_cameras_in_use (ShellCameraMonitor *monitor)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_CAMERA_MONITOR (monitor), FALSE);
|
||||
return monitor->cameras_in_use;
|
||||
}
|
||||
|
@ -29,4 +29,6 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (ShellCameraMonitor, shell_camera_monitor,
|
||||
SHELL, CAMERA_MONITOR, GObject)
|
||||
|
||||
gboolean shell_camera_monitor_get_cameras_in_use (ShellCameraMonitor *monitor);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -44,9 +44,7 @@
|
||||
#include "shell-window-tracker.h"
|
||||
#include "shell-app-usage.h"
|
||||
#include "shell-app-cache-private.h"
|
||||
#include "shell-wm.h"
|
||||
#include "shell-util.h"
|
||||
#include "st.h"
|
||||
#include "switcheroo-control.h"
|
||||
|
||||
static ShellGlobal *the_object = NULL;
|
||||
@ -226,29 +224,13 @@ shell_global_set_property(GObject *object,
|
||||
global->session_mode = g_ascii_strdown (g_value_get_string (value), -1);
|
||||
break;
|
||||
case PROP_FRAME_TIMESTAMPS:
|
||||
{
|
||||
gboolean enable = g_value_get_boolean (value);
|
||||
|
||||
if (global->frame_timestamps != enable)
|
||||
{
|
||||
global->frame_timestamps = enable;
|
||||
g_object_notify_by_pspec (object, props[PROP_FRAME_TIMESTAMPS]);
|
||||
}
|
||||
}
|
||||
shell_global_set_frame_timestamps (global, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_FRAME_FINISH_TIMESTAMP:
|
||||
{
|
||||
gboolean enable = g_value_get_boolean (value);
|
||||
|
||||
if (global->frame_finish_timestamp != enable)
|
||||
{
|
||||
global->frame_finish_timestamp = enable;
|
||||
g_object_notify_by_pspec (object, props[PROP_FRAME_FINISH_TIMESTAMP]);
|
||||
}
|
||||
}
|
||||
shell_global_set_frame_finish_timestamp (global, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_FORCE_ANIMATIONS:
|
||||
global->force_animations = g_value_get_boolean (value);
|
||||
shell_global_set_force_animations (global, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_AUTOMATION_SCRIPT:
|
||||
g_set_object (&global->automation_script, g_value_get_object (value));
|
||||
@ -288,20 +270,11 @@ shell_global_get_property(GObject *object,
|
||||
g_value_set_object (value, global->workspace_manager);
|
||||
break;
|
||||
case PROP_SCREEN_WIDTH:
|
||||
{
|
||||
int width, height;
|
||||
|
||||
meta_display_get_size (global->meta_display, &width, &height);
|
||||
g_value_set_int (value, width);
|
||||
}
|
||||
g_value_set_int (value, shell_global_get_screen_width (global));
|
||||
break;
|
||||
break;
|
||||
case PROP_SCREEN_HEIGHT:
|
||||
{
|
||||
int width, height;
|
||||
|
||||
meta_display_get_size (global->meta_display, &width, &height);
|
||||
g_value_set_int (value, height);
|
||||
}
|
||||
g_value_set_int (value, shell_global_get_screen_height (global));
|
||||
break;
|
||||
case PROP_STAGE:
|
||||
g_value_set_object (value, global->stage);
|
||||
@ -643,7 +616,7 @@ shell_global_class_init (ShellGlobalClass *klass)
|
||||
props[PROP_FORCE_ANIMATIONS] =
|
||||
g_param_spec_boolean ("force-animations", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
props[PROP_AUTOMATION_SCRIPT] =
|
||||
g_param_spec_object ("automation-script", NULL, NULL,
|
||||
@ -767,6 +740,17 @@ shell_global_get_backend (ShellGlobal *global)
|
||||
return global->backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_compositor:
|
||||
*
|
||||
* Return value: (transfer none): The #MetaCompositor
|
||||
*/
|
||||
MetaCompositor *
|
||||
shell_global_get_compositor (ShellGlobal *global)
|
||||
{
|
||||
return global->compositor;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_context:
|
||||
*
|
||||
@ -811,6 +795,28 @@ shell_global_get_workspace_manager (ShellGlobal *global)
|
||||
return global->workspace_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_window_manager:
|
||||
*
|
||||
* Return value: (transfer none): The default #ShellWM
|
||||
*/
|
||||
ShellWM *
|
||||
shell_global_get_window_manager (ShellGlobal *global)
|
||||
{
|
||||
return global->wm;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_focus_manager:
|
||||
*
|
||||
* Return value: (transfer none): The default #StFocusManager
|
||||
*/
|
||||
StFocusManager *
|
||||
shell_global_get_focus_manager (ShellGlobal *global)
|
||||
{
|
||||
return global->focus_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_window_actors:
|
||||
*
|
||||
@ -833,6 +839,46 @@ shell_global_get_window_actors (ShellGlobal *global)
|
||||
return g_list_reverse (filtered);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_window_group:
|
||||
*
|
||||
* Return value: (transfer none):
|
||||
*/
|
||||
ClutterActor *
|
||||
shell_global_get_window_group (ShellGlobal *global)
|
||||
{
|
||||
return meta_compositor_get_window_group (global->compositor);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_top_window_group:
|
||||
*
|
||||
* Return value: (transfer none):
|
||||
*/
|
||||
ClutterActor *
|
||||
shell_global_get_top_window_group (ShellGlobal *global)
|
||||
{
|
||||
return meta_compositor_get_top_window_group (global->compositor);
|
||||
}
|
||||
|
||||
int
|
||||
shell_global_get_screen_width (ShellGlobal *global)
|
||||
{
|
||||
int width;
|
||||
|
||||
meta_display_get_size (global->meta_display, &width, NULL);
|
||||
return width;
|
||||
}
|
||||
|
||||
int
|
||||
shell_global_get_screen_height (ShellGlobal *global)
|
||||
{
|
||||
int height;
|
||||
|
||||
meta_display_get_size (global->meta_display, NULL, &height);
|
||||
return height;
|
||||
}
|
||||
|
||||
static void
|
||||
global_stage_notify_width (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
@ -1578,6 +1624,46 @@ shell_global_get_session_mode (ShellGlobal *global)
|
||||
return global->session_mode;
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_global_get_force_animations (ShellGlobal *global)
|
||||
{
|
||||
return global->force_animations;
|
||||
}
|
||||
|
||||
void
|
||||
shell_global_set_force_animations (ShellGlobal *global,
|
||||
gboolean force)
|
||||
{
|
||||
if (force == global->force_animations)
|
||||
return;
|
||||
|
||||
global->force_animations = force;
|
||||
g_object_notify_by_pspec (G_OBJECT (global), props[PROP_FORCE_ANIMATIONS]);
|
||||
}
|
||||
|
||||
const char *
|
||||
shell_global_get_datadir (ShellGlobal *global)
|
||||
{
|
||||
return global->datadir;
|
||||
}
|
||||
|
||||
const char *
|
||||
shell_global_get_userdatadir (ShellGlobal *global)
|
||||
{
|
||||
return global->userdatadir;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_automation_script:
|
||||
*
|
||||
* Return value: (transfer none):
|
||||
*/
|
||||
GFile *
|
||||
shell_global_get_automation_script (ShellGlobal *global)
|
||||
{
|
||||
return global->automation_script;
|
||||
}
|
||||
|
||||
static void
|
||||
delete_variant_cb (GObject *object,
|
||||
GAsyncResult *result,
|
||||
@ -1888,3 +1974,37 @@ shell_global_get_app_usage (ShellGlobal *global)
|
||||
global->app_usage = g_object_new (SHELL_TYPE_APP_USAGE, NULL);
|
||||
return global->app_usage;
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_global_get_frame_timestamps (ShellGlobal *global)
|
||||
{
|
||||
return global->frame_timestamps;
|
||||
}
|
||||
|
||||
void
|
||||
shell_global_set_frame_timestamps (ShellGlobal *global,
|
||||
gboolean enable)
|
||||
{
|
||||
if (global->frame_timestamps != enable)
|
||||
{
|
||||
global->frame_timestamps = enable;
|
||||
g_object_notify_by_pspec (G_OBJECT (global), props[PROP_FRAME_TIMESTAMPS]);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_global_get_frame_finish_timestamp (ShellGlobal *global)
|
||||
{
|
||||
return global->frame_finish_timestamp;
|
||||
}
|
||||
|
||||
void
|
||||
shell_global_set_frame_finish_timestamp (ShellGlobal *global,
|
||||
gboolean enable)
|
||||
{
|
||||
if (global->frame_finish_timestamp != enable)
|
||||
{
|
||||
global->frame_finish_timestamp = enable;
|
||||
g_object_notify_by_pspec (G_OBJECT (global), props[PROP_FRAME_FINISH_TIMESTAMP]);
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,21 @@
|
||||
#include <glib-object.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <meta/meta-plugin.h>
|
||||
#include <st/st.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include "shell-window-tracker.h"
|
||||
#include "shell-app-system.h"
|
||||
#include "shell-app-usage.h"
|
||||
#include "shell-wm.h"
|
||||
|
||||
#define SHELL_TYPE_GLOBAL (shell_global_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (ShellGlobal, shell_global, SHELL, GLOBAL, GObject)
|
||||
|
||||
ShellGlobal *shell_global_get (void);
|
||||
MetaBackend *shell_global_get_backend (ShellGlobal *global);
|
||||
MetaCompositor *shell_global_get_compositor (ShellGlobal *global);
|
||||
MetaContext *shell_global_get_context (ShellGlobal *global);
|
||||
ClutterStage *shell_global_get_stage (ShellGlobal *global);
|
||||
MetaDisplay *shell_global_get_display (ShellGlobal *global);
|
||||
@ -24,7 +27,23 @@ GList *shell_global_get_window_actors (ShellGlobal *globa
|
||||
GSettings *shell_global_get_settings (ShellGlobal *global);
|
||||
guint32 shell_global_get_current_time (ShellGlobal *global);
|
||||
MetaWorkspaceManager *shell_global_get_workspace_manager (ShellGlobal *global);
|
||||
ShellWM *shell_global_get_window_manager (ShellGlobal *global);
|
||||
StFocusManager *shell_global_get_focus_manager (ShellGlobal *global);
|
||||
|
||||
int shell_global_get_screen_width (ShellGlobal *global);
|
||||
int shell_global_get_screen_height (ShellGlobal *global);
|
||||
|
||||
ClutterActor * shell_global_get_window_group (ShellGlobal *global);
|
||||
ClutterActor * shell_global_get_top_window_group (ShellGlobal *global);
|
||||
|
||||
const char * shell_global_get_datadir (ShellGlobal *global);
|
||||
const char * shell_global_get_userdatadir (ShellGlobal *global);
|
||||
|
||||
GFile * shell_global_get_automation_script (ShellGlobal *global);
|
||||
|
||||
gboolean shell_global_get_force_animations (ShellGlobal *global);
|
||||
void shell_global_set_force_animations (ShellGlobal *global,
|
||||
gboolean force);
|
||||
|
||||
/* Input/event handling */
|
||||
void shell_global_set_stage_input_region (ShellGlobal *global,
|
||||
@ -98,4 +117,12 @@ ShellAppSystem * shell_global_get_app_system (ShellGlobal *global);
|
||||
|
||||
ShellAppUsage * shell_global_get_app_usage (ShellGlobal *global);
|
||||
|
||||
gboolean shell_global_get_frame_timestamps (ShellGlobal *global);
|
||||
void shell_global_set_frame_timestamps (ShellGlobal *global,
|
||||
gboolean enable);
|
||||
|
||||
gboolean shell_global_get_frame_finish_timestamp (ShellGlobal *global);
|
||||
void shell_global_set_frame_finish_timestamp (ShellGlobal *global,
|
||||
gboolean enable);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -257,17 +257,16 @@ shell_keyring_prompt_get_property (GObject *obj,
|
||||
g_value_set_string (value, self->cancel_label);
|
||||
break;
|
||||
case PROP_PASSWORD_VISIBLE:
|
||||
g_value_set_boolean (value, self->mode == PROMPTING_FOR_PASSWORD);
|
||||
g_value_set_boolean (value, shell_keyring_prompt_get_password_visible (self));
|
||||
break;
|
||||
case PROP_CONFIRM_VISIBLE:
|
||||
g_value_set_boolean (value, self->password_new &&
|
||||
self->mode == PROMPTING_FOR_PASSWORD);
|
||||
g_value_set_boolean (value, shell_keyring_prompt_get_confirm_visible (self));
|
||||
break;
|
||||
case PROP_WARNING_VISIBLE:
|
||||
g_value_set_boolean (value, self->warning && self->warning[0]);
|
||||
g_value_set_boolean (value, shell_keyring_prompt_get_warning_visible (self));
|
||||
break;
|
||||
case PROP_CHOICE_VISIBLE:
|
||||
g_value_set_boolean (value, self->choice_label && self->choice_label[0]);
|
||||
g_value_set_boolean (value, shell_keyring_prompt_get_choice_visible (self));
|
||||
break;
|
||||
case PROP_PASSWORD_ACTOR:
|
||||
g_value_set_object (value, shell_keyring_prompt_get_password_actor (self));
|
||||
@ -541,6 +540,34 @@ shell_keyring_prompt_new (void)
|
||||
return g_object_new (SHELL_TYPE_KEYRING_PROMPT, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_keyring_prompt_get_password_visible (ShellKeyringPrompt *self)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_KEYRING_PROMPT (self), FALSE);
|
||||
return self->mode == PROMPTING_FOR_PASSWORD;
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_keyring_prompt_get_confirm_visible (ShellKeyringPrompt *self)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_KEYRING_PROMPT (self), FALSE);
|
||||
return self->password_new && self->mode == PROMPTING_FOR_PASSWORD;
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_keyring_prompt_get_warning_visible (ShellKeyringPrompt *self)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_KEYRING_PROMPT (self), FALSE);
|
||||
return self->warning && self->warning[0];
|
||||
}
|
||||
|
||||
gboolean
|
||||
shell_keyring_prompt_get_choice_visible (ShellKeyringPrompt *self)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_KEYRING_PROMPT (self), FALSE);
|
||||
return self->choice_label && self->choice_label[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_keyring_prompt_get_password_actor:
|
||||
* @self: the internal prompt
|
||||
|
@ -37,6 +37,11 @@ G_DECLARE_FINAL_TYPE (ShellKeyringPrompt, shell_keyring_prompt,
|
||||
|
||||
ShellKeyringPrompt * shell_keyring_prompt_new (void);
|
||||
|
||||
gboolean shell_keyring_prompt_get_password_visible (ShellKeyringPrompt *self);
|
||||
gboolean shell_keyring_prompt_get_confirm_visible (ShellKeyringPrompt *self);
|
||||
gboolean shell_keyring_prompt_get_warning_visible (ShellKeyringPrompt *self);
|
||||
gboolean shell_keyring_prompt_get_choice_visible (ShellKeyringPrompt *self);
|
||||
|
||||
ClutterText * shell_keyring_prompt_get_password_actor (ShellKeyringPrompt *self);
|
||||
|
||||
void shell_keyring_prompt_set_password_actor (ShellKeyringPrompt *self,
|
||||
|
@ -273,6 +273,30 @@ shell_tray_icon_new (NaTrayChild *tray_child)
|
||||
return CLUTTER_ACTOR (tray_icon);
|
||||
}
|
||||
|
||||
pid_t
|
||||
shell_tray_icon_get_pid (ShellTrayIcon *icon)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_TRAY_ICON (icon), -1);
|
||||
|
||||
return icon->pid;
|
||||
}
|
||||
|
||||
const char *
|
||||
shell_tray_icon_get_title (ShellTrayIcon *icon)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_TRAY_ICON (icon), NULL);
|
||||
|
||||
return icon->title;
|
||||
}
|
||||
|
||||
const char *
|
||||
shell_tray_icon_get_wm_class (ShellTrayIcon *icon)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_TRAY_ICON (icon), NULL);
|
||||
|
||||
return icon->wm_class;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_tray_icon_click:
|
||||
* @icon: a #ShellTrayIcon
|
||||
|
@ -7,5 +7,9 @@
|
||||
G_DECLARE_FINAL_TYPE (ShellTrayIcon, shell_tray_icon,
|
||||
SHELL, TRAY_ICON, ClutterClone)
|
||||
|
||||
pid_t shell_tray_icon_get_pid (ShellTrayIcon *icon);
|
||||
const char * shell_tray_icon_get_title (ShellTrayIcon *icon);
|
||||
const char * shell_tray_icon_get_wm_class (ShellTrayIcon *icon);
|
||||
|
||||
void shell_tray_icon_click (ShellTrayIcon *icon,
|
||||
ClutterEvent *event);
|
||||
|
@ -176,6 +176,18 @@ shell_tray_manager_new (void)
|
||||
return g_object_new (SHELL_TYPE_TRAY_MANAGER, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_tray_manager_get_bg_color:
|
||||
*
|
||||
* Returns: (transfer none):
|
||||
*/
|
||||
CoglColor *
|
||||
shell_tray_manager_get_bg_color (ShellTrayManager *manager)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_TRAY_MANAGER (manager), NULL);
|
||||
return &manager->bg_color;
|
||||
}
|
||||
|
||||
static void
|
||||
shell_tray_manager_ensure_resources (ShellTrayManager *manager)
|
||||
{
|
||||
|
@ -16,4 +16,6 @@ void shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
||||
StWidget *theme_widget);
|
||||
void shell_tray_manager_unmanage_screen (ShellTrayManager *manager);
|
||||
|
||||
CoglColor * shell_tray_manager_get_bg_color (ShellTrayManager *manager);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -345,6 +345,22 @@ shell_window_preview_layout_class_init (ShellWindowPreviewLayoutClass *klass)
|
||||
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_window_preview_layout_get_bounding_box:
|
||||
*
|
||||
* Returns: (transfer none):
|
||||
*/
|
||||
ClutterActorBox *
|
||||
shell_window_preview_layout_get_bounding_box (ShellWindowPreviewLayout *self)
|
||||
{
|
||||
ShellWindowPreviewLayoutPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (SHELL_IS_WINDOW_PREVIEW_LAYOUT (self), NULL);
|
||||
|
||||
priv = shell_window_preview_layout_get_instance_private (self);
|
||||
return &priv->bounding_box;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_window_preview_layout_add_window:
|
||||
* @self: a #ShellWindowPreviewLayout
|
||||
|
@ -19,6 +19,8 @@ struct _ShellWindowPreviewLayout
|
||||
ShellWindowPreviewLayoutPrivate *priv;
|
||||
};
|
||||
|
||||
ClutterActorBox * shell_window_preview_layout_get_bounding_box (ShellWindowPreviewLayout *self);
|
||||
|
||||
ClutterActor * shell_window_preview_layout_add_window (ShellWindowPreviewLayout *self,
|
||||
MetaWindow *window);
|
||||
|
||||
|
@ -168,7 +168,21 @@ shell_window_preview_class_init (ShellWindowPreviewClass *klass)
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_EXPLICIT_NOTIFY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_window_preview_get_window_container:
|
||||
*
|
||||
* Returns: (transfer none):
|
||||
*/
|
||||
ClutterActor *
|
||||
shell_window_preview_get_window_container (ShellWindowPreview *preview)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_WINDOW_PREVIEW (preview), NULL);
|
||||
|
||||
return preview->window_container;
|
||||
}
|
||||
|
@ -8,4 +8,6 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (ShellWindowPreview, shell_window_preview,
|
||||
SHELL, WINDOW_PREVIEW, StWidget)
|
||||
|
||||
ClutterActor * shell_window_preview_get_window_container (ShellWindowPreview *preview);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -713,6 +713,18 @@ shell_window_tracker_get_window_app (ShellWindowTracker *tracker,
|
||||
return app;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_window_tracker_get_focus_app:
|
||||
*
|
||||
* Returns: (transfer none) (nullable):
|
||||
*/
|
||||
ShellApp *
|
||||
shell_window_tracker_get_focus_app (ShellWindowTracker *tracker)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_WINDOW_TRACKER (tracker), NULL);
|
||||
return tracker->focus_app;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* shell_window_tracker_get_app_from_pid:
|
||||
|
@ -21,6 +21,8 @@ ShellApp *shell_window_tracker_get_window_app (ShellWindowTracker *tracker, Meta
|
||||
|
||||
ShellApp *shell_window_tracker_get_app_from_pid (ShellWindowTracker *tracker, int pid);
|
||||
|
||||
ShellApp *shell_window_tracker_get_focus_app (ShellWindowTracker *tracker);
|
||||
|
||||
GSList *shell_window_tracker_get_startup_sequences (ShellWindowTracker *tracker);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -34,6 +34,8 @@ struct _ShellWorkspaceBackground
|
||||
|
||||
G_DEFINE_TYPE (ShellWorkspaceBackground, shell_workspace_background, ST_TYPE_WIDGET);
|
||||
|
||||
#define EPSILON (1e-10)
|
||||
|
||||
static void
|
||||
on_workareas_changed (ShellWorkspaceBackground *self)
|
||||
{
|
||||
@ -157,14 +159,7 @@ shell_workspace_background_set_property (GObject *gobject,
|
||||
break;
|
||||
|
||||
case PROP_STATE_ADJUSTMENT_VALUE:
|
||||
{
|
||||
double new_value = g_value_get_double (value);
|
||||
if (self->state_adjustment_value != new_value)
|
||||
{
|
||||
self->state_adjustment_value = new_value;
|
||||
g_object_notify_by_pspec (gobject, obj_props[PROP_STATE_ADJUSTMENT_VALUE]);
|
||||
}
|
||||
}
|
||||
shell_workspace_background_set_state_adjustment_value (self, g_value_get_double (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -217,3 +212,32 @@ shell_workspace_background_init (ShellWorkspaceBackground *self)
|
||||
G_CALLBACK (on_workareas_changed),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
int
|
||||
shell_workspace_background_get_monitor_index (ShellWorkspaceBackground *self)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_WORKSPACE_BACKGROUND (self), -1);
|
||||
|
||||
return self->monitor_index;
|
||||
}
|
||||
|
||||
double
|
||||
shell_workspace_background_get_state_adjustment_value (ShellWorkspaceBackground *self)
|
||||
{
|
||||
g_return_val_if_fail (SHELL_IS_WORKSPACE_BACKGROUND (self), -1);
|
||||
|
||||
return self->state_adjustment_value;
|
||||
}
|
||||
|
||||
void
|
||||
shell_workspace_background_set_state_adjustment_value (ShellWorkspaceBackground *self,
|
||||
double value)
|
||||
{
|
||||
g_return_if_fail (SHELL_IS_WORKSPACE_BACKGROUND (self));
|
||||
|
||||
if (fabs (self->state_adjustment_value - value) < EPSILON)
|
||||
return;
|
||||
|
||||
self->state_adjustment_value = value;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_STATE_ADJUSTMENT_VALUE]);
|
||||
}
|
||||
|
@ -8,4 +8,10 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (ShellWorkspaceBackground, shell_workspace_background,
|
||||
SHELL, WORKSPACE_BACKGROUND, StWidget)
|
||||
|
||||
int shell_workspace_background_get_monitor_index (ShellWorkspaceBackground *bg);
|
||||
|
||||
double shell_workspace_background_get_state_adjustment_value (ShellWorkspaceBackground *bg);
|
||||
void shell_workspace_background_set_state_adjustment_value (ShellWorkspaceBackground *bg,
|
||||
double value);
|
||||
|
||||
G_END_DECLS
|
||||
|
Loading…
x
Reference in New Issue
Block a user