summaryrefslogtreecommitdiff
path: root/plugins/housekeeping/msd-ldsm-dialog.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-12-15 12:33:17 -0800
committerStefano Karapetsas <[email protected]>2012-12-15 12:33:17 -0800
commit85c5ae14d75e3413b8f3f3aa38205ea852dcb20d (patch)
tree4750b8d23dfcb17aea6cbc62c7e1c788a6976a7b /plugins/housekeeping/msd-ldsm-dialog.c
parent12dcf19aa5f51901053c273cd7f5c17ce85e909d (diff)
parentc6a6cbde72489a0055ba63341a153fe365058072 (diff)
downloadmate-settings-daemon-85c5ae14d75e3413b8f3f3aa38205ea852dcb20d.tar.bz2
mate-settings-daemon-85c5ae14d75e3413b8f3f3aa38205ea852dcb20d.tar.xz
Merge pull request #31 from jasmineaura/develop
background revised, various other fixes & improvements
Diffstat (limited to 'plugins/housekeeping/msd-ldsm-dialog.c')
-rw-r--r--plugins/housekeeping/msd-ldsm-dialog.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/plugins/housekeeping/msd-ldsm-dialog.c b/plugins/housekeeping/msd-ldsm-dialog.c
index 7615206..0624448 100644
--- a/plugins/housekeeping/msd-ldsm-dialog.c
+++ b/plugins/housekeeping/msd-ldsm-dialog.c
@@ -17,11 +17,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <glib.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include "msd-ldsm-dialog.h"
+#if GLIB_CHECK_VERSION (2, 30, 0)
+#define g_format_size_for_display g_format_size
+#endif
+
#define SETTINGS_SCHEMA "org.mate.SettingsDaemon.plugins.housekeeping"
#define SETTINGS_IGNORE_PATHS "ignore-paths"
@@ -151,25 +156,25 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
{
MsdLdsmDialog *dialog = (MsdLdsmDialog *)user_data;
GSettings *settings;
- GSList *ignore_paths;
+ gchar **settings_list;
+ GSList *ignore_paths = NULL;
GError *error = NULL;
gboolean ignore, ret, updated;
- gchar **settings_list;
-
+ gint i;
+
settings = g_settings_new (SETTINGS_SCHEMA);
-
+
settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS);
- if (settings_list != NULL) {
- gint i;
- for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
- if (settings_list[i] != NULL)
- ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
- }
- g_strfreev (settings_list);
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ ignore_paths = g_slist_prepend (ignore_paths, g_strdup (settings_list[i]));
}
-
-
+ g_strfreev (settings_list);
+
+ if (i > 0)
+ ignore_paths = g_slist_reverse (ignore_paths);
+
ignore = gtk_toggle_button_get_active (button);
updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore);
@@ -179,9 +184,10 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
for (l = ignore_paths; l != NULL; l = l->next)
g_ptr_array_add (array, l->data);
+
g_ptr_array_add (array, NULL);
- if (!g_settings_set_strv (settings, "ignore-paths", (const gchar **) array->pdata)) {
+ if (!g_settings_set_strv (settings, SETTINGS_IGNORE_PATHS, (const gchar **) array->pdata)) {
g_warning ("Cannot change ignore preference - failed to commit changes");
}
@@ -213,9 +219,6 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog)
gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- /* We don't want a separator - they're really ugly */
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-
/* Create the image */
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);