summaryrefslogtreecommitdiff
path: root/capplet
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 /capplet
parentfb24ae35d358177cfaa1706280b3e0752a2ec97b (diff)
downloadmate-session-manager-16fe21a84ea333db67e9f0509d619f8d3fee1443.tar.bz2
mate-session-manager-16fe21a84ea333db67e9f0509d619f8d3fee1443.tar.xz
Add Show hidden checkbox and gsettings flag.
Diffstat (limited to 'capplet')
-rw-r--r--capplet/gsm-properties-dialog.c45
-rw-r--r--capplet/gsp-app-manager.c2
2 files changed, 46 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);
}