Use better dictionary syntax in schema file
[projects/chimara/chimara.git] / player / preferences.c
index 504cbd6227e31fb5ad70089c35f82fd49beb76ee..f2cbaf085973c09c1e24bfed7b1a33bc8c10656f 100644 (file)
@@ -88,9 +88,16 @@ preferences_create(ChimaraGlk *glk)
        g_signal_connect(selection, "changed", G_CALLBACK(style_tree_select_callback), glk);
 
        /* Bind the preferences to the entries in the preferences file */
-       extern GSettings *settings;
+       extern GSettings *prefs_settings;
        GObject *flep = G_OBJECT( load_object("flep") );
-       g_settings_bind(settings, "flep", flep, "active", G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind(prefs_settings, "flep", flep, "active", G_SETTINGS_BIND_DEFAULT);
+       GtkFileChooser *blorb_chooser = GTK_FILE_CHOOSER( load_object("blorb_file_chooser") );
+       char *filename;
+       g_settings_get(prefs_settings, "resource-path", "ms", &filename);
+       if(filename) {
+               gtk_file_chooser_set_filename(blorb_chooser, filename);
+               g_free(filename);
+       }
 }
 
 static void
@@ -116,9 +123,9 @@ style_tree_select_callback(GtkTreeSelection *selection, ChimaraGlk *glk)
 }
 
 void
-on_toggle_left(GtkToggleAction *action, ChimaraGlk *glk) {
+on_toggle_left(GtkToggleToolButton *button, ChimaraGlk *glk) {
        /* No nothing if the button is deactivated */
-       if( !gtk_toggle_action_get_active(action) ) 
+       if( !gtk_toggle_tool_button_get_active(button) )
                return;
 
        /* Untoggle other alignment options */
@@ -134,8 +141,8 @@ on_toggle_left(GtkToggleAction *action, ChimaraGlk *glk) {
 }
 
 void
-on_toggle_center(GtkToggleAction *action, ChimaraGlk *glk) {
-       if( !gtk_toggle_action_get_active(action) )
+on_toggle_center(GtkToggleToolButton *button, ChimaraGlk *glk) {
+       if( !gtk_toggle_tool_button_get_active(button) )
                return;
 
        /* Untoggle other alignment options */
@@ -151,8 +158,8 @@ on_toggle_center(GtkToggleAction *action, ChimaraGlk *glk) {
 }
 
 void
-on_toggle_right(GtkToggleAction *action, ChimaraGlk *glk) {
-       if( !gtk_toggle_action_get_active(action) )
+on_toggle_right(GtkToggleToolButton *button, ChimaraGlk *glk) {
+       if( !gtk_toggle_tool_button_get_active(button) )
                return;
 
        /* Untoggle other alignment options */
@@ -168,8 +175,8 @@ on_toggle_right(GtkToggleAction *action, ChimaraGlk *glk) {
 }
 
 void
-on_toggle_justify(GtkToggleAction *action, ChimaraGlk *glk) {
-       if( !gtk_toggle_action_get_active(action) )
+on_toggle_justify(GtkToggleToolButton *button, ChimaraGlk *glk) {
+       if( !gtk_toggle_tool_button_get_active(button) )
                return;
 
        /* Untoggle other alignment options */
@@ -185,8 +192,8 @@ on_toggle_justify(GtkToggleAction *action, ChimaraGlk *glk) {
 }
 
 void
-on_toggle_bold(GtkToggleAction *action, ChimaraGlk *glk) {
-       if( gtk_toggle_action_get_active(action) )
+on_toggle_bold(GtkToggleToolButton *button, ChimaraGlk *glk) {
+       if( gtk_toggle_tool_button_get_active(button) )
                g_object_set(current_tag, "weight", PANGO_WEIGHT_BOLD, "weight-set", TRUE, NULL);
        else
                g_object_set(current_tag, "weight", PANGO_WEIGHT_NORMAL, "weight-set", TRUE, NULL);
@@ -195,8 +202,8 @@ on_toggle_bold(GtkToggleAction *action, ChimaraGlk *glk) {
 }
 
 void
-on_toggle_italic(GtkToggleAction *action, ChimaraGlk *glk) {
-       if( gtk_toggle_action_get_active(action) )
+on_toggle_italic(GtkToggleToolButton *button, ChimaraGlk *glk) {
+       if( gtk_toggle_tool_button_get_active(button) )
                g_object_set(current_tag, "style", PANGO_STYLE_ITALIC, "style-set", TRUE, NULL);
        else
                g_object_set(current_tag, "style", PANGO_STYLE_NORMAL, "style-set", TRUE, NULL);
@@ -205,8 +212,8 @@ on_toggle_italic(GtkToggleAction *action, ChimaraGlk *glk) {
 }
 
 void
-on_toggle_underline(GtkToggleAction *action, ChimaraGlk *glk) {
-       if( gtk_toggle_action_get_active(action) )
+on_toggle_underline(GtkToggleToolButton *button, ChimaraGlk *glk) {
+       if( gtk_toggle_tool_button_get_active(button) )
                g_object_set(current_tag, "underline", PANGO_UNDERLINE_SINGLE, "underline-set", TRUE, NULL);
        else
                g_object_set(current_tag, "underline", PANGO_UNDERLINE_NONE, "underline-set", TRUE, NULL);
@@ -240,3 +247,12 @@ on_font_set(GtkFontButton *button, ChimaraGlk *glk)
        g_object_set(current_tag, "font-desc", font_description, NULL);
        chimara_glk_update_style(glk);
 }
+
+void
+on_resource_file_set(GtkFileChooserButton *button, ChimaraGlk *glk)
+{
+       extern GSettings *prefs_settings;
+       char *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(button) );
+       g_settings_set(prefs_settings, "resource-path", "ms", filename);
+       g_free(filename);
+}