diff options
author | Benjamin Otte <otte@redhat.com> | 2013-02-10 01:06:58 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2013-02-19 14:32:41 +0100 |
commit | bb4953f3e8e102264a82ea4938b7813b85320b22 (patch) | |
tree | 5da061688bd494a60f57905cc14ece4dbab2f7e4 /gdk/x11/xsettings-client.c | |
parent | 63f0797e70ee0a141d22d928bc6b35b638effb08 (diff) | |
download | gtk+-bb4953f3e8e102264a82ea4938b7813b85320b22.tar.gz |
x11: Fold xsettings-common.[ch] into xsettings-client.[ch]
Diffstat (limited to 'gdk/x11/xsettings-client.c')
-rw-r--r-- | gdk/x11/xsettings-client.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index 87b7b0d2e4..93d3bc1e5b 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -25,6 +25,8 @@ #include "xsettings-client.h" +#include <glib.h> + #include <limits.h> #include <stdio.h> #include <stdlib.h> @@ -574,3 +576,42 @@ xsettings_client_process_event (XSettingsClient *client, return False; } + +int +xsettings_setting_equal (XSettingsSetting *setting_a, + XSettingsSetting *setting_b) +{ + if (setting_a->type != setting_b->type) + return 0; + + if (strcmp (setting_a->name, setting_b->name) != 0) + return 0; + + switch (setting_a->type) + { + case XSETTINGS_TYPE_INT: + return setting_a->data.v_int == setting_b->data.v_int; + case XSETTINGS_TYPE_COLOR: + return (setting_a->data.v_color.red == setting_b->data.v_color.red && + setting_a->data.v_color.green == setting_b->data.v_color.green && + setting_a->data.v_color.blue == setting_b->data.v_color.blue && + setting_a->data.v_color.alpha == setting_b->data.v_color.alpha); + case XSETTINGS_TYPE_STRING: + return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0; + } + + return 0; +} + +void +xsettings_setting_free (XSettingsSetting *setting) +{ + if (setting->type == XSETTINGS_TYPE_STRING) + free (setting->data.v_string); + + if (setting->name) + free (setting->name); + + free (setting); +} + |