From 28fea9690c8f71dbe1ab4da63e915cf292f54094 Mon Sep 17 00:00:00 2001 From: Thierry Lorthiois Date: Mon, 6 Jun 2011 22:02:09 +0000 Subject: [PATCH] tint2conf : work in progress --- src/tint2conf/properties.c | 228 +++++++++++++++++----------------- src/tint2conf/properties.h | 8 +- src/tint2conf/properties_rw.c | 110 +++++++--------- 3 files changed, 164 insertions(+), 182 deletions(-) diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index d93a35c..d84af6f 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -602,7 +602,6 @@ void create_launcher(GtkWidget *parent) void create_taskbar(GtkWidget *parent) { GtkWidget *table, *label; - GtkWidget *margin_x, *margin_y, *combo_background; table = gtk_table_new (2, 2, FALSE); gtk_widget_show (table); @@ -971,7 +970,6 @@ void create_task(GtkWidget *parent) void create_clock(GtkWidget *parent) { GtkWidget *table; - GtkWidget *margin_x, *margin_y, *combo_background; GtkWidget *label; table = gtk_table_new (1, 2, FALSE); @@ -998,60 +996,60 @@ void create_clock(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + clock_format_line1 = gtk_entry_new (); + gtk_widget_show (clock_format_line1); + gtk_entry_set_width_chars (GTK_ENTRY (clock_format_line1), 16); + gtk_table_attach (GTK_TABLE (table), clock_format_line1, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Second line format")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); + clock_format_line2 = gtk_entry_new (); + gtk_widget_show (clock_format_line2); + gtk_entry_set_width_chars (GTK_ENTRY (clock_format_line2), 16); + gtk_table_attach (GTK_TABLE (table), clock_format_line2, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Tooltip format")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 2, 3, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 2, 3, GTK_FILL, 0, 0, 0); + clock_format_tooltip = gtk_entry_new (); + gtk_widget_show (clock_format_tooltip); + gtk_entry_set_width_chars (GTK_ENTRY (clock_format_tooltip), 16); + gtk_table_attach (GTK_TABLE (table), clock_format_tooltip, 3, 4, 2, 3, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("First line timezone")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 0, 1, GTK_FILL, 0, 0, 0); + clock_tmz_line1 = gtk_entry_new (); + gtk_widget_show (clock_tmz_line1); + gtk_entry_set_width_chars (GTK_ENTRY (clock_tmz_line1), 16); + gtk_table_attach (GTK_TABLE (table), clock_tmz_line1, 7, 8, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Second line timezone")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 1, 2, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 1, 2, GTK_FILL, 0, 0, 0); + clock_tmz_line2 = gtk_entry_new (); + gtk_widget_show (clock_tmz_line2); + gtk_entry_set_width_chars (GTK_ENTRY (clock_tmz_line2), 16); + gtk_table_attach (GTK_TABLE (table), clock_tmz_line2, 7, 8, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Tooltip timezone")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 2, 3, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); + clock_tmz_tooltip = gtk_entry_new (); + gtk_widget_show (clock_tmz_tooltip); + gtk_entry_set_width_chars (GTK_ENTRY (clock_tmz_tooltip), 16); + gtk_table_attach (GTK_TABLE (table), clock_tmz_tooltip, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); change_paragraph(parent); @@ -1072,20 +1070,20 @@ void create_clock(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + clock_left_command = gtk_entry_new (); + gtk_widget_show (clock_left_command); + gtk_entry_set_width_chars (GTK_ENTRY (clock_left_command), 16); + gtk_table_attach (GTK_TABLE (table), clock_left_command, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Right click command")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_entry_new (); - gtk_widget_show (margin_x); - gtk_entry_set_width_chars (GTK_ENTRY (margin_x), 16); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 0, 1, GTK_FILL, 0, 0, 0); + clock_right_command = gtk_entry_new (); + gtk_widget_show (clock_right_command); + gtk_entry_set_width_chars (GTK_ENTRY (clock_right_command), 16); + gtk_table_attach (GTK_TABLE (table), clock_right_command, 7, 8, 0, 1, GTK_FILL, 0, 0, 0); change_paragraph(parent); @@ -1106,20 +1104,20 @@ void create_clock(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + clock_padding_x = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (clock_padding_x); + gtk_entry_set_max_length (GTK_ENTRY (clock_padding_x), 3); + gtk_table_attach (GTK_TABLE (table), clock_padding_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Vertical padding")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - margin_y = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_y); - gtk_entry_set_max_length (GTK_ENTRY (margin_y), 3); - gtk_table_attach (GTK_TABLE (table), margin_y, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); + clock_padding_y = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (clock_padding_y); + gtk_entry_set_max_length (GTK_ENTRY (clock_padding_y), 3); + gtk_table_attach (GTK_TABLE (table), clock_padding_y, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Background")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -1138,30 +1136,30 @@ void create_clock(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_font_button_new (); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 22, 0, 1, GTK_FILL, 0, 0, 0); -// gtk_font_button_set_show_style (GTK_FONT_BUTTON (margin_x), FALSE); + clock_font_line1 = gtk_font_button_new (); + gtk_widget_show (clock_font_line1); + gtk_table_attach (GTK_TABLE (table), clock_font_line1, 7, 22, 0, 1, GTK_FILL, 0, 0, 0); +// gtk_font_button_set_show_style (GTK_FONT_BUTTON (clock_font_line1), FALSE); label = gtk_label_new (_("Font second line")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 1, 2, GTK_FILL, 0, 0, 0); - margin_x = gtk_font_button_new (); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 22, 1, 2, GTK_FILL, 0, 0, 0); -// gtk_font_button_set_show_style (GTK_FONT_BUTTON (margin_x), FALSE); + clock_font_line2 = gtk_font_button_new (); + gtk_widget_show (clock_font_line2); + gtk_table_attach (GTK_TABLE (table), clock_font_line2, 7, 22, 1, 2, GTK_FILL, 0, 0, 0); +// gtk_font_button_set_show_style (GTK_FONT_BUTTON (clock_font_line2), FALSE); label = gtk_label_new (_("Font color")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 2, 3, GTK_FILL, 0, 0, 0); - margin_x = gtk_color_button_new(); - gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(margin_x), TRUE); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); + clock_font_color = gtk_color_button_new(); + gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(clock_font_color), TRUE); + gtk_widget_show (clock_font_color); + gtk_table_attach (GTK_TABLE (table), clock_font_color, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); change_paragraph(parent); } @@ -1170,7 +1168,6 @@ void create_clock(GtkWidget *parent) void create_systemtray(GtkWidget *parent) { GtkWidget *table; - GtkWidget *margin_x, *margin_y; GtkWidget *label; table = gtk_table_new (2, 2, FALSE); @@ -1211,30 +1208,30 @@ void create_systemtray(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + systray_padding_x = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (systray_padding_x); + gtk_entry_set_max_length (GTK_ENTRY (systray_padding_x), 3); + gtk_table_attach (GTK_TABLE (table), systray_padding_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Vertical padding")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - margin_y = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_y); - gtk_entry_set_max_length (GTK_ENTRY (margin_y), 3); - gtk_table_attach (GTK_TABLE (table), margin_y, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); + systray_padding_y = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (systray_padding_y); + gtk_entry_set_max_length (GTK_ENTRY (systray_padding_y), 3); + gtk_table_attach (GTK_TABLE (table), systray_padding_y, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Spacing")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 2, 3, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 2, 3, GTK_FILL, 0, 0, 0); + systray_spacing = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (systray_spacing); + gtk_entry_set_max_length (GTK_ENTRY (systray_spacing), 3); + gtk_table_attach (GTK_TABLE (table), systray_spacing, 3, 4, 2, 3, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Background")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -1253,40 +1250,40 @@ void create_systemtray(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 0, 1, GTK_FILL, 0, 0, 0); + systray_icon_size = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (systray_icon_size); + gtk_entry_set_max_length (GTK_ENTRY (systray_icon_size), 3); + gtk_table_attach (GTK_TABLE (table), systray_icon_size, 7, 8, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Icon opacity")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 1, 2, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 100, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 1, 2, GTK_FILL, 0, 0, 0); + systray_icon_opacity = gtk_spin_button_new_with_range (0, 100, 1); + gtk_widget_show (systray_icon_opacity); + gtk_entry_set_max_length (GTK_ENTRY (systray_icon_opacity), 3); + gtk_table_attach (GTK_TABLE (table), systray_icon_opacity, 7, 8, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Icon saturation")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 2, 3, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (-100, 100, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); + systray_icon_saturation = gtk_spin_button_new_with_range (-100, 100, 1); + gtk_widget_show (systray_icon_saturation); + gtk_entry_set_max_length (GTK_ENTRY (systray_icon_saturation), 4); + gtk_table_attach (GTK_TABLE (table), systray_icon_saturation, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Icon brightness")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 3, 4, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (-100, 100, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 3, 4, GTK_FILL, 0, 0, 0); + systray_icon_brightness = gtk_spin_button_new_with_range (-100, 100, 1); + gtk_widget_show (systray_icon_brightness); + gtk_entry_set_max_length (GTK_ENTRY (systray_icon_brightness), 4); + gtk_table_attach (GTK_TABLE (table), systray_icon_brightness, 7, 8, 3, 4, GTK_FILL, 0, 0, 0); } @@ -1294,7 +1291,6 @@ void create_systemtray(GtkWidget *parent) void create_battery(GtkWidget *parent) { GtkWidget *table, *label; - GtkWidget *margin_x, *margin_y, *combo_background, *alert_command; table = gtk_table_new (1, 2, FALSE); gtk_widget_show (table); @@ -1319,10 +1315,10 @@ void create_battery(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 100, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + battery_hide_if_higher = gtk_spin_button_new_with_range (0, 101, 1); + gtk_widget_show (battery_hide_if_higher); + gtk_entry_set_max_length (GTK_ENTRY (battery_hide_if_higher), 3); + gtk_table_attach (GTK_TABLE (table), battery_hide_if_higher, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("%")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -1334,10 +1330,10 @@ void create_battery(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 100, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); + battery_alert_if_lower = gtk_spin_button_new_with_range (0, 100, 1); + gtk_widget_show (battery_alert_if_lower); + gtk_entry_set_max_length (GTK_ENTRY (battery_alert_if_lower), 3); + gtk_table_attach (GTK_TABLE (table), battery_alert_if_lower, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("%")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -1349,10 +1345,10 @@ void create_battery(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 7, 8, 1, 2, GTK_FILL, 0, 0, 0); - alert_command = gtk_entry_new (); - gtk_widget_show (alert_command); - gtk_entry_set_width_chars (GTK_ENTRY (alert_command), 20); - gtk_table_attach (GTK_TABLE (table), alert_command, 8, 9, 1, 2, GTK_FILL, 0, 0, 0); + battery_alert_cmd = gtk_entry_new (); + gtk_widget_show (battery_alert_cmd); + gtk_entry_set_width_chars (GTK_ENTRY (battery_alert_cmd), 28); + gtk_table_attach (GTK_TABLE (table), battery_alert_cmd, 8, 9, 1, 2, GTK_FILL, 0, 0, 0); change_paragraph(parent); @@ -1374,20 +1370,20 @@ void create_battery(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_x); - gtk_entry_set_max_length (GTK_ENTRY (margin_x), 3); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + battery_padding_x = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (battery_padding_x); + gtk_entry_set_max_length (GTK_ENTRY (battery_padding_x), 3); + gtk_table_attach (GTK_TABLE (table), battery_padding_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Vertical padding")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); - margin_y = gtk_spin_button_new_with_range (0, 500, 1); - gtk_widget_show (margin_y); - gtk_entry_set_max_length (GTK_ENTRY (margin_y), 3); - gtk_table_attach (GTK_TABLE (table), margin_y, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); + battery_padding_y = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (battery_padding_y); + gtk_entry_set_max_length (GTK_ENTRY (battery_padding_y), 3); + gtk_table_attach (GTK_TABLE (table), battery_padding_y, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Background")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -1406,30 +1402,30 @@ void create_battery(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_font_button_new (); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 22, 0, 1, GTK_FILL, 0, 0, 0); -// gtk_font_button_set_show_style (GTK_FONT_BUTTON (margin_x), FALSE); + battery_font_line1 = gtk_font_button_new (); + gtk_widget_show (battery_font_line1); + gtk_table_attach (GTK_TABLE (table), battery_font_line1, 7, 22, 0, 1, GTK_FILL, 0, 0, 0); +// gtk_font_button_set_show_style (GTK_FONT_BUTTON (battery_font_line1), FALSE); label = gtk_label_new (_("Font second line")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 1, 2, GTK_FILL, 0, 0, 0); - margin_x = gtk_font_button_new (); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 22, 1, 2, GTK_FILL, 0, 0, 0); -// gtk_font_button_set_show_style (GTK_FONT_BUTTON (margin_x), FALSE); + battery_font_line2 = gtk_font_button_new (); + gtk_widget_show (battery_font_line2); + gtk_table_attach (GTK_TABLE (table), battery_font_line2, 7, 22, 1, 2, GTK_FILL, 0, 0, 0); +// gtk_font_button_set_show_style (GTK_FONT_BUTTON (battery_font_line2), FALSE); label = gtk_label_new (_("Font color")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 6, 7, 2, 3, GTK_FILL, 0, 0, 0); - margin_x = gtk_color_button_new(); - gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(margin_x), TRUE); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); + battery_font_color = gtk_color_button_new(); + gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(battery_font_color), TRUE); + gtk_widget_show (battery_font_color); + gtk_table_attach (GTK_TABLE (table), battery_font_color, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); change_paragraph(parent); } diff --git a/src/tint2conf/properties.h b/src/tint2conf/properties.h index c66edb2..4c0ed36 100644 --- a/src/tint2conf/properties.h +++ b/src/tint2conf/properties.h @@ -17,11 +17,17 @@ GtkWidget *taskbar_name_padding_x, *taskbar_name_inactive_color, *taskbar_name_ // task // clock +GtkWidget *clock_format_line1, *clock_format_line2, *clock_format_tooltip, *clock_tmz_line1, *clock_tmz_line2, *clock_tmz_tooltip; +GtkWidget *clock_left_command, *clock_right_command; +GtkWidget *clock_padding_x, *clock_padding_y, *clock_font_line1, *clock_font_line2, *clock_font_color; // battery +GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd; +GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color; // systray -GtkWidget *systray_icon_order; +GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray_spacing; +GtkWidget *systray_icon_size, *systray_icon_opacity, *systray_icon_saturation, *systray_icon_brightness; // tooltip diff --git a/src/tint2conf/properties_rw.c b/src/tint2conf/properties_rw.c index 78df71f..96a3323 100644 --- a/src/tint2conf/properties_rw.c +++ b/src/tint2conf/properties_rw.c @@ -188,95 +188,78 @@ void add_entry (char *key, char *value) /* Battery */ else if (strcmp (key, "battery_low_status") == 0) { -#ifdef ENABLE_BATTERY - //battery_low_status = atoi(value); - //if(battery_low_status < 0 || battery_low_status > 100) - //battery_low_status = 0; -#endif + gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_alert_if_lower), atof(value)); } else if (strcmp (key, "battery_low_cmd") == 0) { -#ifdef ENABLE_BATTERY - //if (strlen(value) > 0) - //battery_low_cmd = strdup (value); -#endif + gtk_entry_set_text(GTK_ENTRY(battery_alert_cmd), value); } else if (strcmp (key, "bat1_font") == 0) { -#ifdef ENABLE_BATTERY - //bat1_font_desc = pango_font_description_from_string (value); -#endif + gtk_font_button_set_font_name(GTK_FONT_BUTTON(battery_font_line1), value); } else if (strcmp (key, "bat2_font") == 0) { -#ifdef ENABLE_BATTERY - //bat2_font_desc = pango_font_description_from_string (value); -#endif + gtk_font_button_set_font_name(GTK_FONT_BUTTON(battery_font_line2), value); } else if (strcmp (key, "battery_font_color") == 0) { -#ifdef ENABLE_BATTERY extract_values(value, &value1, &value2, &value3); - //get_color (value1, panel_config.battery.font.color); - //if (value2) panel_config.battery.font.alpha = (atoi (value2) / 100.0); - //else panel_config.battery.font.alpha = 0.5; -#endif + GdkColor col; + hex2gdk(value1, &col); + gtk_color_button_set_color(GTK_COLOR_BUTTON(battery_font_color), &col); + if (value2) { + int alpha = atoi(value2); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(battery_font_color), (alpha*65535)/100); + } } else if (strcmp (key, "battery_padding") == 0) { -#ifdef ENABLE_BATTERY extract_values(value, &value1, &value2, &value3); - //panel_config.battery.area.paddingxlr = panel_config.battery.area.paddingx = atoi (value1); - //if (value2) panel_config.battery.area.paddingy = atoi (value2); - //if (value3) panel_config.battery.area.paddingx = atoi (value3); -#endif + gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_padding_x), atof(value1)); + if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_padding_y), atof(value2)); } else if (strcmp (key, "battery_background_id") == 0) { -#ifdef ENABLE_BATTERY //int id = atoi (value); //id = (id < backgrounds->len && id >= 0) ? id : 0; //panel_config.battery.area.bg = &g_array_index(backgrounds, Background, id); -#endif } else if (strcmp (key, "battery_hide") == 0) { -#ifdef ENABLE_BATTERY - //percentage_hide = atoi (value); - //if (percentage_hide == 0) - // percentage_hide = 101; -#endif + int percentage_hide = atoi (value); + if (percentage_hide == 0) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_hide_if_higher), 101.0); + else + gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_hide_if_higher), atof(value)); } /* Clock */ else if (strcmp (key, "time1_format") == 0) { - //if (strlen(value) > 0) { - //time1_format = strdup (value); - //clock_enabled = 1; - //} + gtk_entry_set_text(GTK_ENTRY(clock_format_line1), value); } else if (strcmp (key, "time2_format") == 0) { - //if (strlen(value) > 0) - //time2_format = strdup (value); + gtk_entry_set_text(GTK_ENTRY(clock_format_line2), value); } else if (strcmp (key, "time1_font") == 0) { - //time1_font_desc = pango_font_description_from_string (value); + gtk_font_button_set_font_name(GTK_FONT_BUTTON(clock_font_line1), value); } else if (strcmp(key, "time1_timezone") == 0) { - //if (strlen(value) > 0) - //time1_timezone = strdup(value); + gtk_entry_set_text(GTK_ENTRY(clock_tmz_line1), value); } else if (strcmp(key, "time2_timezone") == 0) { - //if (strlen(value) > 0) - //time2_timezone = strdup(value); + gtk_entry_set_text(GTK_ENTRY(clock_tmz_line2), value); } else if (strcmp (key, "time2_font") == 0) { - //time2_font_desc = pango_font_description_from_string (value); + gtk_font_button_set_font_name(GTK_FONT_BUTTON(clock_font_line2), value); } else if (strcmp (key, "clock_font_color") == 0) { extract_values(value, &value1, &value2, &value3); - //get_color (value1, panel_config.clock.font.color); - //if (value2) panel_config.clock.font.alpha = (atoi (value2) / 100.0); - //else panel_config.clock.font.alpha = 0.5; + GdkColor col; + hex2gdk(value1, &col); + gtk_color_button_set_color(GTK_COLOR_BUTTON(clock_font_color), &col); + if (value2) { + int alpha = atoi(value2); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(clock_font_color), (alpha*65535)/100); + } } else if (strcmp (key, "clock_padding") == 0) { extract_values(value, &value1, &value2, &value3); - //panel_config.clock.area.paddingxlr = panel_config.clock.area.paddingx = atoi (value1); - //if (value2) panel_config.clock.area.paddingy = atoi (value2); - //if (value3) panel_config.clock.area.paddingx = atoi (value3); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(clock_padding_x), atof(value1)); + if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(clock_padding_y), atof(value2)); } else if (strcmp (key, "clock_background_id") == 0) { //int id = atoi (value); @@ -284,20 +267,16 @@ void add_entry (char *key, char *value) //panel_config.clock.area.bg = &g_array_index(backgrounds, Background, id); } else if (strcmp(key, "clock_tooltip") == 0) { - //if (strlen(value) > 0) - //time_tooltip_format = strdup (value); + gtk_entry_set_text(GTK_ENTRY(clock_format_tooltip), value); } else if (strcmp(key, "clock_tooltip_timezone") == 0) { - //if (strlen(value) > 0) - //time_tooltip_timezone = strdup(value); + gtk_entry_set_text(GTK_ENTRY(clock_tmz_tooltip), value); } else if (strcmp(key, "clock_lclick_command") == 0) { - //if (strlen(value) > 0) - //clock_lclick_command = strdup(value); + gtk_entry_set_text(GTK_ENTRY(clock_left_command), value); } else if (strcmp(key, "clock_rclick_command") == 0) { - //if (strlen(value) > 0) - //clock_rclick_command = strdup(value); + gtk_entry_set_text(GTK_ENTRY(clock_right_command), value); } /* Taskbar */ @@ -442,9 +421,10 @@ void add_entry (char *key, char *value) /* Systray */ else if (strcmp (key, "systray_padding") == 0) { extract_values(value, &value1, &value2, &value3); - //systray.area.paddingxlr = systray.area.paddingx = atoi (value1); - //if (value2) systray.area.paddingy = atoi (value2); - //if (value3) systray.area.paddingx = atoi (value3); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_padding_x), atof(value1)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_spacing), atof(value1)); + if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_padding_y), atof(value2)); + if (value3) gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_spacing), atof(value3)); } else if (strcmp (key, "systray_background_id") == 0) { //int id = atoi (value); @@ -462,13 +442,13 @@ void add_entry (char *key, char *value) gtk_combo_box_set_active(GTK_COMBO_BOX(systray_icon_order), 2); } else if (strcmp(key, "systray_icon_size") == 0) { - //systray_max_icon_size = atoi(value); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_size), atof(value)); } else if (strcmp(key, "systray_icon_asb") == 0) { extract_values(value, &value1, &value2, &value3); - //systray.alpha = atoi(value1); - //systray.saturation = atoi(value2); - //systray.brightness = atoi(value3); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_opacity), atof(value1)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_saturation), atof(value2)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_brightness), atof(value3)); } /* Launcher */ -- 2.45.2