~ubuntu-branches/debian/sid/lxappearance/sid

« back to all changes in this revision

Viewing changes to src/other.c

  • Committer: Package Import Robot
  • Author(s): Andriy Grytsenko, Andriy Grytsenko
  • Date: 2014-10-23 22:44:18 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20141023224418-1gtyiyx6mm33t6ya
Tags: 0.6.1-1
[ Andriy Grytsenko ]
* Merging upstream version 0.6.0:
  - Added accessibility enabling option.
  - Fixed incorrect data in settings.ini file.
* Bump Standards-Version to 3.9.6.
* Adding lintian-overrides file for debian-watch-may-check-gpg-signature.
* Merging upstream version 0.6.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    lxappearance_changed();
35
35
}
36
36
 
 
37
static void on_enable_accessibility_toggled(GtkToggleButton* btn, gpointer user_data)
 
38
{
 
39
    char **modules_list, **ml, **new_modules_list;
 
40
    gsize i;
 
41
 
 
42
    if (app.modules)
 
43
        modules_list = g_strsplit(app.modules, ":", -1);
 
44
    else
 
45
        modules_list = g_strsplit("", ":", -1);
 
46
    new_modules_list = g_new0(char *, g_strv_length(modules_list) + 3);
 
47
    for (i = 0, ml = modules_list; *ml != NULL; ml++)
 
48
    {
 
49
        if (strcmp(*ml, "gail") != 0 && strcmp(*ml, "atk-bridge") != 0)
 
50
            new_modules_list[i++] = *ml;
 
51
        else
 
52
            g_free(*ml);
 
53
    }
 
54
    if (gtk_toggle_button_get_active(btn))
 
55
    {
 
56
        new_modules_list[i++] = g_strdup("gail");
 
57
        new_modules_list[i++] = g_strdup("atk-bridge");
 
58
    }
 
59
    g_free(app.modules);
 
60
    app.modules = g_strjoinv(":", new_modules_list);
 
61
    g_free(modules_list);
 
62
    g_strfreev(new_modules_list);
 
63
    lxappearance_changed();
 
64
}
 
65
 
37
66
void other_init(GtkBuilder* b)
38
67
{
39
68
    int idx;
68
97
    gtk_widget_show_all(GTK_WIDGET(gtk_builder_get_object(b, "sound_effect")));
69
98
#endif
70
99
 
 
100
    gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(b, "accessibility_options")));
 
101
    app.enable_accessibility_button = GTK_WIDGET(gtk_builder_get_object(b, "enable_accessibility"));
 
102
    if (app.modules)
 
103
    {
 
104
        char **modules_list = g_strsplit(app.modules, ":", -1), **ml;
 
105
 
 
106
        for (ml = modules_list; *ml != NULL; ml++)
 
107
            if (strcmp(*ml, "gail") == 0)
 
108
                break;
 
109
        if (*ml != NULL)
 
110
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(app.enable_accessibility_button),
 
111
                                         TRUE);
 
112
        g_strfreev(modules_list);
 
113
    }
 
114
    g_signal_connect(app.enable_accessibility_button, "toggled",
 
115
                     G_CALLBACK(on_enable_accessibility_toggled), &app.modules);
71
116
}
72
117