summaryrefslogtreecommitdiff
path: root/capplet
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-07-27 23:16:32 +0300
committerMonsta <[email protected]>2015-07-27 23:26:18 +0300
commite25e546c9d2f7a18ff2b3f4a578fb9028544be85 (patch)
treeacb68654e1136f85d59485e397ad2ec699ee0cd3 /capplet
parent1dc6b6ba5e193bceca155f852b82dc803b554b07 (diff)
downloadmate-session-manager-e25e546c9d2f7a18ff2b3f4a578fb9028544be85.tar.bz2
mate-session-manager-e25e546c9d2f7a18ff2b3f4a578fb9028544be85.tar.xz
use g_settings_bind + unref GSettings during dialog cleanup
from https://github.com/GNOME/gnome-session/commit/11d9ec5976671e54714a4667e5ca45c925c0d762
Diffstat (limited to 'capplet')
-rw-r--r--capplet/gsm-properties-dialog.c52
1 files changed, 7 insertions, 45 deletions
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 922d6e7..3fcb4bd 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -62,8 +62,6 @@ struct GsmPropertiesDialogPrivate
GtkWidget *delete_button;
GtkWidget *edit_button;
- GtkWidget *remember_toggle;
-
GspAppManager *manager;
GSettings *settings;
@@ -458,37 +456,6 @@ on_row_activated (GtkTreeView *tree_view,
}
static void
-on_autosave_value_notify (GSettings *settings,
- gchar *key,
- GsmPropertiesDialog *dialog)
-{
- gboolean gval;
- gboolean bval;
-
- gval = g_settings_get_boolean (settings, key);
- bval = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->remember_toggle));
-
- if (bval != gval) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->remember_toggle), gval);
- }
-}
-
-static void
-on_autosave_value_toggled (GtkToggleButton *button,
- GsmPropertiesDialog *dialog)
-{
- gboolean gval;
- gboolean bval;
-
- gval = g_settings_get_boolean (dialog->priv->settings, SPC_AUTOSAVE_KEY);
- bval = gtk_toggle_button_get_active (button);
-
- if (gval != bval) {
- g_settings_set_boolean (dialog->priv->settings, SPC_AUTOSAVE_KEY, bval);
- }
-}
-
-static void
on_save_session_clicked (GtkWidget *widget,
GsmPropertiesDialog *dialog)
{
@@ -658,19 +625,9 @@ setup_dialog (GsmPropertiesDialog *dialog)
button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
CAPPLET_REMEMBER_WIDGET_NAME));
- dialog->priv->remember_toggle = button;
- g_signal_connect (dialog->priv->settings,
- "changed::" SPC_AUTOSAVE_KEY,
- G_CALLBACK (on_autosave_value_notify),
- dialog);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
- g_settings_get_boolean (dialog->priv->settings, SPC_AUTOSAVE_KEY));
- g_signal_connect (button,
- "toggled",
- G_CALLBACK (on_autosave_value_toggled),
- dialog);
+ g_settings_bind (dialog->priv->settings, SPC_AUTOSAVE_KEY,
+ button, "active", G_SETTINGS_BIND_DEFAULT);
button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
CAPPLET_SAVE_WIDGET_NAME));
@@ -724,6 +681,11 @@ gsm_properties_dialog_dispose (GObject *object)
dialog->priv->xml = NULL;
}
+ if (dialog->priv->settings != NULL) {
+ g_object_unref (dialog->priv->settings);
+ dialog->priv->settings = NULL;
+ }
+
G_OBJECT_CLASS (gsm_properties_dialog_parent_class)->dispose (object);
/* it's important to do this after chaining to the parent dispose