static GConfValue *gconf_value_new_g_value(GValue * value) { GConfValue *confValue; GType gType = G_VALUE_TYPE(value); switch (gType) { case G_TYPE_BOOLEAN: confValue = gconf_value_new(GCONF_VALUE_BOOL); gconf_value_set_bool(confValue, g_value_get_boolean(value)); break; case G_TYPE_INT: confValue = gconf_value_new(GCONF_VALUE_INT); gconf_value_set_int(confValue, g_value_get_int(value)); break; case G_TYPE_UINT: confValue = gconf_value_new(GCONF_VALUE_INT); gconf_value_set_int(confValue, g_value_get_uint(value)); break; case G_TYPE_STRING: confValue = gconf_value_new(GCONF_VALUE_STRING); gconf_value_set_string(confValue, g_value_get_string(value)); break; default: return NULL; } return confValue; }
/* Properties dialog */ static void save_macros_to_gconf (MCData *mc) { MCPrefsDialog *dialog; GtkTreeIter iter; GConfValue *patterns; GConfValue *commands; GSList *pattern_list = NULL; GSList *command_list = NULL; GConfClient *client; dialog = &mc->prefs_dialog; if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->macros_store), &iter)) return; patterns = gconf_value_new (GCONF_VALUE_LIST); gconf_value_set_list_type (patterns, GCONF_VALUE_STRING); commands = gconf_value_new (GCONF_VALUE_LIST); gconf_value_set_list_type (commands, GCONF_VALUE_STRING); do { char *pattern = NULL; char *command = NULL; gtk_tree_model_get ( GTK_TREE_MODEL (dialog->macros_store), &iter, 0, &pattern, 1, &command, -1); pattern_list = g_slist_prepend (pattern_list, gconf_value_new_from_string (GCONF_VALUE_STRING, pattern, NULL)); command_list = g_slist_prepend (command_list, gconf_value_new_from_string (GCONF_VALUE_STRING, command, NULL)); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->macros_store), &iter)); pattern_list = g_slist_reverse (pattern_list); command_list = g_slist_reverse (command_list); gconf_value_set_list_nocopy (patterns, pattern_list); pattern_list = NULL; gconf_value_set_list_nocopy (commands, command_list); command_list = NULL; client = gconf_client_get_default (); gconf_client_set (client, "/apps/mini-commander/macro_patterns", patterns, NULL); gconf_client_set (client, "/apps/mini-commander/macro_commands", commands, NULL); gconf_value_free (patterns); gconf_value_free (commands); }
/* Sets a GConf value to the contents of a GtkListStore */ static gboolean list_store_binding_sync_store_to_pref (ListStoreBinding *binding) { GtkTreeModel *tree_model; GtkTreeIter iter; GSList *list; int res; GConfValue *gconf_value; tree_model = GTK_TREE_MODEL (binding->list_store); /* Build list */ list = NULL; res = gtk_tree_model_get_iter_first (tree_model, &iter); while (res) { char *string; GConfValue *tmp_value; gtk_tree_model_get (tree_model, &iter, 0, &string, -1); tmp_value = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (tmp_value, string); list = g_slist_append (list, tmp_value); res = gtk_tree_model_iter_next (tree_model, &iter); } /* Create value */ gconf_value = gconf_value_new (GCONF_VALUE_LIST); gconf_value_set_list_type (gconf_value, GCONF_VALUE_STRING); gconf_value_set_list_nocopy (gconf_value, list); /* Set */ gconf_client_set (bridge->client, binding->key, gconf_value, NULL); /* Store until change notification comes in, so that we are able * to ignore it */ binding->val_changes = g_slist_append (binding->val_changes, gconf_value); binding->sync_idle_id = 0; g_object_unref (binding->list_store); return FALSE; }
static GConfValue * motion_acceleration_from_gconf (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; gfloat motion_acceleration; new_value = gconf_value_new (GCONF_VALUE_FLOAT); if (gconf_value_get_float (value) == -1.0) { int numerator, denominator; get_default_mouse_info (&numerator, &denominator, NULL); motion_acceleration = CLAMP ((gfloat)(numerator / denominator), 0.2, 6.0); } else { motion_acceleration = CLAMP (gconf_value_get_float (value), 0.2, 6.0); } if (motion_acceleration >= 1) gconf_value_set_float (new_value, motion_acceleration + 4); else gconf_value_set_float (new_value, motion_acceleration * 5); return new_value; }
int config_write (const GConfValueType data_type, const char *key, const gpointer data_value) { GConfValue *temp_value; config_open_close (CONFIG_OP_OPEN); temp_value = gconf_value_new (data_type); switch (data_type) { case GCONF_VALUE_STRING: gconf_value_set_string (temp_value, (char *) data_value); break; case GCONF_VALUE_INT: gconf_value_set_int (temp_value, (gint) data_value); break; case GCONF_VALUE_BOOL: gconf_value_set_bool (temp_value, (gboolean) data_value); break; case GCONF_VALUE_FLOAT: case GCONF_VALUE_SCHEMA: case GCONF_VALUE_LIST: case GCONF_VALUE_PAIR: case GCONF_VALUE_INVALID: { error (0, 0, _("Error writing to GConf database: Key type is not supported")); return FALSE; } } gconf_client_set (conf_client, key, temp_value, NULL); return TRUE; }
void eel_gconf_value_set_string_list (GConfValue *value, const GSList *string_list) { const GSList *node; GConfValue *next_value; GSList *value_list; g_return_if_fail (value->type == GCONF_VALUE_LIST); g_return_if_fail (gconf_value_get_list_type (value) == GCONF_VALUE_STRING); value_list = NULL; for (node = string_list; node != NULL; node = node->next) { next_value = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (next_value, node->data); value_list = g_slist_append (value_list, next_value); } gconf_value_set_list (value, value_list); for (node = value_list; node != NULL; node = node->next) { gconf_value_free (node->data); } g_slist_free (value_list); }
/* All of our scales but double_click are on the range 1->10 as a result, we * have a few routines to convert from whatever the gconf key is to our range. */ static GConfValue * double_click_from_gconf (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (new_value, CLAMP ((int) floor ((gconf_value_get_int (value) + 50) / 100.0) * 100, 100, 1000)); return new_value; }
static GConfValue * corner_flip_from_widget (GConfPropertyEditor *peditor, GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_BOOL); gconf_value_set_bool (new_value, (gconf_value_get_int (value) == 1)); return new_value; }
static GConfValue * corner_flip_to_widget (GConfPropertyEditor *peditor, GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (new_value, (value && (value->type == GCONF_VALUE_BOOL) && gconf_value_get_bool (value)) ? 1 : 0); return new_value; }
static GConfValue * action_from_widget (GConfPropertyEditor *peditor, GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (new_value, gconf_enum_to_string (actions_lookup_table, gconf_value_get_int (value))); return new_value; }
static GConfValue * bell_flash_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (new_value, gconf_enum_to_string (bell_flash_enums, gconf_value_get_int (value))); return new_value; }
static GConfValue * drag_threshold_from_gconf (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_FLOAT); gconf_value_set_float (new_value, CLAMP (gconf_value_get_int (value), 1, 10)); return new_value; }
static GConfValue * left_handed_from_gconf (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (new_value, gconf_value_get_bool (value)); return new_value; }
static GConfValue * left_handed_to_gconf (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_BOOL); gconf_value_set_bool (new_value, gconf_value_get_int (value) == 1); return new_value; }
static void install_default_macros_list (GConfClient *client, const char *key, int offset) { GConfSchema *schema; GConfValue *value; GSList *list = NULL; GError *error; int i; error = NULL; schema = gconf_client_get_schema (client, key, &error); if (error) { g_warning (_("Cannot get schema for %s: %s"), key, error->message); g_error_free (error); return; } /* gconf has started to return NULL with no error set. */ g_return_if_fail (schema != NULL); /* Some sanity checks */ g_assert (gconf_schema_get_type (schema) == GCONF_VALUE_LIST); g_assert (gconf_schema_get_list_type (schema) == GCONF_VALUE_STRING); value = gconf_value_new (GCONF_VALUE_LIST); gconf_value_set_list_type (value, GCONF_VALUE_STRING); for (i = 0; i < G_N_ELEMENTS (mc_default_macros); i++) list = g_slist_prepend (list, gconf_value_new_from_string (GCONF_VALUE_STRING, G_STRUCT_MEMBER (char *, &mc_default_macros [i], offset), NULL)); list = g_slist_reverse (list); gconf_value_set_list_nocopy (value, list); list = NULL; gconf_schema_set_default_value_nocopy (schema, value); value = NULL; error = NULL; gconf_client_set_schema (client, key, schema, &error); if (error) { g_warning (_("Cannot set schema for %s: %s"), key, error->message); g_error_free (error); } gconf_schema_free (schema); printf (_("Set default list value for %s\n"), key); }
static GConfValue * toolbar_from_widget (GConfPropertyEditor *peditor, GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (new_value, gconf_enum_to_string (toolbar_style_enums, gconf_value_get_int (value))); return new_value; }
static GConfValue * utils_get_schema_value (DBusMessageIter *iter) { GConfSchema *schema; GConfValue *value; schema = utils_get_schema (iter); value = gconf_value_new (GCONF_VALUE_SCHEMA); gconf_value_set_schema_nocopy (value, schema); return value; }
/* Helper for utils_get_value, reads int/string/float/bool/schema. */ static GConfValue * utils_get_value_helper_fundamental (DBusMessageIter *iter, GConfValueType value_type) { GConfValue *value; GConfSchema *schema; gint32 i; const gchar *s; gdouble d; gboolean b; d(g_print ("Get value (fundamental)\n")); if (value_type == GCONF_VALUE_INVALID) return NULL; value = gconf_value_new (value_type); switch (value_type) { case GCONF_VALUE_INT: dbus_message_iter_get_basic (iter, &i); gconf_value_set_int (value, i); break; case GCONF_VALUE_STRING: dbus_message_iter_get_basic (iter, &s); gconf_value_set_string (value, s); break; case GCONF_VALUE_FLOAT: dbus_message_iter_get_basic (iter, &d); gconf_value_set_float (value, d); break; case GCONF_VALUE_BOOL: dbus_message_iter_get_basic (iter, &b); gconf_value_set_bool (value, b); break; case GCONF_VALUE_SCHEMA: schema = utils_get_schema (iter); gconf_value_set_schema_nocopy (value, schema); break; default: g_assert_not_reached (); } return value; }
static GConfValue * action_to_widget (GConfPropertyEditor *peditor, GConfValue *value) { GConfValue *new_value; const gchar *str; gint val = 0; str = (value && (value->type == GCONF_VALUE_STRING)) ? gconf_value_get_string (value) : NULL; new_value = gconf_value_new (GCONF_VALUE_INT); gconf_string_to_enum (actions_lookup_table, str, &val); gconf_value_set_int (new_value, val); return new_value; }
static GConfValue * motion_acceleration_to_gconf (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; gfloat motion_acceleration; new_value = gconf_value_new (GCONF_VALUE_FLOAT); motion_acceleration = CLAMP (gconf_value_get_float (value), 1.0, 10.0); if (motion_acceleration < 5) gconf_value_set_float (new_value, motion_acceleration / 5.0); else gconf_value_set_float (new_value, motion_acceleration - 4); return new_value; }
static GConfValue * mousekeys_accel_time_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GtkAdjustment *adjustment; gdouble range_upper; GConfValue *new_value; adjustment = GTK_ADJUSTMENT (gconf_property_editor_get_ui_control (peditor)); g_object_get (adjustment, "upper", &range_upper, NULL); new_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (new_value, MAX (0, ((int) range_upper) - gconf_value_get_int (value))); return new_value; }
static GConfValue * toolbar_to_widget (GConfPropertyEditor *peditor, GConfValue *value) { GConfValue *new_value; const gchar *str; gint val; str = (value && (value->type == GCONF_VALUE_STRING)) ? gconf_value_get_string (value) : NULL; if (!gconf_string_to_enum (toolbar_style_enums, str, &val)) val = 0; new_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (new_value, val); return new_value; }
static GConfValue * bell_flash_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; const gchar *str; gint val = 2; str = (value && (value->type == GCONF_VALUE_STRING)) ? gconf_value_get_string (value) : NULL; new_value = gconf_value_new (GCONF_VALUE_INT); if (value->type == GCONF_VALUE_STRING) { gconf_string_to_enum (bell_flash_enums, str, &val); } gconf_value_set_int (new_value, val); return new_value; }
static GConfValue * threshold_from_gconf (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; new_value = gconf_value_new (GCONF_VALUE_FLOAT); if (gconf_value_get_int (value) == -1) { int threshold; get_default_mouse_info (NULL, NULL, &threshold); gconf_value_set_float (new_value, CLAMP (threshold, 1, 10)); } else { gconf_value_set_float (new_value, CLAMP (gconf_value_get_int (value), 1, 10)); } return new_value; }
/* Helper for utils_get_value, reads a pair. The pair is a struct with the two * values and two fundamental values (type, value, type, value). */ static GConfValue * utils_get_value_helper_pair (DBusMessageIter *iter) { GConfValue *value; DBusMessageIter struct_iter; gint32 car_type, cdr_type; GConfValue *car_value = NULL, *cdr_value = NULL; d(g_print ("Get value (pair)\n")); value = gconf_value_new (GCONF_VALUE_PAIR); /* Get the pair types. */ dbus_message_iter_recurse (iter, &struct_iter); dbus_message_iter_get_basic (&struct_iter, &car_type); dbus_message_iter_next (&struct_iter); dbus_message_iter_get_basic (&struct_iter, &cdr_type); /* Get the values. */ dbus_message_iter_next (&struct_iter); if (car_type == GCONF_VALUE_SCHEMA) car_value = utils_get_schema_value (&struct_iter); else if (car_type != GCONF_VALUE_INVALID) car_value = utils_get_value_helper_fundamental (&struct_iter, car_type); dbus_message_iter_next (&struct_iter); if (cdr_type == GCONF_VALUE_SCHEMA) cdr_value = utils_get_schema_value (&struct_iter); else if (cdr_type != GCONF_VALUE_INVALID) cdr_value = utils_get_value_helper_fundamental (&struct_iter, cdr_type); if (car_value) gconf_value_set_car_nocopy (value, car_value); if (cdr_value) gconf_value_set_cdr_nocopy (value, cdr_value); return value; }
static void update_login_options (GtkWidget *widget, UmLoginOptions *d) { GError *error; gboolean active; GConfValue *value; const gchar *key = NULL; gchar *value_string; if (widget == d->userlist_check || widget == d->power_check) { active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); key = g_object_get_data (G_OBJECT (widget), "gconf-key"); } else { g_warning ("unhandled option in update_login_options"); return; } error = NULL; value = gconf_value_new (GCONF_VALUE_BOOL); gconf_value_set_bool (value, !active); value_string = gconf_value_encode (value); if (!dbus_g_proxy_call (d->proxy, "SetMandatoryValue", &error, G_TYPE_STRING, key, G_TYPE_STRING, value_string, G_TYPE_INVALID, G_TYPE_INVALID)) { g_warning ("error calling SetMandatoryValue: %s\n", error->message); g_error_free (error); } g_free (value_string); gconf_value_free (value); update_boolean_from_gconf (widget, d); }
static GConfValue * application_font_to_gconf (GConfPropertyEditor *peditor, GConfValue *value) { GConfValue *new_value; const char *new_font; GtkWidget *font_button; gint danger_level; font_button = GTK_WIDGET (gconf_property_editor_get_ui_control (peditor)); g_return_val_if_fail (font_button != NULL, NULL); new_value = gconf_value_new (GCONF_VALUE_STRING); new_font = gconf_value_get_string (value); if (font_dangerous (old_font)) { /* If we're already too large, we don't warn again. */ gconf_value_set_string (new_value, new_font); return new_value; } danger_level = font_dangerous (new_font); if (danger_level) { GtkWidget *warning_dialog, *apply_button; const gchar *warning_label; gchar *warning_label2; warning_label = _("Font may be too large"); if (danger_level > MAX_FONT_POINT_WITHOUT_WARNING) { warning_label2 = g_strdup_printf (ngettext ( "The font selected is %d point large, " "and may make it difficult to effectively " "use the computer. It is recommended that " "you select a size smaller than %d.", "The font selected is %d points large, " "and may make it difficult to effectively " "use the computer. It is recommended that " "you select a size smaller than %d.", danger_level), danger_level, MAX_FONT_POINT_WITHOUT_WARNING); } else { warning_label2 = g_strdup_printf (ngettext ( "The font selected is %d point large, " "and may make it difficult to effectively " "use the computer. It is recommended that " "you select a smaller sized font.", "The font selected is %d points large, " "and may make it difficult to effectively " "use the computer. It is recommended that " "you select a smaller sized font.", danger_level), danger_level); } warning_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, warning_label); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (warning_dialog), warning_label2); gtk_dialog_add_button (GTK_DIALOG (warning_dialog), _("Use previous font"), GTK_RESPONSE_CLOSE); apply_button = gtk_button_new_with_label (_("Use selected font")); gtk_button_set_image (GTK_BUTTON (apply_button), gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON)); gtk_dialog_add_action_widget (GTK_DIALOG (warning_dialog), apply_button, GTK_RESPONSE_APPLY); GTK_WIDGET_SET_FLAGS (apply_button, GTK_CAN_DEFAULT); gtk_widget_show (apply_button); gtk_dialog_set_default_response (GTK_DIALOG (warning_dialog), GTK_RESPONSE_CLOSE); g_free (warning_label2); if (gtk_dialog_run (GTK_DIALOG (warning_dialog)) == GTK_RESPONSE_APPLY) { gconf_value_set_string (new_value, new_font); } else { gconf_value_set_string (new_value, old_font); gtk_font_button_set_font_name (GTK_FONT_BUTTON (font_button), old_font); } gtk_widget_destroy (warning_dialog); } else { gconf_value_set_string (new_value, new_font); } return new_value; }
static GConfValue * _to_gconf_value (const GValue *value) { GConfValue *gv; GType type = G_VALUE_TYPE (value); switch (type) { case G_TYPE_STRING: { gv = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (gv, g_value_get_string (value)); } break; case G_TYPE_INT: { gv = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gv, g_value_get_int (value)); } break; case G_TYPE_UINT: { gv = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gv, g_value_get_uint (value)); } break; case G_TYPE_BOOLEAN: { gv = gconf_value_new (GCONF_VALUE_BOOL); gconf_value_set_bool (gv, g_value_get_boolean (value)); } break; case G_TYPE_DOUBLE: { gv = gconf_value_new (GCONF_VALUE_FLOAT); gconf_value_set_float (gv, g_value_get_double (value)); } break; case G_TYPE_FLOAT: { gv = gconf_value_new (GCONF_VALUE_FLOAT); gconf_value_set_float (gv, g_value_get_float (value)); } break; default: if (type == G_TYPE_VALUE_ARRAY) { GSList *l = NULL; GType list_type = G_TYPE_STRING; GValueArray *array = g_value_get_boxed (value); gint i; if (array && array->n_values > 0) { list_type = G_VALUE_TYPE (&(array->values[0])); } gv = gconf_value_new (GCONF_VALUE_LIST); switch (list_type) { case G_TYPE_STRING: gconf_value_set_list_type (gv, GCONF_VALUE_STRING); break; case G_TYPE_INT: case G_TYPE_UINT: gconf_value_set_list_type (gv, GCONF_VALUE_INT); break; case G_TYPE_BOOLEAN: gconf_value_set_list_type (gv, GCONF_VALUE_BOOL); break; case G_TYPE_FLOAT: case G_TYPE_DOUBLE: gconf_value_set_list_type (gv, GCONF_VALUE_FLOAT); break; default: g_assert_not_reached (); } for (i = 0; array && i < array->n_values; i++) { GConfValue *tmp; g_assert (G_VALUE_TYPE (&(array->values[i])) == list_type); tmp = _to_gconf_value (&(array->values[i])); l = g_slist_append (l, tmp); } gconf_value_set_list_nocopy (gv, l); } else g_assert_not_reached (); } return gv; }
static GConfValue *convertString(const QString &str) { GConfValue *v = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (v, str.toUtf8().data()); return v; }
/* Syncs an object property to GConf */ static void prop_binding_sync_prop_to_pref (PropBinding *binding) { GValue value; GConfValue *gconf_value; memset (&value, 0, sizeof (GValue)); g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (binding->prop)); g_object_get_property (binding->object, binding->prop->name, &value); switch (value.g_type) { case G_TYPE_STRING: gconf_value = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (gconf_value, g_value_get_string (&value)); break; case G_TYPE_INT: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_int (&value)); break; case G_TYPE_UINT: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_uint (&value)); break; case G_TYPE_LONG: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_long (&value)); break; case G_TYPE_ULONG: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_ulong (&value)); break; case G_TYPE_INT64: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_int64 (&value)); break; case G_TYPE_UINT64: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_uint64 (&value)); break; case G_TYPE_CHAR: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_char (&value)); break; case G_TYPE_UCHAR: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_uchar (&value)); break; case G_TYPE_ENUM: gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_enum (&value)); break; case G_TYPE_BOOLEAN: gconf_value = gconf_value_new (GCONF_VALUE_BOOL); gconf_value_set_bool (gconf_value, g_value_get_boolean (&value)); break; case G_TYPE_DOUBLE: gconf_value = gconf_value_new (GCONF_VALUE_FLOAT); #ifdef HAVE_CORBA_GCONF /* FIXME we cast to a float explicitly as CORBA GConf * uses doubles in its API, but treats them as floats * when transporting them over CORBA. See #322837 */ gconf_value_set_float (gconf_value, (float) g_value_get_double (&value)); #else gconf_value_set_float (gconf_value, g_value_get_double (&value)); #endif break; case G_TYPE_FLOAT: gconf_value = gconf_value_new (GCONF_VALUE_FLOAT); gconf_value_set_float (gconf_value, g_value_get_float (&value)); break; default: if (g_type_is_a (value.g_type, G_TYPE_ENUM)) { gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, g_value_get_enum (&value)); } else { g_warning ("prop_binding_sync_prop_to_pref: " "Unhandled value type '%s'.\n", g_type_name (value.g_type)); goto done; } break; } /* Set to GConf */ gconf_client_set (bridge->client, binding->key, gconf_value, NULL); /* Store until change notification comes in, so that we are able * to ignore it */ binding->val_changes = g_slist_append (binding->val_changes, gconf_value); done: g_value_unset (&value); }