Add new settings planets-char and aspects-char to the preferences dialog

They are only effective upon chart redraw. A callback must be utilised
to automatically redraw the aspect table upon change.
This commit is contained in:
Gergely Polonkai 2014-07-04 13:13:38 +02:00
parent d8aadc4ffa
commit 582c7e02b9
2 changed files with 39 additions and 1 deletions

View File

@ -7,6 +7,9 @@ static GtkWidget *prefs_dialog = NULL;
typedef struct _AgPreferencesPrivate { typedef struct _AgPreferencesPrivate {
GtkCheckButton *maximized; GtkCheckButton *maximized;
GtkCheckButton *planet_chars;
GtkCheckButton *aspect_chars;
AgSettings *settings; AgSettings *settings;
} AgPreferencesPrivate; } AgPreferencesPrivate;
@ -42,13 +45,16 @@ ag_preferences_class_init(AgPreferencesClass *klass)
gtk_widget_class_set_template_from_resource(widget_class, "/eu/polonkai/gergely/Astrognome/ui/ag-preferences.ui"); gtk_widget_class_set_template_from_resource(widget_class, "/eu/polonkai/gergely/Astrognome/ui/ag-preferences.ui");
gtk_widget_class_bind_template_child_private(widget_class, AgPreferences, maximized); gtk_widget_class_bind_template_child_private(widget_class, AgPreferences, maximized);
gtk_widget_class_bind_template_child_private(widget_class, AgPreferences, planet_chars);
gtk_widget_class_bind_template_child_private(widget_class, AgPreferences, aspect_chars);
} }
static void static void
ag_preferences_init(AgPreferences *prefs) ag_preferences_init(AgPreferences *prefs)
{ {
AgPreferencesPrivate *priv; AgPreferencesPrivate *priv;
GSettings *settings_window; GSettings *settings_window,
*settings_main;
priv = ag_preferences_get_instance_private(prefs); priv = ag_preferences_get_instance_private(prefs);
gtk_widget_init_template(GTK_WIDGET(prefs)); gtk_widget_init_template(GTK_WIDGET(prefs));
@ -57,6 +63,10 @@ ag_preferences_init(AgPreferences *prefs)
settings_window = ag_settings_peek_window_settings(priv->settings); settings_window = ag_settings_peek_window_settings(priv->settings);
g_settings_bind(settings_window, "maximized", priv->maximized, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(settings_window, "maximized", priv->maximized, "active", G_SETTINGS_BIND_DEFAULT);
settings_main = ag_settings_peek_main_settings(priv->settings);
g_settings_bind(settings_main, "planets-char", priv->planet_chars, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(settings_main, "aspects-char", priv->aspect_chars, "active", G_SETTINGS_BIND_DEFAULT);
} }
void void

View File

@ -46,6 +46,34 @@
<property name="top_attach">0</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="planet_chars">
<property name="label" translatable="yes">Use UTF-8 characters for planet symbols</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="aspect_chars">
<property name="label" translatable="yes">Use UTF-8 characters for aspect symbols</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>