|
|
ab48da |
From 2e05f7170a8c7fb0525334815361c72c08d3894a Mon Sep 17 00:00:00 2001
|
|
|
ab48da |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
ab48da |
Date: Wed, 6 Jul 2016 19:56:47 +0200
|
|
|
ab48da |
Subject: [PATCH] app: Add a construct-only app-info property
|
|
|
ab48da |
|
|
|
ab48da |
This will allow us to create a ShellApp from JS code, for instance
|
|
|
ab48da |
for .desktop files that aren't known to the AppSystem.
|
|
|
ab48da |
---
|
|
|
ab48da |
src/shell-app.c | 45 +++++++++++++++++++++++++++++++++++++++++----
|
|
|
ab48da |
1 file changed, 41 insertions(+), 4 deletions(-)
|
|
|
ab48da |
|
|
|
ab48da |
diff --git a/src/shell-app.c b/src/shell-app.c
|
|
|
ab48da |
index 1593c89..03369e5 100644
|
|
|
ab48da |
--- a/src/shell-app.c
|
|
|
ab48da |
+++ b/src/shell-app.c
|
|
|
ab48da |
@@ -96,7 +96,8 @@ enum {
|
|
|
ab48da |
PROP_ID,
|
|
|
ab48da |
PROP_DBUS_ID,
|
|
|
ab48da |
PROP_ACTION_GROUP,
|
|
|
ab48da |
- PROP_MENU
|
|
|
ab48da |
+ PROP_MENU,
|
|
|
ab48da |
+ PROP_APP_INFO
|
|
|
ab48da |
};
|
|
|
ab48da |
|
|
|
ab48da |
enum {
|
|
|
ab48da |
@@ -138,6 +139,29 @@ shell_app_get_property (GObject *gobject,
|
|
|
ab48da |
if (app->running_state)
|
|
|
ab48da |
g_value_set_object (value, app->running_state->remote_menu);
|
|
|
ab48da |
break;
|
|
|
ab48da |
+ case PROP_APP_INFO:
|
|
|
ab48da |
+ if (app->info)
|
|
|
ab48da |
+ g_value_set_object (value, app->info);
|
|
|
ab48da |
+ break;
|
|
|
ab48da |
+ default:
|
|
|
ab48da |
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
|
|
ab48da |
+ break;
|
|
|
ab48da |
+ }
|
|
|
ab48da |
+}
|
|
|
ab48da |
+
|
|
|
ab48da |
+static void
|
|
|
ab48da |
+shell_app_set_property (GObject *gobject,
|
|
|
ab48da |
+ guint prop_id,
|
|
|
ab48da |
+ const GValue *value,
|
|
|
ab48da |
+ GParamSpec *pspec)
|
|
|
ab48da |
+{
|
|
|
ab48da |
+ ShellApp *app = SHELL_APP (gobject);
|
|
|
ab48da |
+
|
|
|
ab48da |
+ switch (prop_id)
|
|
|
ab48da |
+ {
|
|
|
ab48da |
+ case PROP_APP_INFO:
|
|
|
ab48da |
+ _shell_app_set_app_info (app, g_value_get_object (value));
|
|
|
ab48da |
+ break;
|
|
|
ab48da |
default:
|
|
|
ab48da |
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
|
|
ab48da |
break;
|
|
|
ab48da |
@@ -806,9 +830,9 @@ _shell_app_new (GDesktopAppInfo *info)
|
|
|
ab48da |
{
|
|
|
ab48da |
ShellApp *app;
|
|
|
ab48da |
|
|
|
ab48da |
- app = g_object_new (SHELL_TYPE_APP, NULL);
|
|
|
ab48da |
-
|
|
|
ab48da |
- _shell_app_set_app_info (app, info);
|
|
|
ab48da |
+ app = g_object_new (SHELL_TYPE_APP,
|
|
|
ab48da |
+ "app-info", info,
|
|
|
ab48da |
+ NULL);
|
|
|
ab48da |
|
|
|
ab48da |
return app;
|
|
|
ab48da |
}
|
|
|
ab48da |
@@ -1405,6 +1429,7 @@ shell_app_class_init(ShellAppClass *klass)
|
|
|
ab48da |
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
ab48da |
|
|
|
ab48da |
gobject_class->get_property = shell_app_get_property;
|
|
|
ab48da |
+ gobject_class->set_property = shell_app_set_property;
|
|
|
ab48da |
gobject_class->dispose = shell_app_dispose;
|
|
|
ab48da |
gobject_class->finalize = shell_app_finalize;
|
|
|
ab48da |
|
|
|
ab48da |
@@ -1483,5 +1508,17 @@ shell_app_class_init(ShellAppClass *klass)
|
|
|
ab48da |
"The primary menu exported by the remote application",
|
|
|
ab48da |
G_TYPE_MENU_MODEL,
|
|
|
ab48da |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
|
|
ab48da |
+ /**
|
|
|
ab48da |
+ * ShellApp:app-info:
|
|
|
ab48da |
+ *
|
|
|
ab48da |
+ * The #GDesktopAppInfo associated with this ShellApp, if any.
|
|
|
ab48da |
+ */
|
|
|
ab48da |
+ g_object_class_install_property (gobject_class,
|
|
|
ab48da |
+ PROP_APP_INFO,
|
|
|
ab48da |
+ g_param_spec_object ("app-info",
|
|
|
ab48da |
+ "DesktopAppInfo",
|
|
|
ab48da |
+ "The DesktopAppInfo associated with this app",
|
|
|
ab48da |
+ G_TYPE_DESKTOP_APP_INFO,
|
|
|
ab48da |
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
|
|
ab48da |
|
|
|
ab48da |
}
|
|
|
ab48da |
--
|
|
|
ab48da |
2.7.4
|
|
|
ab48da |
|
|
|
ab48da |
From fef6ef9c90cea5f8a9f13651e2fb1deb03013c7f Mon Sep 17 00:00:00 2001
|
|
|
ab48da |
From: Ray Strode <rstrode@redhat.com>
|
|
|
ab48da |
Date: Tue, 12 Jul 2016 14:16:41 -0400
|
|
|
ab48da |
Subject: [PATCH] fixup! app: Add a construct-only app-info property
|
|
|
ab48da |
|
|
|
ab48da |
---
|
|
|
ab48da |
src/shell-app.c | 4 +++-
|
|
|
ab48da |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
ab48da |
|
|
|
ab48da |
diff --git a/src/shell-app.c b/src/shell-app.c
|
|
|
ab48da |
index 36aa47a..9cea064 100644
|
|
|
ab48da |
--- a/src/shell-app.c
|
|
|
ab48da |
+++ b/src/shell-app.c
|
|
|
ab48da |
@@ -969,61 +969,63 @@ ShellApp *
|
|
|
ab48da |
_shell_app_new_for_window (MetaWindow *window)
|
|
|
ab48da |
{
|
|
|
ab48da |
ShellApp *app;
|
|
|
ab48da |
|
|
|
ab48da |
app = g_object_new (SHELL_TYPE_APP, NULL);
|
|
|
ab48da |
|
|
|
ab48da |
app->window_id_string = g_strdup_printf ("window:%d", meta_window_get_stable_sequence (window));
|
|
|
ab48da |
|
|
|
ab48da |
_shell_app_add_window (app, window);
|
|
|
ab48da |
|
|
|
ab48da |
return app;
|
|
|
ab48da |
}
|
|
|
ab48da |
|
|
|
ab48da |
ShellApp *
|
|
|
ab48da |
_shell_app_new (GDesktopAppInfo *info)
|
|
|
ab48da |
{
|
|
|
ab48da |
ShellApp *app;
|
|
|
ab48da |
|
|
|
ab48da |
app = g_object_new (SHELL_TYPE_APP,
|
|
|
ab48da |
"app-info", info,
|
|
|
ab48da |
NULL);
|
|
|
ab48da |
|
|
|
ab48da |
return app;
|
|
|
ab48da |
}
|
|
|
ab48da |
|
|
|
ab48da |
void
|
|
|
ab48da |
_shell_app_set_app_info (ShellApp *app,
|
|
|
ab48da |
GDesktopAppInfo *info)
|
|
|
ab48da |
{
|
|
|
ab48da |
g_clear_object (&app->info);
|
|
|
ab48da |
- app->info = g_object_ref (info);
|
|
|
ab48da |
+
|
|
|
ab48da |
+ if (info)
|
|
|
ab48da |
+ app->info = g_object_ref (info);
|
|
|
ab48da |
|
|
|
ab48da |
if (app->name_collation_key != NULL)
|
|
|
ab48da |
g_free (app->name_collation_key);
|
|
|
ab48da |
app->name_collation_key = g_utf8_collate_key (shell_app_get_name (app), -1);
|
|
|
ab48da |
}
|
|
|
ab48da |
|
|
|
ab48da |
static void
|
|
|
ab48da |
shell_app_state_transition (ShellApp *app,
|
|
|
ab48da |
ShellAppState state)
|
|
|
ab48da |
{
|
|
|
ab48da |
if (app->state == state)
|
|
|
ab48da |
return;
|
|
|
ab48da |
g_return_if_fail (!(app->state == SHELL_APP_STATE_RUNNING &&
|
|
|
ab48da |
state == SHELL_APP_STATE_STARTING));
|
|
|
ab48da |
app->state = state;
|
|
|
ab48da |
|
|
|
ab48da |
_shell_app_system_notify_app_state_changed (shell_app_system_get_default (), app);
|
|
|
ab48da |
|
|
|
ab48da |
g_object_notify (G_OBJECT (app), "state");
|
|
|
ab48da |
}
|
|
|
ab48da |
|
|
|
ab48da |
static void
|
|
|
ab48da |
shell_app_on_unmanaged (MetaWindow *window,
|
|
|
ab48da |
ShellApp *app)
|
|
|
ab48da |
{
|
|
|
ab48da |
_shell_app_remove_window (app, window);
|
|
|
ab48da |
}
|
|
|
ab48da |
|
|
|
ab48da |
static void
|
|
|
ab48da |
shell_app_on_user_time_changed (MetaWindow *window,
|
|
|
ab48da |
--
|
|
|
ab48da |
2.7.4
|
|
|
ab48da |
|