summaryrefslogtreecommitdiff
path: root/src/eom-preferences-dialog.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-29 18:26:49 +0200
committerinfirit <[email protected]>2014-07-29 18:26:49 +0200
commitfb511ab67fa5072f674a9fc0d43916fb99792e6b (patch)
tree6a430a6e5583d9cd630a5ee57ef1939a8daf3400 /src/eom-preferences-dialog.c
parentf1da7aaa9b1cbc5f0ea703bbd5719d9c64dc2b15 (diff)
downloadeom-fb511ab67fa5072f674a9fc0d43916fb99792e6b.tar.bz2
eom-fb511ab67fa5072f674a9fc0d43916fb99792e6b.tar.xz
Have GSettings use enum for transparency style
Based on eog commit e8f2f6ecdd99dc5dce35a044e84738fe73f937e0 From Felix Riemann <[email protected]> ps infirit: eom never had this value in the convert file
Diffstat (limited to 'src/eom-preferences-dialog.c')
-rw-r--r--src/eom-preferences-dialog.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/src/eom-preferences-dialog.c b/src/eom-preferences-dialog.c
index 7039fb0..869c6eb 100644
--- a/src/eom-preferences-dialog.c
+++ b/src/eom-preferences-dialog.c
@@ -28,6 +28,7 @@
#include "eom-preferences-dialog.h"
#include "eom-plugin-manager.h"
+#include "eom-scroll-view.h"
#include "eom-util.h"
#include "eom-config-keys.h"
@@ -97,21 +98,17 @@ pd_color_to_string_mapping (const GValue *value,
}
static void
-pd_radio_toggle_cb (GtkWidget *widget, GSettings *settings)
+pd_transp_radio_toggle_cb (GtkWidget *widget, gpointer data)
{
- char *key = NULL;
- char *value = NULL;
+ gpointer value = NULL;
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
return;
- key = g_object_get_data (G_OBJECT (widget), GSETTINGS_OBJECT_KEY);
value = g_object_get_data (G_OBJECT (widget), GSETTINGS_OBJECT_VALUE);
- if (key == NULL || value == NULL)
- return;
-
- g_settings_set_string (settings, key, value);
+ g_settings_set_enum (G_SETTINGS (data), EOM_CONF_VIEW_TRANSPARENCY,
+ GPOINTER_TO_INT (value));
}
static void
@@ -158,7 +155,6 @@ eom_preferences_dialog_constructor (GType type,
GtkWidget *plugin_manager_container;
GObject *object;
GdkColor color;
- gchar *value;
object = G_OBJECT_CLASS (eom_preferences_dialog_parent_class)->constructor
(type, n_construct_properties, construct_params);
@@ -225,59 +221,48 @@ eom_preferences_dialog_constructor (GType type,
NULL, NULL);
g_object_set_data (G_OBJECT (color_radio),
- GSETTINGS_OBJECT_KEY,
- EOM_CONF_VIEW_TRANSPARENCY);
-
- g_object_set_data (G_OBJECT (color_radio),
GSETTINGS_OBJECT_VALUE,
- "COLOR");
+ GINT_TO_POINTER (EOM_TRANSP_COLOR));
g_signal_connect (G_OBJECT (color_radio),
"toggled",
- G_CALLBACK (pd_radio_toggle_cb),
+ G_CALLBACK (pd_transp_radio_toggle_cb),
priv->view_settings);
g_object_set_data (G_OBJECT (checkpattern_radio),
- GSETTINGS_OBJECT_KEY,
- EOM_CONF_VIEW_TRANSPARENCY);
-
- g_object_set_data (G_OBJECT (checkpattern_radio),
GSETTINGS_OBJECT_VALUE,
- "CHECK_PATTERN");
+ GINT_TO_POINTER (EOM_TRANSP_CHECKED));
g_signal_connect (G_OBJECT (checkpattern_radio),
"toggled",
- G_CALLBACK (pd_radio_toggle_cb),
+ G_CALLBACK (pd_transp_radio_toggle_cb),
priv->view_settings);
g_object_set_data (G_OBJECT (background_radio),
- GSETTINGS_OBJECT_KEY,
- EOM_CONF_VIEW_TRANSPARENCY);
-
- g_object_set_data (G_OBJECT (background_radio),
GSETTINGS_OBJECT_VALUE,
- "NONE");
+ GINT_TO_POINTER (EOM_TRANSP_BACKGROUND));
g_signal_connect (G_OBJECT (background_radio),
"toggled",
- G_CALLBACK (pd_radio_toggle_cb),
+ G_CALLBACK (pd_transp_radio_toggle_cb),
priv->view_settings);
- value = g_settings_get_string (priv->view_settings,
- EOM_CONF_VIEW_TRANSPARENCY);
-
- if (g_ascii_strcasecmp (value, "COLOR") == 0) {
+ switch (g_settings_get_enum (priv->view_settings,
+ EOM_CONF_VIEW_TRANSPARENCY))
+ {
+ case EOM_TRANSP_COLOR:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (color_radio), TRUE);
- }
- else if (g_ascii_strcasecmp (value, "CHECK_PATTERN") == 0) {
+ break;
+ case EOM_TRANSP_CHECKED:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkpattern_radio), TRUE);
- }
- else {
+ break;
+ default:
+ // Log a warning and use EOM_TRANSP_BACKGROUND as fallback
+ g_warn_if_reached ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (background_radio), TRUE);
+ break;
}
- g_free (value);
-
g_settings_bind_with_mapping (priv->view_settings,
EOM_CONF_VIEW_TRANS_COLOR,
color_button, "color",