Merging upstream version 0.5.4.
[debian/lxappearance.git] / src / other.c
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 "lxappearance.h"
22 #include "other.h"
23 #include <glib/gi18n.h>
24
25 static 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
31 static 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
37 void other_init(GtkBuilder* b)
38 {
39 int idx;
40 app.tb_style_combo = GTK_WIDGET(gtk_builder_get_object(b, "tb_style"));
41 idx = app.toolbar_style - GTK_TOOLBAR_ICONS;
42 gtk_combo_box_set_active(GTK_COMBO_BOX(app.tb_style_combo), idx);
43 g_signal_connect(app.tb_style_combo, "changed", G_CALLBACK(on_tb_style_changed), NULL);
44
45 app.tb_icon_size_combo = GTK_WIDGET(gtk_builder_get_object(b, "tb_icon_size"));
46 idx = app.toolbar_icon_size - GTK_ICON_SIZE_MENU;
47 gtk_combo_box_set_active(GTK_COMBO_BOX(app.tb_icon_size_combo), idx);
48 g_signal_connect(app.tb_icon_size_combo, "changed", G_CALLBACK(on_tb_icon_size_changed), NULL);
49
50 app.button_images_check = GTK_WIDGET(gtk_builder_get_object(b, "button_images"));
51 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(app.button_images_check), app.button_images);
52 g_signal_connect(app.button_images_check, "toggled", G_CALLBACK(on_check_button_toggled), &app.button_images);
53
54 app.menu_images_check = GTK_WIDGET(gtk_builder_get_object(b, "menu_images"));
55 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(app.menu_images_check), app.menu_images);
56 g_signal_connect(app.menu_images_check, "toggled", G_CALLBACK(on_check_button_toggled), &app.menu_images);
57
58 #if GTK_CHECK_VERSION(2, 14, 0)
59 app.event_sound_check = GTK_WIDGET(gtk_builder_get_object(b, "event_sound"));
60 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(app.event_sound_check), app.enable_event_sound);
61 g_signal_connect(app.event_sound_check, "toggled", G_CALLBACK(on_check_button_toggled), &app.enable_event_sound);
62
63 app.input_feedback_check = GTK_WIDGET(gtk_builder_get_object(b, "input_feedback_sound"));
64 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(app.input_feedback_check), app.enable_input_feedback);
65 g_signal_connect(app.input_feedback_check, "toggled", G_CALLBACK(on_check_button_toggled), &app.enable_input_feedback);
66
67 /* event sound support */
68 gtk_widget_show_all(GTK_WIDGET(gtk_builder_get_object(b, "sound_effect")));
69 #endif
70
71 }
72