From f782bd592c47cfa0aa610a1447e16795f56f7d70 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 27 Jul 2007 13:11:13 +0300 Subject: [PATCH] Use a plain gtk_range for filter settings. The hildon bars look very-bad with a big range. Load and save osm filter. Show hardware button configuration dialog under hildon only. Misc other changes. --- src/settings-gconf.h | 1 + src/settings-gui.c | 51 ++++++++++++++++++++------------------------ src/settings.h | 7 +++--- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/src/settings-gconf.h b/src/settings-gconf.h index 3c07f41..66bbba8 100644 --- a/src/settings-gconf.h +++ b/src/settings-gconf.h @@ -33,6 +33,7 @@ #define GCONF_KEY_GPS_FILTER_HDOP GCONF_KEY_PREFIX"/gps_filter_hdop" #define GCONF_KEY_GPS_FILTER_VDOP GCONF_KEY_PREFIX"/gps_filter_vdop" #define GCONF_KEY_GPS_FILTER_ANGLE GCONF_KEY_PREFIX"/gps_filter_angle" +#define GCONF_KEY_GPS_FILTER_OSM GCONF_KEY_PREFIX"/gps_filter_osm" #define GCONF_KEY_MAP_URI_FORMAT GCONF_KEY_PREFIX"/map_uri_format" #define GCONF_KEY_MAP_ZOOM_STEPS GCONF_KEY_PREFIX"/map_zoom_steps" diff --git a/src/settings-gui.c b/src/settings-gui.c index 249ea63..902d49a 100644 --- a/src/settings-gui.c +++ b/src/settings-gui.c @@ -93,8 +93,7 @@ settings_dialog_hardkeys_reset(GtkWidget * widget, KeysDialogInfo * cdi) printf("%s()\n", __PRETTY_FUNCTION__); confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), - _ - ("Reset all hardware keys to their original defaults?")); + _("Reset all hardware keys to their original defaults?")); if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) { gint i; @@ -141,7 +140,7 @@ gboolean settings_dialog_hardkeys(GtkWidget * widget, GtkWidget * parent) label = gtk_label_new(""), 0, 1, i, i + 1, GTK_FILL, 0, 2, 1); gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); -#if 0 +#ifdef WITH_HILDON gtk_label_set_markup(GTK_LABEL(label), CUSTOM_KEY_ICON[i]); #endif gtk_table_attach(GTK_TABLE(table), @@ -428,8 +427,8 @@ gboolean settings_dialog() GtkWidget *chk_gps_filter; GtkWidget *num_angle; - GtkWidget *num_hdop_ratio; - GtkWidget *num_vdop_ratio; + GtkWidget *num_hdop; + GtkWidget *num_vdop; GtkWidget *num_osm_dist; BrowseInfo browse_info = { 0, 0 }; @@ -446,10 +445,10 @@ gboolean settings_dialog() #ifdef WITH_HILDON /* Enable the help button. */ ossohelp_dialog_help_enable(GTK_DIALOG(dialog), HELP_ID_SETTINGS, _osso); -#endif gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), btn_buttons = gtk_button_new_with_label(_("Hardware Keys..."))); +#endif gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), btn_colors = gtk_button_new_with_label(_("Colors..."))); @@ -481,8 +480,7 @@ gboolean settings_dialog() /* Note!. */ gtk_table_attach(GTK_TABLE(table), - label = - gtk_label_new(_ + label = gtk_label_new(_ ("Note: You can enter a device path\n" "(e.g. \"/dev/rfcomm0\").")), 0, 2, 1, 2, GTK_FILL, 0, 2, 4); @@ -501,35 +499,27 @@ gboolean settings_dialog() gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Horizontal")), 0, 1, 1, 2, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(table), num_hdop_ratio = hildon_controlbar_new(), + gtk_table_attach(GTK_TABLE(table), num_hdop = gtk_hscale_new_with_range(0, 200, 0.1), 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4); - hildon_controlbar_set_range(HILDON_CONTROLBAR(num_hdop_ratio), 0, 200); - force_min_visible_bars(HILDON_CONTROLBAR(num_hdop_ratio), 1); gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Vertical")), 0, 1, 2, 3, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(table), num_vdop_ratio = hildon_controlbar_new(), + gtk_table_attach(GTK_TABLE(table), num_vdop = gtk_hscale_new_with_range(0, 200, 0.1), 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 4); - hildon_controlbar_set_range(HILDON_CONTROLBAR(num_vdop_ratio), 0, 200); - force_min_visible_bars(HILDON_CONTROLBAR(num_vdop_ratio), 1); gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Angle")), 0, 1, 3, 4, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(table), num_angle = hildon_controlbar_new(), + gtk_table_attach(GTK_TABLE(table), num_angle = gtk_hscale_new_with_range(0, 45, 0.5), 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 2, 4); - hildon_controlbar_set_range(HILDON_CONTROLBAR(num_angle), 0, 45); - force_min_visible_bars(HILDON_CONTROLBAR(num_angle), 1); /* Distance to OSM data */ - gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("OSM Data")), + gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Distance to OSM Data")), 0, 1, 4, 5, GTK_FILL, 0, 2, 4); gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f); - gtk_table_attach(GTK_TABLE(table), num_osm_dist = hildon_controlbar_new(), + gtk_table_attach(GTK_TABLE(table), num_osm_dist = gtk_hscale_new_with_range(0, 5000, 1), 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, 0, 2, 4); - hildon_controlbar_set_range(HILDON_CONTROLBAR(num_osm_dist), 0, 5000); - force_min_visible_bars(HILDON_CONTROLBAR(num_osm_dist), 1); /* Auto-Center page. */ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), @@ -780,9 +770,10 @@ gboolean settings_dialog() gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_speed_location), _speed_location); gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_info_font_size), _info_font_size); - hildon_controlbar_set_value(HILDON_CONTROLBAR(num_hdop_ratio),(gint) _filter_hdop); - hildon_controlbar_set_value(HILDON_CONTROLBAR(num_vdop_ratio),(gint) _filter_vdop); - hildon_controlbar_set_value(HILDON_CONTROLBAR(num_angle),(gint) _filter_angle); + gtk_range_set_value(num_hdop, _filter_hdop); + gtk_range_set_value(num_vdop, _filter_vdop); + gtk_range_set_value(num_angle, _filter_angle); + gtk_range_set_value(num_osm_dist, _filter_osm); gtk_widget_show_all(dialog); @@ -841,9 +832,10 @@ gboolean settings_dialog() _voice_pitch = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_voice_pitch)); _enable_voice = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_enable_voice)); - _filter_angle =(gfloat)hildon_controlbar_get_value(HILDON_CONTROLBAR(num_angle)); - _filter_hdop =(gfloat)hildon_controlbar_get_value(HILDON_CONTROLBAR(num_hdop_ratio)); - _filter_vdop =(gfloat)hildon_controlbar_get_value(HILDON_CONTROLBAR(num_vdop_ratio)); + _filter_angle = gtk_range_get_value(GTK_RANGE(num_angle)); + _filter_hdop = gtk_range_get_value(GTK_RANGE(num_hdop)); + _filter_vdop = gtk_range_get_value(GTK_RANGE(num_vdop)); + _filter_osm = gtk_range_get_value(GTK_RANGE(num_osm_dist)); _gps_filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_gps_filter)); if (_db) { @@ -872,7 +864,10 @@ gboolean settings_dialog() break; } - gtk_widget_destroy(dialog); /* Destroying causes a crash (!?!?!??!) huh?*/ +#ifndef WITH_HILDON + /* Destroying causes a crash (!?!?!??!) huh? in hildon only, plain gtk is ok so...*/ + gtk_widget_destroy(dialog); +#endif vprintf("%s(): return %d\n", __PRETTY_FUNCTION__, rcvr_changed); return rcvr_changed; diff --git a/src/settings.h b/src/settings.h index 27f413d..014fcae 100644 --- a/src/settings.h +++ b/src/settings.h @@ -24,9 +24,10 @@ gboolean _enable_gps; gboolean _gps_info; gboolean _gps_filter; -gfloat _filter_hdop; -gfloat _filter_vdop; -gfloat _filter_angle; +gdouble _filter_hdop; +gdouble _filter_vdop; +gdouble _filter_angle; +gdouble _filter_osm; gint _show_tracks; gboolean _show_scale; -- 2.39.5