Little fixes for color scheme support.
[lxde/lxappearance.git] / src / other.c
CommitLineData
e597424e
HJYP
1// other.c
2//
3// Copyright 2010 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18// MA 02110-1301, USA.
19
20
21#include "lxappearance2.h"
22#include "other.h"
23#include <glib/gi18n.h>
24
25static void on_tb_style_changed(GtkComboBox* combo, gpointer user_data)
26{
27 app.toolbar_style = gtk_combo_box_get_active(combo) + GTK_TOOLBAR_ICONS;
28 lxappearance_changed();
29}
30
31static void on_tb_icon_size_changed(GtkComboBox* combo, gpointer user_data)
32{
33 app.toolbar_icon_size = gtk_combo_box_get_active(combo) + GTK_ICON_SIZE_MENU;
34 lxappearance_changed();
35}
36
9bb12c12
HJYP
37static void on_check_button_toggled(GtkToggleButton* btn, gpointer user_data)
38{
39 gboolean* val = (gboolean*)user_data;
40 gboolean new_val = gtk_toggle_button_get_active(btn);
41 if(new_val != *val)
42 {
43 *val = new_val;
44 lxappearance_changed();
45 }
46}
47
e597424e
HJYP
48void other_init(GtkBuilder* b)
49{
50 int idx;
51 app.tb_style_combo = GTK_WIDGET(gtk_builder_get_object(b, "tb_style"));
52 idx = app.toolbar_style - GTK_TOOLBAR_ICONS;
53 gtk_combo_box_set_active(GTK_COMBO_BOX(app.tb_style_combo), idx);
54 g_signal_connect(app.tb_style_combo, "changed", G_CALLBACK(on_tb_style_changed), NULL);
55
56 app.tb_icon_size_combo = GTK_WIDGET(gtk_builder_get_object(b, "tb_icon_size"));
57 idx = app.toolbar_icon_size - GTK_ICON_SIZE_MENU;
58 gtk_combo_box_set_active(GTK_COMBO_BOX(app.tb_icon_size_combo), idx);
59 g_signal_connect(app.tb_icon_size_combo, "changed", G_CALLBACK(on_tb_icon_size_changed), NULL);
9bb12c12
HJYP
60
61#if GTK_CHECK_VERSION(2, 14, 0)
62 app.event_sound_check = GTK_WIDGET(gtk_builder_get_object(b, "event_sound"));
63 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(app.event_sound_check), app.enable_event_sound);
64 g_signal_connect(app.event_sound_check, "toggled", G_CALLBACK(on_check_button_toggled), &app.enable_event_sound);
65
66 app.input_feedback_check = GTK_WIDGET(gtk_builder_get_object(b, "input_feedback_sound"));
67 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(app.input_feedback_check), app.enable_input_feedback);
68 g_signal_connect(app.input_feedback_check, "toggled", G_CALLBACK(on_check_button_toggled), &app.enable_input_feedback);
69
70 /* event sound support */
71 gtk_widget_show_all(GTK_WIDGET(gtk_builder_get_object(b, "sound_effect")));
72#endif
e597424e
HJYP
73}
74