static void garu_effects_equalizer_scale_changed (GtkRange *range, gchar *band) { GaruApplication *app; GaruPlayer *player; GSettings *settings; gint active, i; gchar *settings_band; app = GARU_APPLICATION (g_application_get_default ()); settings = garu_application_get_settings (app); player = garu_application_get_player (app); active = g_settings_get_int (settings, "equalizer-preset"); if (!equalizer_changed_by_combo_box) { if (!equalizer_custom_selected) { for (i = 0; i < G_N_ELEMENTS (eq_bands); i++) { settings_band = g_strdup_printf ("eq-custom-band%d", i); g_settings_set_double (settings, settings_band, eq_presets_values[active][i]); g_free (settings_band); } g_settings_set_int (settings, "equalizer-preset", G_N_ELEMENTS (eq_presets) - 1); equalizer_custom_selected = TRUE; } g_settings_set_double (settings, band, gtk_range_get_value (range)); } garu_player_update_equalizer (player); }
static void gth_file_tool_resize_destroy_options (GthFileTool *base) { GthFileToolResize *self; GtkWidget *window; GtkWidget *viewer_page; GtkWidget *viewer; GSettings *viewer_settings; self = (GthFileToolResize *) base; if (self->priv->update_size_id != 0) { g_source_remove (self->priv->update_size_id); self->priv->update_size_id = 0; } if (self->priv->builder != NULL) { int unit; /* save the dialog options */ unit = gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox"))); g_settings_set_enum (self->priv->settings, PREF_RESIZE_UNIT, unit); g_settings_set_double (self->priv->settings, PREF_RESIZE_WIDTH, (float) gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")))); g_settings_set_double (self->priv->settings, PREF_RESIZE_HEIGHT, (float) gtk_spin_button_get_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")))); g_settings_set_int (self->priv->settings, PREF_RESIZE_ASPECT_RATIO_WIDTH, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton")))); g_settings_set_int (self->priv->settings, PREF_RESIZE_ASPECT_RATIO_HEIGHT, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton")))); g_settings_set_enum (self->priv->settings, PREF_RESIZE_ASPECT_RATIO, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox))); g_settings_set_boolean (self->priv->settings, PREF_RESIZE_ASPECT_RATIO_INVERT, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton")))); g_settings_set_boolean (self->priv->settings, PREF_RESIZE_HIGH_QUALITY, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("high_quality_checkbutton")))); /* destroy the options data */ _cairo_clear_surface (&self->priv->new_image); _cairo_clear_surface (&self->priv->preview); _g_clear_object (&self->priv->builder); } window = gth_file_tool_get_window (GTH_FILE_TOOL (self)); viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window)); gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page)); /* restore the zoom quality */ viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page)); viewer_settings = g_settings_new (GTHUMB_IMAGE_VIEWER_SCHEMA); gth_image_viewer_set_zoom_quality (GTH_IMAGE_VIEWER (viewer), g_settings_get_enum (viewer_settings, PREF_IMAGE_VIEWER_ZOOM_QUALITY)); g_object_unref (viewer_settings); }
void config_save(MinbarConfig* config) { g_settings_set_string(city, "name", config->city); g_settings_set_double(city, "latitude", config->latitude); g_settings_set_double(city, "longitude", config->longitude); g_settings_set_double(city, "correction", config->correction); g_settings_set_int(prefs, "method", config->method); g_settings_set_boolean(prefs, "start-hidden", config->start_hidden); g_settings_set_boolean(prefs, "closes", config->close_closes); g_settings_set_boolean(prefs, "notification", config->notification); g_settings_set_int(prefs, "notification-time", config->notification_time); g_settings_set_boolean(athan, "play", config->athan_enabled); g_settings_set_string(athan, "normal", config->athan_normal); g_settings_set_string(athan, "subh", config->athan_subh); }
void go_conf_set_double (GOConfNode *node, gchar const *key, gdouble val) { GOConfNode *real_node = go_conf_get_node (node, key); if (!real_node) { d (g_warning ("Unable to set key '%s'", key)); return; } g_settings_set_double (real_node->settings, real_node->key, val); go_conf_free_node (real_node); }
void UpdateAppsScaling(double scale) { changing_gnome_settings_ = true; unsigned integer_scaling = std::max<unsigned>(1, scale); double point_scaling = scale / static_cast<double>(integer_scaling); double text_scale_factor = parent_->font_scaling() * point_scaling; glib::Variant default_cursor_size(g_settings_get_default_value(gnome_ui_settings_, GNOME_CURSOR_SIZE.c_str()), glib::StealRef()); int cursor_size = std::round(default_cursor_size.GetInt32() * point_scaling * cursor_scale_); g_settings_set_int(gnome_ui_settings_, GNOME_CURSOR_SIZE.c_str(), cursor_size); g_settings_set_uint(gnome_ui_settings_, GNOME_SCALE_FACTOR.c_str(), integer_scaling); g_settings_set_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str(), text_scale_factor); changing_gnome_settings_ = false; }
static void effects_slider_changed (GtkRange *slider, ZoomOptionsPrivate *priv) { gchar **keys, **key; gdouble value; keys = g_object_get_data (G_OBJECT (slider), "settings-keys"); value = gtk_range_get_value (slider); for (key = keys; *key; key++) { g_settings_set_double (priv->settings, *key, value); } }
static void dialog_am_pm_to_button_clicked_cb (GtkButton *button, CcNightLightDialog *self) { gdouble value; value = g_settings_get_double (self->settings_display, "night-light-schedule-to"); if (value > 12.f) value -= 12.f; else value += 12.f; if (value >= 24.f) value = fmod (value, 24); g_settings_set_double (self->settings_display, "night-light-schedule-to", value); g_debug ("new value = %.3f", value); }
static void xhairs_color_opacity_changed (GtkColorButton *button, ZoomOptionsPrivate *priv) { GdkRGBA rgba; gchar *color_string; gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &rgba); color_string = g_strdup_printf ("#%02x%02x%02x", TO_HEX(rgba.red), TO_HEX(rgba.green), TO_HEX(rgba.blue)); g_settings_set_string (priv->settings, "cross-hairs-color", color_string); g_free (color_string); g_settings_set_double (priv->settings, "cross-hairs-opacity", rgba.alpha); }
static void pointer_speed_scale_event (GtkRange *scale, GtkBuilder *dialog) { gdouble value; GSettings *settings; GtkAdjustment *adjustment; if (GTK_WIDGET (scale) == WID ("pointer_speed_scale")) settings = mouse_settings; else settings = touchpad_settings; g_settings_set_double (settings, "motion-acceleration", gtk_range_get_value (scale)); adjustment = gtk_range_get_adjustment (scale); value = gtk_adjustment_get_upper (adjustment) - gtk_range_get_value (scale) + 1; g_settings_set_int (settings, "motion-threshold", value); }
static void text_scaling_factor_combo_box_changed (GtkComboBox *box, CcUaPanel *panel) { CcUaPanelPrivate *priv = panel->priv; GtkTreeIter iter; gfloat factor; gtk_combo_box_get_active_iter (box, &iter); gtk_tree_model_get (gtk_combo_box_get_model (box), &iter, DPI_MODEL_FACTOR_COLUMN, &factor, -1); if (factor == 1.0) g_settings_reset (priv->interface_settings, "text-scaling-factor"); else g_settings_set_double (priv->interface_settings, "text-scaling-factor", factor); }
static void dpi_value_changed (GtkSpinButton *spinner, GSettings *settings) { /* Like any time when using a spin button with GSettings, there is * a race condition here. When we change, we send the new * value to GSettings, then restore to the old value until * we get a response to emulate the proper model/view behavior. * * If the user changes the value faster than responses are * received from GSettings, this may cause mildly strange effects. */ if (!in_change) { gdouble new_dpi = gtk_spin_button_get_value (spinner); g_settings_set_double (settings, FONT_DPI_KEY, new_dpi); dpi_load (settings, spinner); } }
gboolean gnc_gsettings_set_float (const gchar *schema, const gchar *key, gdouble value) { gboolean result = FALSE; GSettings *settings_ptr = gnc_gsettings_get_settings_ptr (schema); g_return_val_if_fail (G_IS_SETTINGS (settings_ptr), FALSE); if (gnc_gsettings_is_valid_key (settings_ptr, key)) { result = g_settings_set_double (settings_ptr, key, value); if (!result) PERR ("Unable to set value for key %s in schema %s", key, schema); } else PERR ("Invalid key %s for schema %s", key, schema); return result; }
static void dialog_time_to_value_changed_cb (GtkAdjustment *adjustment, CcNightLightDialog *self) { gdouble value; if (self->ignore_value_changed) return; value = dialog_adjustments_get_frac_hours (self, self->adjustment_to_hours, self->adjustment_to_minutes, self->stack_to); if (value >= 24.f) value = fmod (value, 24); g_debug ("new value = %.3f", value); g_settings_set_double (self->settings_display, "night-light-schedule-to", value); }
void gm_pref_store_set_float(GmPrefStore * store, const gchar * key, gfloat value) { if (store == NULL) return; #if HAVE_GSETTINGS g_settings_set_double(store->settings, key, value); #else #ifdef HAVE_GCONF gchar *full_key; full_key = g_strdup_printf("/apps/%s/preferences/%s", store->context, key); gconf_client_set_float(store->gconf, full_key, value, NULL); g_free(full_key); #else g_key_file_set_double(store->keyfile, store->context, key, value); #endif #endif }
static void change_delay_spinbutton_value_changed_cb (GtkSpinButton *spinbutton, BrowserData *data) { g_settings_set_double (data->settings, PREF_SLIDESHOW_CHANGE_DELAY, gtk_spin_button_get_value (spinbutton)); }
static void terminal_profile_gsettings_changeset_add (TerminalProfile *profile, GSettings *changeset, GParamSpec *pspec) { TerminalProfilePrivate *priv = profile->priv; char *key; const GValue *value; /* FIXME: do this? */ #if 0 if (priv->locked[pspec->param_id]) return; if (!g_settings_is_writable (priv->settings, gsettings_key, NULL)) return; #endif key = g_param_spec_get_qdata (pspec, gsettings_key_quark); if (!key) return; value = g_value_array_get_nth (priv->properties, pspec->param_id); _terminal_debug_print (TERMINAL_DEBUG_PROFILE, "Adding pspec %s with value %s to the GSettings changeset\n", pspec->name, g_strdup_value_contents (value)); if (G_IS_PARAM_SPEC_BOOLEAN (pspec)) g_settings_set_boolean (changeset, key, g_value_get_boolean (value)); else if (G_IS_PARAM_SPEC_STRING (pspec)) { const char *str; str = g_value_get_string (value); g_settings_set_string (changeset, key, str ? str : ""); } else if (G_IS_PARAM_SPEC_ENUM (pspec)) { const GEnumValue *eval; eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, g_value_get_enum (value)); g_settings_set_enum (changeset, key, eval->value); } else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_COLOR) { GdkColor *color; char str[16]; color = g_value_get_boxed (value); if (!color) goto cleanup; g_snprintf (str, sizeof (str), "#%04X%04X%04X", color->red, color->green, color->blue); g_settings_set_string (changeset, key, str); } else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION) { PangoFontDescription *font_desc; char *font; font_desc = g_value_get_boxed (value); if (!font_desc) goto cleanup; font = pango_font_description_to_string (font_desc); g_settings_set_string (changeset, key, font); g_free (font); } else if (G_IS_PARAM_SPEC_DOUBLE (pspec)) g_settings_set_double (changeset, key, g_value_get_double (value)); else if (G_IS_PARAM_SPEC_INT (pspec)) g_settings_set_int (changeset, key, g_value_get_int (value)); else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) && G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_COLOR) { GValueArray *array; GString *string; guint n_colors, i; /* We need to do this ourselves, because the gtk_color_selection_palette_to_string * does not carry all the bytes, and xterm's palette is messed up... */ array = g_value_get_boxed (value); if (!array) goto cleanup; n_colors = array->n_values; string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */); for (i = 0; i < n_colors; ++i) { GdkColor *color; if (i > 0) g_string_append_c (string, ':'); color = g_value_get_boxed (g_value_array_get_nth (array, i)); if (!color) continue; g_string_append_printf (string, "#%04X%04X%04X", color->red, color->green, color->blue); } g_settings_set_string (changeset, key, string->str); g_string_free (string, TRUE); } else g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), pspec->name); cleanup: return; }
Impl(Settings* owner) : parent_(owner) , usettings_(g_settings_new(SETTINGS_NAME.c_str())) , lim_settings_(g_settings_new(LIM_SETTINGS.c_str())) , ui_settings_(g_settings_new(UI_SETTINGS.c_str())) , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str())) , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str())) , launcher_widths_(monitors::MAX, DEFAULT_LAUNCHER_WIDTH) , cached_form_factor_(FormFactor::DESKTOP) , cursor_scale_(1.0) , cached_double_click_activate_(true) , changing_gnome_settings_(false) , lowGfx_(false) { parent_->form_factor.SetGetterFunction(sigc::mem_fun(this, &Impl::GetFormFactor)); parent_->form_factor.SetSetterFunction(sigc::mem_fun(this, &Impl::SetFormFactor)); parent_->double_click_activate.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDoubleClickActivate)); for (unsigned i = 0; i < monitors::MAX; ++i) em_converters_.emplace_back(std::make_shared<EMConverter>()); CacheFormFactor(); CacheDoubleClickActivate(); // The order is important here, DPI is the last thing to be updated UpdateLimSetting(); UpdateTextScaleFactor(); UpdateCursorScaleFactor(); UpdateFontSize(); UpdateDPI(); UScreen::GetDefault()->changed.connect(sigc::hide(sigc::hide(sigc::mem_fun(this, &Impl::UpdateDPI)))); signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + FORM_FACTOR, [this] (GSettings*, const gchar*) { CacheFormFactor(); }); signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + DOUBLE_CLICK_ACTIVATE, [this] (GSettings*, const gchar*) { CacheDoubleClickActivate(); parent_->double_click_activate.changed.emit(cached_double_click_activate_); }); signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + LIM_KEY, [this] (GSettings*, const gchar*) { UpdateLimSetting(); }); signals_.Add<void, GSettings*, const gchar*>(ubuntu_ui_settings_, "changed::" + SCALE_FACTOR, [this] (GSettings*, const gchar* t) { UpdateDPI(); }); signals_.Add<void, GSettings*, const gchar*>(ui_settings_, "changed::" + TEXT_SCALE_FACTOR, [this] (GSettings*, const gchar* t) { UpdateTextScaleFactor(); UpdateDPI(); }); signals_.Add<void, GSettings*, const gchar*>(ui_settings_, "changed::" + CURSOR_SCALE_FACTOR, [this] (GSettings*, const gchar* t) { UpdateCursorScaleFactor(); UpdateDPI(); }); signals_.Add<void, GSettings*, const gchar*>(ui_settings_, "changed::" + APP_SCALE_MONITOR, [this] (GSettings*, const gchar* t) { UpdateDPI(); }); signals_.Add<void, GSettings*, const gchar*>(ui_settings_, "changed::" + APP_USE_MAX_SCALE, [this] (GSettings*, const gchar* t) { UpdateDPI(); }); signals_.Add<void, GSettings*, const gchar*>(gnome_ui_settings_, "changed::" + GNOME_FONT_NAME, [this] (GSettings*, const gchar* t) { UpdateFontSize(); UpdateDPI(); }); signals_.Add<void, GSettings*, const gchar*>(gnome_ui_settings_, "changed::" + GNOME_TEXT_SCALE_FACTOR, [this] (GSettings*, const gchar* t) { if (!changing_gnome_settings_) { double new_scale_factor = g_settings_get_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str()); g_settings_set_double(ui_settings_, TEXT_SCALE_FACTOR.c_str(), new_scale_factor); } }); signals_.Add<void, GSettings*, const gchar*>(lim_settings_, "changed", [this] (GSettings*, const gchar*) { UpdateLimSetting(); }); }