summaryrefslogtreecommitdiff
path: root/capplet/gsp-app.c
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2018-12-14 18:01:46 +0800
committerlukefromdc <[email protected]>2018-12-21 22:47:02 +0000
commit0e2eb8a311586599bbd3937d413da2f78eedb4d6 (patch)
treec29979d0f3ff1749769bf9668133683fc270725e /capplet/gsp-app.c
parent34ef232530e30a2ebc32d41bae8a112323adbcc2 (diff)
downloadmate-session-manager-0e2eb8a311586599bbd3937d413da2f78eedb4d6.tar.bz2
mate-session-manager-0e2eb8a311586599bbd3937d413da2f78eedb4d6.tar.xz
Add a delay setting to Startup Manager
Fixed issue #127 - capplet/gsm-app-dialog.c - capplet/gsm-app-dialog.h - capplet/gsm-properties-dialog.c - capplet/gsp-app.c - capplet/gsp-app.h - capplet/gsp-keyfile.h - data/session-properties.ui
Diffstat (limited to 'capplet/gsp-app.c')
-rw-r--r--capplet/gsp-app.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index 02a91cc..f62228e 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -46,6 +46,7 @@
#define GSP_ASP_SAVE_MASK_NAME 0x0004
#define GSP_ASP_SAVE_MASK_EXEC 0x0008
#define GSP_ASP_SAVE_MASK_COMMENT 0x0010
+#define GSP_ASP_SAVE_MASK_DELAY 0x0020
#define GSP_ASP_SAVE_MASK_ALL 0xffff
typedef struct {
@@ -59,6 +60,7 @@ typedef struct {
char *exec;
char *comment;
char *icon;
+ gint delay;
GIcon *gicon;
char *description;
@@ -487,6 +489,10 @@ _gsp_app_save (gpointer data)
priv->exec);
}
+ if (priv->save_mask & GSP_ASP_SAVE_MASK_DELAY) {
+ gsp_key_file_set_delay (keyfile, priv->delay);
+ }
+
_gsp_ensure_user_autostart_dir ();
if (gsp_key_file_to_file (keyfile, priv->path, NULL)) {
priv->skip_next_monitor_event = TRUE;
@@ -643,6 +649,17 @@ gsp_app_get_comment (GspApp *app)
return priv->comment;
}
+guint
+gsp_app_get_delay (GspApp *app)
+{
+ GspAppPrivate *priv;
+
+ g_return_val_if_fail (GSP_IS_APP (app), 0);
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->delay;
+}
+
GIcon *
gsp_app_get_icon (GspApp *app)
{
@@ -716,7 +733,8 @@ void
gsp_app_update (GspApp *app,
const char *name,
const char *comment,
- const char *exec)
+ const char *exec,
+ guint delay)
{
gboolean changed;
GspAppPrivate *priv;
@@ -751,6 +769,12 @@ gsp_app_update (GspApp *app,
priv->save_mask |= GSP_ASP_SAVE_MASK_EXEC;
}
+ if ( delay != priv->delay) {
+ changed = TRUE;
+ priv->delay = delay;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_DELAY;
+ }
+
if (changed) {
_gsp_app_queue_save (app);
_gsp_app_emit_changed (app);
@@ -928,6 +952,7 @@ gsp_app_new (const char *path,
G_KEY_FILE_DESKTOP_KEY_EXEC);
priv->comment = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_COMMENT);
+ priv->delay = gsp_key_file_get_delay (keyfile);
if (gsm_util_text_is_blank (priv->name)) {
g_free (priv->name);
@@ -1035,7 +1060,8 @@ _gsp_find_free_basename (const char *suggested_basename)
void
gsp_app_create (const char *name,
const char *comment,
- const char *exec)
+ const char *exec,
+ guint delay)
{
GspAppManager *manager;
GspAppPrivate *priv;
@@ -1074,6 +1100,7 @@ gsp_app_create (const char *name,
}
priv->exec = g_strdup (exec);
priv->comment = g_strdup (comment);
+ priv->delay = delay;
priv->icon = NULL;
priv->gicon = NULL;