summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-05-09 12:19:23 +0800
committerVictor Kareh <[email protected]>2019-05-09 15:10:37 -0400
commit16fe21a84ea333db67e9f0509d619f8d3fee1443 (patch)
tree6453a1019ae96412af44519c7e23e8f6047e80a2
parentfb24ae35d358177cfaa1706280b3e0752a2ec97b (diff)
downloadmate-session-manager-16fe21a84ea333db67e9f0509d619f8d3fee1443.tar.bz2
mate-session-manager-16fe21a84ea333db67e9f0509d619f8d3fee1443.tar.xz
Add Show hidden checkbox and gsettings flag.
-rw-r--r--capplet/gsm-properties-dialog.c45
-rw-r--r--capplet/gsp-app-manager.c2
-rw-r--r--data/org.mate.session.gschema.xml.in5
-rw-r--r--data/session-properties.ui15
4 files changed, 66 insertions, 1 deletions
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 20ceac8..3f7a816 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -43,11 +43,13 @@
#define CAPPLET_EDIT_WIDGET_NAME "session_properties_edit_button"
#define CAPPLET_SAVE_WIDGET_NAME "session_properties_save_button"
#define CAPPLET_REMEMBER_WIDGET_NAME "session_properties_remember_toggle"
+#define CAPPLET_SHOW_HIDDEN_WIDGET_NAME "session_properties_show_hidden_toggle"
#define STARTUP_APP_ICON "system-run"
#define SPC_CONFIG_SCHEMA "org.mate.session"
#define SPC_AUTOSAVE_KEY "auto-save-session"
+#define SPC_SHOW_HIDDEN_KEY "show-hidden-apps"
struct _GsmPropertiesDialog
{
@@ -458,6 +460,37 @@ on_row_activated (GtkTreeView *tree_view,
}
static void
+update_tree_view (GsmPropertiesDialog *dialog)
+{
+ GSList *apps;
+ GSList *l;
+ gboolean show_hidden;
+ GspApp *app;
+
+ show_hidden = g_settings_get_boolean (dialog->settings, SPC_SHOW_HIDDEN_KEY);
+
+ apps = gsp_app_manager_get_apps (dialog->manager);
+ for (l = apps; l != NULL; l = l->next) {
+ app = GSP_APP (l->data);
+ if (gsp_app_get_nodisplay(app)) {
+ if (show_hidden) {
+ _app_added (dialog, app, dialog->manager);
+ }else{
+ _app_removed (dialog, app, dialog->manager);
+ }
+ }
+ }
+ g_slist_free (apps);
+}
+
+static void
+on_show_hidden_clicked (GtkWidget *widget,
+ GsmPropertiesDialog *dialog)
+{
+ update_tree_view (dialog);
+}
+
+static void
on_save_session_clicked (GtkWidget *widget,
GsmPropertiesDialog *dialog)
{
@@ -634,6 +667,17 @@ setup_dialog (GsmPropertiesDialog *dialog)
button, "active", G_SETTINGS_BIND_DEFAULT);
button = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
+ CAPPLET_SHOW_HIDDEN_WIDGET_NAME));
+
+ g_settings_bind (dialog->settings, SPC_SHOW_HIDDEN_KEY,
+ button, "active", G_SETTINGS_BIND_DEFAULT);
+
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (on_show_hidden_clicked),
+ dialog);
+
+ button = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
CAPPLET_SAVE_WIDGET_NAME));
g_signal_connect (button,
"clicked",
@@ -648,6 +692,7 @@ setup_dialog (GsmPropertiesDialog *dialog)
G_CALLBACK (_app_removed), dialog);
populate_model (dialog);
+ update_tree_view (dialog);
}
static GObject *
diff --git a/capplet/gsp-app-manager.c b/capplet/gsp-app-manager.c
index 4072036..7e245db 100644
--- a/capplet/gsp-app-manager.c
+++ b/capplet/gsp-app-manager.c
@@ -479,7 +479,7 @@ _gsp_app_manager_fill_from_dir (GspAppManager *manager,
desktop_file_path = g_build_filename (xdgdir->dir, name, NULL);
app = gsp_app_new (desktop_file_path, xdgdir->index);
- if (app != NULL && !gsp_app_get_nodisplay(app)) {
+ if (app != NULL) {
gsp_app_manager_add (manager, app);
g_object_unref (app);
}
diff --git a/data/org.mate.session.gschema.xml.in b/data/org.mate.session.gschema.xml.in
index b7f8f2d..f151dbb 100644
--- a/data/org.mate.session.gschema.xml.in
+++ b/data/org.mate.session.gschema.xml.in
@@ -10,6 +10,11 @@
<summary>Save sessions</summary>
<description>If enabled, mate-session will save the session automatically.</description>
</key>
+ <key name="show-hidden-apps" type="b">
+ <default>false</default>
+ <summary>Show hidden autostart applications</summary>
+ <description>If enabled, mate-session-properties will show hidden autostart applications.</description>
+ </key>
<key name="logout-prompt" type="b">
<default>true</default>
<summary>Logout prompt</summary>
diff --git a/data/session-properties.ui b/data/session-properties.ui
index fef715c..b162a15 100644
--- a/data/session-properties.ui
+++ b/data/session-properties.ui
@@ -141,6 +141,21 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="session_properties_show_hidden_toggle">
+ <property name="label" translatable="yes">_Show hidden</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
</child>
<child type="tab">