diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 6e082507a6..cb26ee5ef1 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -1353,8 +1353,7 @@ gdk_x11_screen_get_setting (GdkScreen *screen, { GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen); const char *xsettings_name = NULL; - XSettingsResult result; - XSettingsSetting *setting = NULL; + const XSettingsSetting *setting; gboolean success = FALSE; GValue tmp_val = G_VALUE_INIT; @@ -1362,9 +1361,8 @@ gdk_x11_screen_get_setting (GdkScreen *screen, if (!xsettings_name) goto out; - result = xsettings_client_get_setting (x11_screen->xsettings_client, - xsettings_name, &setting); - if (result != XSETTINGS_SUCCESS) + setting = xsettings_client_get_setting (x11_screen->xsettings_client, xsettings_name); + if (setting == NULL) goto out; switch (setting->type) @@ -1413,9 +1411,6 @@ gdk_x11_screen_get_setting (GdkScreen *screen, g_value_unset (&tmp_val); out: - if (setting) - xsettings_setting_free (setting); - if (success) return TRUE; else diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index 77aef1e166..87b7b0d2e4 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -531,25 +531,11 @@ xsettings_client_destroy (XSettingsClient *client) free (client); } -XSettingsResult +const XSettingsSetting * xsettings_client_get_setting (XSettingsClient *client, - const char *name, - XSettingsSetting **setting) + const char *name) { - XSettingsSetting *search; - - if (client->settings == NULL) - return XSETTINGS_NO_ENTRY; - - search = g_hash_table_lookup (client->settings, name); - - if (search) - { - *setting = xsettings_setting_copy (search); - return *setting ? XSETTINGS_SUCCESS : XSETTINGS_NO_MEM; - } - else - return XSETTINGS_NO_ENTRY; + return g_hash_table_lookup (client->settings, name); } Bool diff --git a/gdk/x11/xsettings-client.h b/gdk/x11/xsettings-client.h index 0e30641cf5..629e28079c 100644 --- a/gdk/x11/xsettings-client.h +++ b/gdk/x11/xsettings-client.h @@ -63,9 +63,9 @@ void xsettings_client_set_ungrab_func (XSettingsClient *client, void xsettings_client_destroy (XSettingsClient *client); Bool xsettings_client_process_event (XSettingsClient *client, XEvent *xev); -XSettingsResult xsettings_client_get_setting (XSettingsClient *client, - const char *name, - XSettingsSetting **setting); +const XSettingsSetting * + xsettings_client_get_setting (XSettingsClient *client, + const char *name); #ifdef __cplusplus } diff --git a/gdk/x11/xsettings-common.c b/gdk/x11/xsettings-common.c index a57269f4d7..d8f3d37569 100644 --- a/gdk/x11/xsettings-common.c +++ b/gdk/x11/xsettings-common.c @@ -31,53 +31,6 @@ #include #include /* For CARD32 */ -XSettingsSetting * -xsettings_setting_copy (XSettingsSetting *setting) -{ - XSettingsSetting *result; - size_t str_len; - - result = malloc (sizeof *result); - if (!result) - return NULL; - - str_len = strlen (setting->name); - result->name = malloc (str_len + 1); - if (!result->name) - goto err; - - memcpy (result->name, setting->name, str_len + 1); - - result->type = setting->type; - - switch (setting->type) - { - case XSETTINGS_TYPE_INT: - result->data.v_int = setting->data.v_int; - break; - case XSETTINGS_TYPE_COLOR: - result->data.v_color = setting->data.v_color; - break; - case XSETTINGS_TYPE_STRING: - str_len = strlen (setting->data.v_string); - result->data.v_string = malloc (str_len + 1); - if (!result->data.v_string) - goto err; - - memcpy (result->data.v_string, setting->data.v_string, str_len + 1); - break; - } - - return result; - - err: - if (result->name) - free (result->name); - free (result); - - return NULL; -} - int xsettings_setting_equal (XSettingsSetting *setting_a, XSettingsSetting *setting_b) diff --git a/gdk/x11/xsettings-common.h b/gdk/x11/xsettings-common.h index 5fac6c63c7..e90471b9b0 100644 --- a/gdk/x11/xsettings-common.h +++ b/gdk/x11/xsettings-common.h @@ -38,7 +38,6 @@ extern "C" { #define xsettings_client_set_grab_func _gdk_x11_xsettings_client_set_grab_func #define xsettings_client_set_ungrab_func _gdk_x11_xsettings_client_set_ungrab_func #define xsettings_client_process_event _gdk_x11_xsettings_client_process_event -#define xsettings_setting_copy _gdk_x11_xsettings_setting_copy #define xsettings_setting_equal _gdk_x11_xsettings_setting_equal #define xsettings_setting_free _gdk_x11_xsettings_setting_free @@ -91,7 +90,6 @@ struct _XSettingsSetting } data; }; -XSettingsSetting *xsettings_setting_copy (XSettingsSetting *setting); void xsettings_setting_free (XSettingsSetting *setting); int xsettings_setting_equal (XSettingsSetting *setting_a, XSettingsSetting *setting_b);