all repos — tint2 @ d49ecee3a7cf9ae0bec50f1e53be52700f298675

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Separator: simplify
o9000 mrovi9000@gmail.com
commit

d49ecee3a7cf9ae0bec50f1e53be52700f298675

parent

62e0ee6a3ab695a4c07dc3551bf9604331943527

M src/config.csrc/config.c

@@ -554,7 +554,25 @@ else

separator->color.alpha = 0.5; } else if (strcmp(key, "separator_style") == 0) { Separator *separator = get_or_create_last_separator(); - separator->style = atoi(value); + if (g_str_equal(value, "empty")) + separator->style = SEPARATOR_EMPTY; + else if (g_str_equal(value, "line")) + separator->style = SEPARATOR_LINE; + else if (g_str_equal(value, "dots")) + separator->style = SEPARATOR_DOTS; + else + fprintf(stderr, RED "Invalid separator_style value: %s" RESET "\n", value); + } else if (strcmp(key, "separator_size") == 0) { + Separator *separator = get_or_create_last_separator(); + separator->thickness = atoi(value); + } else if (strcmp(key, "separator_padding") == 0) { + Separator *separator = get_or_create_last_separator(); + extract_values(value, &value1, &value2, &value3); + separator->area.paddingxlr = separator->area.paddingx = atoi(value1); + if (value2) + separator->area.paddingy = atoi(value2); + if (value3) + separator->area.paddingx = atoi(value3); } /* Execp */
M src/separator/separator.csrc/separator/separator.c

@@ -18,6 +18,13 @@

Separator *create_separator() { Separator *separator = (Separator *)calloc(1, sizeof(Separator)); + separator->color.rgb[0] = 0.5; + separator->color.rgb[1] = 0.5; + separator->color.rgb[2] = 0.5; + separator->color.alpha = 0.9; + separator->style = SEPARATOR_DOTS; + separator->thickness = 3; + separator->area.paddingxlr = 1; return separator; }

@@ -96,133 +103,104 @@

gboolean resize_separator(void *obj) { Separator *separator = (Separator *)obj; - // Panel *panel = separator->area.panel; if (!separator->area.on_screen) return FALSE; - double d_height = panel_horizontal ? separator->area.height : separator->area.width; - double d_thickness = round(d_height / 16) >= 1.0 ? round(d_height / 16) : 1.0; - - if (separator->style == 3) - d_thickness = round(d_height / 8) >= 1.0 ? round(d_height / 8) : 1.0; - - double d_len = round(d_height / 16) >= 1.0 ? round(d_height / 16) : 1.0; - double d_width = d_thickness * 5; - - if (separator->style == 4) { - d_width = d_thickness * 7; - d_thickness = d_thickness * 3; - } - - if (separator->style == 2) { - d_width = d_height; - d_thickness = round(d_height / 8) >= 1.0 ? round(d_height / 8) : 1.0; - d_len = d_thickness; - } - - double d_empty_thickness = d_thickness; - - if (separator->style == 5 || separator->style == 6) { - d_width = (d_thickness * 4) + 2.0; - d_thickness = 1.0; - } - if (panel_horizontal) { - separator->area.width = d_width; - separator->area.height = d_height; + separator->area.width = + separator->thickness + 2 * separator->area.paddingxlr + left_right_border_width(&separator->area); + separator->length = + separator->area.height - 2 * separator->area.paddingy - top_bottom_border_width(&separator->area); } else { - separator->area.width = d_height; - separator->area.height = d_width; + separator->area.height = + separator->thickness + 2 * separator->area.paddingxlr + top_bottom_border_width(&separator->area); + separator->length = + separator->area.width - 2 * separator->area.paddingy - left_right_border_width(&separator->area); } - separator->empty_thickness = d_empty_thickness; - separator->thickness = d_thickness; - separator->len = d_len; - schedule_redraw(&separator->area); panel_refresh = TRUE; return TRUE; } +void draw_separator_line(void *obj, cairo_t *c); +void draw_separator_dots(void *obj, cairo_t *c); + void draw_separator(void *obj, cairo_t *c) { Separator *separator = (Separator *)obj; - if (separator->style == 0) + if (separator->style == SEPARATOR_EMPTY) return; - - double start_point = 0 + (separator->thickness * 2); - double end_point = separator->area.height - (separator->thickness * 2); - if (!panel_horizontal) - end_point = separator->area.width - (separator->thickness * 2); - double count = end_point - start_point; - double thickness = separator->thickness; - double len = separator->len; - int alt = 0; - double x_fix = 0; + else if (separator->style == SEPARATOR_LINE) + draw_separator_line(separator, c); + else if (separator->style == SEPARATOR_DOTS) + draw_separator_dots(separator, c); +} - if (separator->style == 2) { - if (!panel_horizontal) - start_point = start_point + 2; - cairo_set_source_rgba(c, - separator->color.rgb[0], - separator->color.rgb[1], - separator->color.rgb[2], - separator->color.alpha); - cairo_set_line_width(c, 1); - cairo_rectangle(c, - start_point - 2, - start_point - (panel_horizontal ? 0 : 4), - end_point - thickness - 3, - end_point - thickness - (panel_horizontal ? 3 : 3)); - cairo_stroke_preserve(c); - cairo_fill(c); - return; - } +void draw_separator_line(void *obj, cairo_t *c) +{ + Separator *separator = (Separator *)obj; - if (count < thickness) + if (separator->thickness <= 0) return; - while (((int)count) % 2) { - if (alt) { - start_point++; - alt = 0; - } else { - end_point--; - alt = 1; - } - count = end_point - start_point; - if (count < thickness) - return; - } - - if (separator->style == 3 || separator->style == 4) - x_fix = round(thickness / 2) + (separator->style == 4 ? 1.0 : 0.0); - - if (separator->style == 5 || separator->style == 6) { - x_fix = -1.0; - start_point = start_point + 2; - end_point--; - } - - double separator_pattern[] = {len, len}; - double separator_style6_pattern[] = {1.0}; cairo_set_source_rgba(c, separator->color.rgb[0], separator->color.rgb[1], separator->color.rgb[2], separator->color.alpha); - cairo_set_line_width(c, thickness); - if (separator->style == 6) - cairo_set_dash(c, separator_style6_pattern, 1, 0); - else - cairo_set_dash(c, separator_pattern, sizeof(separator_pattern) / sizeof(separator_pattern[0]), 0); + cairo_set_line_width(c, separator->thickness); + cairo_set_line_cap(c, CAIRO_LINE_CAP_ROUND); if (panel_horizontal) { - cairo_move_to(c, (separator->area.width / 2) - thickness + x_fix, start_point); - cairo_line_to(c, (separator->area.width / 2) - thickness + x_fix, end_point); + cairo_move_to(c, separator->area.width / 2.0, separator->area.height / 2.0 - separator->length / 2.0); + cairo_line_to(c, separator->area.width / 2.0, separator->area.height / 2.0 + separator->length / 2.0); } else { - cairo_move_to(c, start_point, (separator->area.height / 2) - thickness + x_fix); - cairo_line_to(c, end_point, (separator->area.height / 2) - thickness + x_fix); + cairo_move_to(c, separator->area.width / 2.0 - separator->length / 2.0, separator->area.height / 2.0); + cairo_line_to(c, separator->area.width / 2.0 - separator->length / 2.0, separator->area.height / 2.0); } cairo_stroke(c); } + +void draw_separator_dots(void *obj, cairo_t *c) +{ + Separator *separator = (Separator *)obj; + if (separator->thickness <= 0) + return; + + cairo_set_source_rgba(c, + separator->color.rgb[0], + separator->color.rgb[1], + separator->color.rgb[2], + separator->color.alpha); + cairo_set_line_width(c, 0); + + int num_circles = separator->length / (1.618 * separator->thickness - 1); + double spacing = (separator->length - num_circles * separator->thickness) / MAX(1.0, num_circles - 1.0); + if (spacing > separator->thickness) + num_circles++; + spacing = (separator->length - num_circles * separator->thickness) / MAX(1.0, num_circles - 1.0); + double offset = (panel_horizontal ? separator->area.height : separator->area.width) / 2.0 - separator->length / 2.0; + if (num_circles == 1) + offset += spacing / 2.0; + for (int i = 0; i < num_circles; i++) { + if (panel_horizontal) { + cairo_arc(c, + separator->area.width / 2.0, + offset + separator->thickness / 2.0, + separator->thickness / 2.0, + 0, + 2 * M_PI); + } else { + cairo_arc(c, + offset + separator->thickness / 2.0, + separator->area.height / 2.0, + separator->thickness / 2.0, + 0, + 2 * M_PI); + } + cairo_stroke_preserve(c); + cairo_fill(c); + offset += separator->thickness + spacing; + } +}
M src/separator/separator.hsrc/separator/separator.h

@@ -7,13 +7,18 @@

#include "common.h" #include "area.h" +typedef enum SeparatorStyle { + SEPARATOR_EMPTY = 0, + SEPARATOR_LINE, + SEPARATOR_DOTS +} SeparatorStyle; + typedef struct Separator { Area area; - int style; + SeparatorStyle style; Color color; - double empty_thickness; - double thickness; - double len; + int thickness; + int length; } Separator; Separator *create_separator();
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -4486,19 +4486,65 @@

separator->separator_color = gtk_color_button_new(); gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(separator->separator_color), TRUE); gtk_widget_show(separator->separator_color); + GdkColor color; + hex2gdk("#777777", &color); + gtk_color_button_set_color(GTK_COLOR_BUTTON(separator->separator_color), &color); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(separator_get_last()->separator_color), (90*65535)/100); gtk_table_attach(GTK_TABLE(table), separator->separator_color, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); col++; row++, col = 2; - label = gtk_label_new(_("Separator style")); + label = gtk_label_new(_("Style")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_widget_show(label); gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); col++; - separator->separator_style = gtk_spin_button_new_with_range(0, 6, 1); + separator->separator_style = gtk_combo_box_new_text(); gtk_widget_show(separator->separator_style); gtk_table_attach(GTK_TABLE(table), separator->separator_style, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_combo_box_append_text(GTK_COMBO_BOX(separator->separator_style), _("Empty")); + gtk_combo_box_append_text(GTK_COMBO_BOX(separator->separator_style), _("Line")); + gtk_combo_box_append_text(GTK_COMBO_BOX(separator->separator_style), _("Dots")); + gtk_combo_box_set_active(GTK_COMBO_BOX(separator->separator_style), 2); + + row++, col = 2; + label = gtk_label_new(_("Size")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + + separator->separator_size = gtk_spin_button_new_with_range(0, 10000, 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(separator->separator_size), 3); + gtk_widget_show(separator->separator_size); + gtk_table_attach(GTK_TABLE(table), separator->separator_size, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + + row++, col = 2; + label = gtk_label_new(_("Horizontal padding")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + + separator->separator_padding_x = gtk_spin_button_new_with_range(0, 500, 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(separator->separator_padding_x), 1); + gtk_widget_show(separator->separator_padding_x); + gtk_table_attach(GTK_TABLE(table), separator->separator_padding_x, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + + row++, col = 2; + 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, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + + separator->separator_padding_y = gtk_spin_button_new_with_range(0, 500, 1); + gtk_widget_show(separator->separator_padding_y); + gtk_table_attach(GTK_TABLE(table), separator->separator_padding_y, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); col++; change_paragraph(parent);
M src/tint2conf/properties.hsrc/tint2conf/properties.h

@@ -128,6 +128,9 @@ GtkWidget *page_label;

GtkWidget *separator_background; GtkWidget *separator_color; GtkWidget *separator_style; + GtkWidget *separator_size; + GtkWidget *separator_padding_x; + GtkWidget *separator_padding_y; } Separator; extern GArray *separators;

@@ -234,5 +237,7 @@

void create_please_wait(GtkWindow *parent); void process_events(); void destroy_please_wait(); + +void hex2gdk(char *hex, GdkColor *color); #endif
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -86,13 +86,7 @@ }

void config_write_color(FILE *fp, const char *name, GdkColor color, int opacity) { - fprintf(fp, - "%s = #%02x%02x%02x %d\n", - name, - color.red >> 8, - color.green >> 8, - color.blue >> 8, - opacity); + fprintf(fp, "%s = #%02x%02x%02x %d\n", name, color.red >> 8, color.green >> 8, color.blue >> 8, opacity); } void config_write_backgrounds(FILE *fp)

@@ -101,7 +95,7 @@ fprintf(fp, "#-------------------------------------\n");

fprintf(fp, "# Backgrounds\n"); int index; - for (index = 1; ; index++) { + for (index = 1;; index++) { GtkTreePath *path; GtkTreeIter iter;

@@ -133,27 +127,47 @@ GdkColor *borderColorPress;

int borderOpacityPress; gchar *text; - gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter, - bgColFillColor, &fillColor, - bgColFillOpacity, &fillOpacity, - bgColBorderColor, &borderColor, - bgColBorderOpacity, &borderOpacity, - bgColFillColorOver, &fillColorOver, - bgColFillOpacityOver, &fillOpacityOver, - bgColBorderColorOver, &borderColorOver, - bgColBorderOpacityOver, &borderOpacityOver, - bgColFillColorPress, &fillColorPress, - bgColFillOpacityPress, &fillOpacityPress, - bgColBorderColorPress, &borderColorPress, - bgColBorderOpacityPress, &borderOpacityPress, - bgColBorderWidth, &b, - bgColCornerRadius, &r, - bgColText, &text, - bgColBorderSidesTop, &sideTop, - bgColBorderSidesBottom, &sideBottom, - bgColBorderSidesLeft, &sideLeft, - bgColBorderSidesRight, &sideRight, - -1); + gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), + &iter, + bgColFillColor, + &fillColor, + bgColFillOpacity, + &fillOpacity, + bgColBorderColor, + &borderColor, + bgColBorderOpacity, + &borderOpacity, + bgColFillColorOver, + &fillColorOver, + bgColFillOpacityOver, + &fillOpacityOver, + bgColBorderColorOver, + &borderColorOver, + bgColBorderOpacityOver, + &borderOpacityOver, + bgColFillColorPress, + &fillColorPress, + bgColFillOpacityPress, + &fillOpacityPress, + bgColBorderColorPress, + &borderColorPress, + bgColBorderOpacityPress, + &borderOpacityPress, + bgColBorderWidth, + &b, + bgColCornerRadius, + &r, + bgColText, + &text, + bgColBorderSidesTop, + &sideTop, + bgColBorderSidesBottom, + &sideBottom, + bgColBorderSidesLeft, + &sideLeft, + bgColBorderSidesRight, + &sideRight, + -1); fprintf(fp, "# Background %d: %s\n", index, text ? text : ""); fprintf(fp, "rounded = %d\n", r); fprintf(fp, "border_width = %d\n", b);

@@ -187,18 +201,21 @@ fprintf(fp, "# Panel\n");

char *items = get_panel_items(); fprintf(fp, "panel_items = %s\n", items); free(items); - fprintf(fp, "panel_size = %d%s %d%s\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_width)), - gtk_combo_box_get_active(GTK_COMBO_BOX(panel_combo_width_type)) == 0 ? "%" : "", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_height)), - gtk_combo_box_get_active(GTK_COMBO_BOX(panel_combo_height_type)) == 0 ? "%" : ""); - fprintf(fp, "panel_margin = %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_margin_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_margin_y))); - fprintf(fp, "panel_padding = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_padding_y)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_spacing))); + fprintf(fp, + "panel_size = %d%s %d%s\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_width)), + gtk_combo_box_get_active(GTK_COMBO_BOX(panel_combo_width_type)) == 0 ? "%" : "", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_height)), + gtk_combo_box_get_active(GTK_COMBO_BOX(panel_combo_height_type)) == 0 ? "%" : ""); + fprintf(fp, + "panel_margin = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_margin_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_margin_y))); + fprintf(fp, + "panel_padding = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_padding_y)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_spacing))); fprintf(fp, "panel_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(panel_background))); fprintf(fp, "wm_menu = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_wm_menu)) ? 1 : 0); fprintf(fp, "panel_dock = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_dock)) ? 1 : 0);

@@ -249,7 +266,9 @@ fprintf(fp, "%d", gtk_combo_box_get_active(GTK_COMBO_BOX(panel_combo_monitor)));

} fprintf(fp, "\n"); - fprintf(fp, "primary_monitor_first = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_primary_monitor_first)) ? 1 : 0); + fprintf(fp, + "primary_monitor_first = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_primary_monitor_first)) ? 1 : 0); fprintf(fp, "autohide = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_autohide)) ? 1 : 0); fprintf(fp, "autohide_show_timeout = %g\n", gtk_spin_button_get_value(GTK_SPIN_BUTTON(panel_autohide_show_time)));

@@ -267,20 +286,21 @@ }

fprintf(fp, "\n"); fprintf(fp, "panel_window_name = %s\n", gtk_entry_get_text(GTK_ENTRY(panel_window_name))); - fprintf(fp, "disable_transparency = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(disable_transparency)) ? 1 : 0); + fprintf(fp, + "disable_transparency = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(disable_transparency)) ? 1 : 0); fprintf(fp, "mouse_effects = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_mouse_effects)) ? 1 : 0); fprintf(fp, "font_shadow = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font_shadow)) ? 1 : 0); fprintf(fp, - "mouse_hover_icon_asb = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_opacity)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_saturation)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_brightness))); + "mouse_hover_icon_asb = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_opacity)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_saturation)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_brightness))); fprintf(fp, - "mouse_pressed_icon_asb = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_opacity)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_saturation)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_brightness))); - + "mouse_pressed_icon_asb = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_opacity)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_saturation)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_brightness))); fprintf(fp, "\n"); }

@@ -291,45 +311,59 @@ fprintf(fp, "#-------------------------------------\n");

fprintf(fp, "# Taskbar\n"); fprintf(fp, - "taskbar_mode = %s\n", - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_show_desktop)) ? - "multi_desktop" : - "single_desktop"); - fprintf(fp, "taskbar_hide_if_empty = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_empty)) ? 1 : 0); + "taskbar_mode = %s\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_show_desktop)) ? "multi_desktop" : "single_desktop"); fprintf(fp, - "taskbar_padding = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_padding_y)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_spacing))); + "taskbar_hide_if_empty = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_empty)) ? 1 : 0); + fprintf(fp, + "taskbar_padding = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_padding_y)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_spacing))); fprintf(fp, "taskbar_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_inactive_background))); - fprintf(fp, "taskbar_active_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_active_background))); + fprintf(fp, + "taskbar_active_background_id = %d\n", + gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_active_background))); fprintf(fp, "taskbar_name = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_show_name)) ? 1 : 0); - fprintf(fp, "taskbar_hide_inactive_tasks = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_inactive_tasks)) ? 1 : 0); - fprintf(fp, "taskbar_hide_different_monitor = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_diff_monitor)) ? 1 : 0); - fprintf(fp, "taskbar_always_show_all_desktop_tasks = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_always_show_all_desktop_tasks)) ? 1 : 0); + fprintf(fp, + "taskbar_hide_inactive_tasks = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_inactive_tasks)) ? 1 : 0); + fprintf(fp, + "taskbar_hide_different_monitor = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_diff_monitor)) ? 1 : 0); + fprintf(fp, + "taskbar_always_show_all_desktop_tasks = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_always_show_all_desktop_tasks)) ? 1 : 0); + fprintf(fp, + "taskbar_name_padding = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_name_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_name_padding_y))); + fprintf(fp, + "taskbar_name_background_id = %d\n", + gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_name_inactive_background))); fprintf(fp, - "taskbar_name_padding = %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_name_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_name_padding_y))); - fprintf(fp, "taskbar_name_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_name_inactive_background))); - fprintf(fp, "taskbar_name_active_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_name_active_background))); + "taskbar_name_active_background_id = %d\n", + gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_name_active_background))); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_name_font_set))) fprintf(fp, "taskbar_name_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(taskbar_name_font))); GdkColor color; gtk_color_button_get_color(GTK_COLOR_BUTTON(taskbar_name_inactive_color), &color); config_write_color(fp, - "taskbar_name_font_color", - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(taskbar_name_inactive_color)) * 100 / 0xffff); + "taskbar_name_font_color", + color, + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(taskbar_name_inactive_color)) * 100 / 0xffff); gtk_color_button_get_color(GTK_COLOR_BUTTON(taskbar_name_active_color), &color); config_write_color(fp, - "taskbar_name_active_font_color", - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(taskbar_name_active_color)) * 100 / 0xffff); + "taskbar_name_active_font_color", + color, + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(taskbar_name_active_color)) * 100 / 0xffff); - fprintf(fp, "taskbar_distribute_size = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_distribute_size)) ? 1 : 0); + fprintf(fp, + "taskbar_distribute_size = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_distribute_size)) ? 1 : 0); fprintf(fp, "taskbar_sort_order = "); if (gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_sort_order)) <= 0) {

@@ -366,26 +400,23 @@ GdkColor color;

gtk_color_button_get_color(GTK_COLOR_BUTTON(task_color), &color); char full_name[128]; sprintf(full_name, "task%s_font_color", name); - config_write_color(fp, - full_name, - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(task_color)) * 100 / 0xffff); + config_write_color(fp, full_name, color, gtk_color_button_get_alpha(GTK_COLOR_BUTTON(task_color)) * 100 / 0xffff); } void config_write_task_icon_osb(FILE *fp, - char *name, - GtkWidget *widget_opacity, - GtkWidget *widget_saturation, - GtkWidget *widget_brightness) + char *name, + GtkWidget *widget_opacity, + GtkWidget *widget_saturation, + GtkWidget *widget_brightness) { char full_name[128]; sprintf(full_name, "task%s_icon_asb", name); fprintf(fp, - "%s = %d %d %d\n", - full_name, - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget_opacity)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget_saturation)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget_brightness))); + "%s = %d %d %d\n", + full_name, + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget_opacity)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget_saturation)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget_brightness))); } void config_write_task_background(FILE *fp, char *name, GtkWidget *task_background)

@@ -405,14 +436,14 @@ fprintf(fp, "task_icon = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_show_icon)) ? 1 : 0);

fprintf(fp, "task_centered = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_align_center)) ? 1 : 0); fprintf(fp, "urgent_nb_of_blink = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_urgent_blinks))); fprintf(fp, - "task_maximum_size = %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_maximum_width)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_maximum_height))); + "task_maximum_size = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_maximum_width)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_maximum_height))); fprintf(fp, - "task_padding = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_padding_y)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_spacing))); + "task_padding = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_padding_y)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(task_spacing))); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_font_set))) fprintf(fp, "task_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(task_font))); fprintf(fp, "task_tooltip = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tooltip_task_show)) ? 1 : 0);

@@ -436,34 +467,39 @@ }

// same for: "" _normal _active _urgent _iconified if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_default_icon_osb_set))) { - config_write_task_icon_osb(fp, "", - task_default_icon_opacity, - task_default_icon_saturation, - task_default_icon_brightness); + config_write_task_icon_osb(fp, + "", + task_default_icon_opacity, + task_default_icon_saturation, + task_default_icon_brightness); } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_normal_icon_osb_set))) { - config_write_task_icon_osb(fp, "_normal", - task_normal_icon_opacity, - task_normal_icon_saturation, - task_normal_icon_brightness); + config_write_task_icon_osb(fp, + "_normal", + task_normal_icon_opacity, + task_normal_icon_saturation, + task_normal_icon_brightness); } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_active_icon_osb_set))) { - config_write_task_icon_osb(fp, "_active", - task_active_icon_opacity, - task_active_icon_saturation, - task_active_icon_brightness); + config_write_task_icon_osb(fp, + "_active", + task_active_icon_opacity, + task_active_icon_saturation, + task_active_icon_brightness); } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_urgent_icon_osb_set))) { - config_write_task_icon_osb(fp, "_urgent", - task_urgent_icon_opacity, - task_urgent_icon_saturation, - task_urgent_icon_brightness); + config_write_task_icon_osb(fp, + "_urgent", + task_urgent_icon_opacity, + task_urgent_icon_saturation, + task_urgent_icon_brightness); } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_iconified_icon_osb_set))) { - config_write_task_icon_osb(fp, "_iconified", - task_iconified_icon_opacity, - task_iconified_icon_saturation, - task_iconified_icon_brightness); + config_write_task_icon_osb(fp, + "_iconified", + task_iconified_icon_opacity, + task_iconified_icon_saturation, + task_iconified_icon_brightness); } // same for: "" _normal _active _urgent _iconified

@@ -482,7 +518,6 @@ }

if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(task_iconified_background_set))) { config_write_task_background(fp, "_iconified", task_iconified_background); } - fprintf(fp, "mouse_left = %s\n", get_action(task_mouse_left)); fprintf(fp, "mouse_middle = %s\n", get_action(task_mouse_middle));

@@ -499,10 +534,10 @@ fprintf(fp, "#-------------------------------------\n");

fprintf(fp, "# System tray (notification area)\n"); fprintf(fp, - "systray_padding = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_padding_y)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_spacing))); + "systray_padding = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_padding_y)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_spacing))); fprintf(fp, "systray_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(systray_background))); fprintf(fp, "systray_sort = ");

@@ -519,10 +554,10 @@ fprintf(fp, "\n");

fprintf(fp, "systray_icon_size = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_icon_size))); fprintf(fp, - "systray_icon_asb = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_icon_opacity)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_icon_saturation)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_icon_brightness))); + "systray_icon_asb = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_icon_opacity)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_icon_saturation)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(systray_icon_brightness))); fprintf(fp, "systray_monitor = "); fprintf(fp, "%d", MAX(1, 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(systray_monitor))));

@@ -537,30 +572,36 @@ fprintf(fp, "#-------------------------------------\n");

fprintf(fp, "# Launcher\n"); fprintf(fp, - "launcher_padding = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_padding_y)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_spacing))); + "launcher_padding = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_padding_y)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_spacing))); fprintf(fp, "launcher_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(launcher_background))); - fprintf(fp, "launcher_icon_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(launcher_icon_background))); + fprintf(fp, + "launcher_icon_background_id = %d\n", + gtk_combo_box_get_active(GTK_COMBO_BOX(launcher_icon_background))); fprintf(fp, "launcher_icon_size = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_size))); fprintf(fp, - "launcher_icon_asb = %d %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_opacity)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_saturation)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_brightness))); + "launcher_icon_asb = %d %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_opacity)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_saturation)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_brightness))); gchar *icon_theme = get_current_icon_theme(); if (icon_theme && !g_str_equal(icon_theme, "")) { fprintf(fp, "launcher_icon_theme = %s\n", icon_theme); g_free(icon_theme); icon_theme = NULL; } - fprintf(fp, "launcher_icon_theme_override = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(launcher_icon_theme_override)) ? 1 : 0); - fprintf(fp, "startup_notifications = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(startup_notifications)) ? 1 : 0); + fprintf(fp, + "launcher_icon_theme_override = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(launcher_icon_theme_override)) ? 1 : 0); + fprintf(fp, + "startup_notifications = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(startup_notifications)) ? 1 : 0); fprintf(fp, "launcher_tooltip = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(launcher_tooltip)) ? 1 : 0); int index; - for (index = 0; ; index++) { + for (index = 0;; index++) { GtkTreePath *path; GtkTreeIter iter;

@@ -573,9 +614,7 @@ break;

} gchar *app_path; - gtk_tree_model_get(GTK_TREE_MODEL(launcher_apps), &iter, - appsColPath, &app_path, - -1); + gtk_tree_model_get(GTK_TREE_MODEL(launcher_apps), &iter, appsColPath, &app_path, -1); char *contracted = contract_tilde(app_path); fprintf(fp, "launcher_item_app = %s\n", contracted); free(contracted);

@@ -614,14 +653,14 @@

GdkColor color; gtk_color_button_get_color(GTK_COLOR_BUTTON(clock_font_color), &color); config_write_color(fp, - "clock_font_color", - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(clock_font_color)) * 100 / 0xffff); + "clock_font_color", + color, + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(clock_font_color)) * 100 / 0xffff); fprintf(fp, - "clock_padding = %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(clock_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(clock_padding_y))); + "clock_padding = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(clock_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(clock_padding_y))); fprintf(fp, "clock_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(clock_background))); fprintf(fp, "clock_tooltip = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_format_tooltip))); fprintf(fp, "clock_tooltip_timezone = %s\n", gtk_entry_get_text(GTK_ENTRY(clock_tmz_tooltip)));

@@ -649,13 +688,13 @@ fprintf(fp, "bat2_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(battery_font_line2)));

GdkColor color; gtk_color_button_get_color(GTK_COLOR_BUTTON(battery_font_color), &color); config_write_color(fp, - "battery_font_color", - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(battery_font_color)) * 100 / 0xffff); + "battery_font_color", + color, + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(battery_font_color)) * 100 / 0xffff); fprintf(fp, - "battery_padding = %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_padding_y))); + "battery_padding = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_padding_y))); fprintf(fp, "battery_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(battery_background))); fprintf(fp, "battery_hide = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_hide_if_higher))); fprintf(fp, "battery_lclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_left_command)));

@@ -679,14 +718,29 @@

Separator *separator = &g_array_index(separators, Separator, i); fprintf(fp, "separator = new\n"); - fprintf(fp, "separator_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(separator->separator_background))); + fprintf(fp, + "separator_background_id = %d\n", + gtk_combo_box_get_active(GTK_COMBO_BOX(separator->separator_background))); GdkColor color; gtk_color_button_get_color(GTK_COLOR_BUTTON(separator->separator_color), &color); config_write_color(fp, - "separator_color", - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(separator->separator_color)) * 100 / 0xffff); - fprintf(fp, "separator_style = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(separator->separator_style))); + "separator_color", + color, + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(separator->separator_color)) * 100 / 0xffff); + // fprintf(fp, "separator_style = %d\n", + // (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(separator->separator_style))); + fprintf(fp, + "separator_style = %s\n", + gtk_combo_box_get_active(GTK_COMBO_BOX(separator->separator_style)) == 0 + ? "empty" + : gtk_combo_box_get_active(GTK_COMBO_BOX(separator->separator_style)) == 1 ? "line" : "dots"); + fprintf(fp, + "separator_size = %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(separator->separator_size))); + fprintf(fp, + "separator_padding = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(separator->separator_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(separator->separator_padding_y))); fprintf(fp, "\n"); } }

@@ -702,10 +756,18 @@

fprintf(fp, "execp = new\n"); fprintf(fp, "execp_command = %s\n", gtk_entry_get_text(GTK_ENTRY(executor->execp_command))); fprintf(fp, "execp_interval = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_interval))); - fprintf(fp, "execp_has_icon = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_has_icon)) ? 1 : 0); - fprintf(fp, "execp_cache_icon = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_cache_icon)) ? 1 : 0); - fprintf(fp, "execp_continuous = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_continuous))); - fprintf(fp, "execp_markup = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_markup)) ? 1 : 0); + fprintf(fp, + "execp_has_icon = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_has_icon)) ? 1 : 0); + fprintf(fp, + "execp_cache_icon = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_cache_icon)) ? 1 : 0); + fprintf(fp, + "execp_continuous = %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_continuous))); + fprintf(fp, + "execp_markup = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_markup)) ? 1 : 0); if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_show_tooltip))) { fprintf(fp, "execp_tooltip = \n"); } else {

@@ -725,15 +787,17 @@ fprintf(fp, "execp_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(executor->execp_font)));

GdkColor color; gtk_color_button_get_color(GTK_COLOR_BUTTON(executor->execp_font_color), &color); config_write_color(fp, - "execp_font_color", - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(executor->execp_font_color)) * 100 / 0xffff); + "execp_font_color", + color, + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(executor->execp_font_color)) * 100 / 0xffff); fprintf(fp, - "execp_padding = %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_padding_y))); + "execp_padding = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_padding_y))); fprintf(fp, "execp_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(executor->execp_background))); - fprintf(fp, "execp_centered = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_centered)) ? 1 : 0); + fprintf(fp, + "execp_centered = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(executor->execp_centered)) ? 1 : 0); fprintf(fp, "execp_icon_w = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_icon_w))); fprintf(fp, "execp_icon_h = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(executor->execp_icon_h)));

@@ -749,17 +813,17 @@

fprintf(fp, "tooltip_show_timeout = %g\n", gtk_spin_button_get_value(GTK_SPIN_BUTTON(tooltip_show_after))); fprintf(fp, "tooltip_hide_timeout = %g\n", gtk_spin_button_get_value(GTK_SPIN_BUTTON(tooltip_hide_after))); fprintf(fp, - "tooltip_padding = %d %d\n", - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(tooltip_padding_x)), - (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(tooltip_padding_y))); + "tooltip_padding = %d %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(tooltip_padding_x)), + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(tooltip_padding_y))); fprintf(fp, "tooltip_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(tooltip_background))); GdkColor color; gtk_color_button_get_color(GTK_COLOR_BUTTON(tooltip_font_color), &color); config_write_color(fp, - "tooltip_font_color", - color, - gtk_color_button_get_alpha(GTK_COLOR_BUTTON(tooltip_font_color)) * 100 / 0xffff); + "tooltip_font_color", + color, + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(tooltip_font_color)) * 100 / 0xffff); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tooltip_font_set))) fprintf(fp, "tooltip_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(tooltip_font)));

@@ -776,7 +840,7 @@

// Skip the first line int c; do { - c = getc(f); + c = getc(f); } while (c != EOF && c != '\n'); while ((c = getc(f)) != EOF) {

@@ -790,7 +854,8 @@ }

return checksum; } -void config_save_file(const char *path) { +void config_save_file(const char *path) +{ printf("config_save_file : %s\n", path); FILE *fp;

@@ -833,7 +898,10 @@ return FALSE;

result = TRUE; if (fgets(line, sizeof(line), fp) != NULL) { - if (!g_regex_match_simple("^#---- Generated by tint2conf [0-9a-f][0-9a-f][0-9a-f][0-9a-f] ----\n$", line, 0, 0)) { + if (!g_regex_match_simple("^#---- Generated by tint2conf [0-9a-f][0-9a-f][0-9a-f][0-9a-f] ----\n$", + line, + 0, + 0)) { result = TRUE; } else { unsigned short checksum1 = checksum_txt(fp);

@@ -889,7 +957,7 @@ }

void add_entry(char *key, char *value) { - char *value1=0, *value2=0, *value3=0; + char *value1 = 0, *value2 = 0, *value3 = 0; /* Background and border */ if (strcmp(key, "rounded") == 0) {

@@ -903,78 +971,70 @@ read_bg_color_press = 0;

read_border_color_press = 0; gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_corner_radius), atoi(value)); background_force_update(); - } - else if (strcmp(key, "border_width") == 0) { + } else if (strcmp(key, "border_width") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_border_width), atoi(value)); background_force_update(); - } - else if (strcmp(key, "background_color") == 0) { + } else if (strcmp(key, "background_color") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color), &col); int alpha = value2 ? atoi(value2) : 50; - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color), (alpha * 65535) / 100); background_force_update(); - } - else if (strcmp(key, "border_color") == 0) { + } else if (strcmp(key, "border_color") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color), &col); int alpha = value2 ? atoi(value2) : 50; - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (alpha * 65535) / 100); background_force_update(); - } - else if (strcmp(key, "background_color_hover") == 0) { + } else if (strcmp(key, "background_color_hover") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_over), &col); int alpha = value2 ? atoi(value2) : 50; - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_over), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_over), (alpha * 65535) / 100); background_force_update(); read_bg_color_hover = 1; - } - else if (strcmp(key, "border_color_hover") == 0) { + } else if (strcmp(key, "border_color_hover") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_over), &col); int alpha = value2 ? atoi(value2) : 50; - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_over), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_over), (alpha * 65535) / 100); background_force_update(); read_border_color_hover = 1; - } - else if (strcmp(key, "background_color_pressed") == 0) { + } else if (strcmp(key, "background_color_pressed") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_press), &col); int alpha = value2 ? atoi(value2) : 50; - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_press), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_press), (alpha * 65535) / 100); background_force_update(); read_bg_color_press = 1; - } - else if (strcmp(key, "border_color_pressed") == 0) { + } else if (strcmp(key, "border_color_pressed") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_press), &col); int alpha = value2 ? atoi(value2) : 50; - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_press), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_press), (alpha * 65535) / 100); background_force_update(); read_border_color_press = 1; - } - else if (strcmp(key, "border_sides") == 0) { + } else if (strcmp(key, "border_sides") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(background_border_sides_top), - strchr(value, 't') || strchr(value, 'T')); + strchr(value, 't') || strchr(value, 'T')); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(background_border_sides_bottom), - strchr(value, 'b') || strchr(value, 'B')); + strchr(value, 'b') || strchr(value, 'B')); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(background_border_sides_left), - strchr(value, 'l') || strchr(value, 'L')); + strchr(value, 'l') || strchr(value, 'L')); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(background_border_sides_right), - strchr(value, 'r') || strchr(value, 'R')); + strchr(value, 'r') || strchr(value, 'R')); background_force_update(); } /* Panel */

@@ -984,8 +1044,7 @@ char *b;

if ((b = strchr(value1, '%'))) { b[0] = '\0'; gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_width_type), 0); - } - else + } else gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_width_type), 1); gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_width), atoi(value1)); if (atoi(value1) == 0) {

@@ -996,28 +1055,25 @@ }

if ((b = strchr(value2, '%'))) { b[0] = '\0'; gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_height_type), 0); - } - else + } else gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_height_type), 1); gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_height), atoi(value2)); - } - else if (strcmp(key, "panel_items") == 0) { + } else if (strcmp(key, "panel_items") == 0) { config_has_panel_items = 1; set_panel_items(value); - } - else if (strcmp(key, "panel_margin") == 0) { + } else if (strcmp(key, "panel_margin") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_margin_x), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_margin_y), atoi(value2)); - } - else if (strcmp(key, "panel_padding") == 0) { + } else if (strcmp(key, "panel_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_padding_x), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_spacing), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_padding_y), atoi(value2)); - if (value3) gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_spacing), atoi(value3)); - } - else if (strcmp(key, "panel_position") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_padding_y), atoi(value2)); + if (value3) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_spacing), atoi(value3)); + } else if (strcmp(key, "panel_position") == 0) { extract_values(value, &value1, &value2, &value3); char vpos, hpos, orientation;

@@ -1078,50 +1134,39 @@ if (vpos == 'C' && hpos == 'R' && orientation == 'V')

gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(screen_position[POS_CRV]), 1); if (vpos == 'B' && hpos == 'R' && orientation == 'V') gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(screen_position[POS_BRV]), 1); - } - else if (strcmp(key, "panel_background_id") == 0) { + } else if (strcmp(key, "panel_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(panel_background), id); - } - else if (strcmp(key, "panel_window_name") == 0) { + } else if (strcmp(key, "panel_window_name") == 0) { gtk_entry_set_text(GTK_ENTRY(panel_window_name), value); - } - else if (strcmp(key, "disable_transparency") == 0) { + } else if (strcmp(key, "disable_transparency") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_transparency), atoi(value)); - } - else if (strcmp(key, "mouse_effects") == 0) { + } else if (strcmp(key, "mouse_effects") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_mouse_effects), atoi(value)); - } - else if (strcmp(key, "mouse_hover_icon_asb") == 0) { + } else if (strcmp(key, "mouse_hover_icon_asb") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_opacity), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_saturation), atoi(value2)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_brightness), atoi(value3)); - } - else if (strcmp(key, "mouse_pressed_icon_asb") == 0) { + } else if (strcmp(key, "mouse_pressed_icon_asb") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_opacity), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_saturation), atoi(value2)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_brightness), atoi(value3)); - } - else if (strcmp(key, "font_shadow") == 0) { + } else if (strcmp(key, "font_shadow") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(font_shadow), atoi(value)); - } - else if (strcmp(key, "wm_menu") == 0) { + } else if (strcmp(key, "wm_menu") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_wm_menu), atoi(value)); - } - else if (strcmp(key, "panel_dock") == 0) { + } else if (strcmp(key, "panel_dock") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_dock), atoi(value)); - } - else if (strcmp(key, "panel_layer") == 0) { + } else if (strcmp(key, "panel_layer") == 0) { if (strcmp(value, "bottom") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_layer), 2); else if (strcmp(value, "top") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_layer), 0); else gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_layer), 1); - } - else if (strcmp(key, "panel_monitor") == 0) { + } else if (strcmp(key, "panel_monitor") == 0) { if (strcmp(value, "all") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_monitor), 0); else if (strcmp(value, "1") == 0)

@@ -1136,30 +1181,25 @@ else if (strcmp(value, "5") == 0)

gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_monitor), 5); else if (strcmp(value, "6") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_monitor), 6); - } - else if (strcmp(key, "primary_monitor_first") == 0) { + } else if (strcmp(key, "primary_monitor_first") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_primary_monitor_first), atoi(value)); } /* autohide options */ else if (strcmp(key, "autohide") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_autohide), atoi(value)); - } - else if (strcmp(key, "autohide_show_timeout") == 0) { + } else if (strcmp(key, "autohide_show_timeout") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_autohide_show_time), atof(value)); - } - else if (strcmp(key, "autohide_hide_timeout") == 0) { + } else if (strcmp(key, "autohide_hide_timeout") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_autohide_hide_time), atof(value)); - } - else if (strcmp(key, "strut_policy") == 0) { + } else if (strcmp(key, "strut_policy") == 0) { if (strcmp(value, "follow_size") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_strut_policy), 0); else if (strcmp(value, "none") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_strut_policy), 2); else gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_strut_policy), 1); - } - else if (strcmp(key, "autohide_height") == 0) { + } else if (strcmp(key, "autohide_height") == 0) { if (atoi(value) <= 0) { // autohide need height > 0 gtk_spin_button_set_value(GTK_SPIN_BUTTON(panel_autohide_size), 1);

@@ -1177,63 +1217,50 @@ } else if (strcmp(key, "battery_tooltip") == 0) {

gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(battery_tooltip), atoi(value)); } else if (strcmp(key, "battery_low_status") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_alert_if_lower), atof(value)); - } - else if (strcmp(key, "battery_low_cmd") == 0) { + } else if (strcmp(key, "battery_low_cmd") == 0) { gtk_entry_set_text(GTK_ENTRY(battery_alert_cmd), value); - } - else if (strcmp(key, "bat1_font") == 0) { + } else if (strcmp(key, "bat1_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(battery_font_line1), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(battery_font_line1_set), TRUE); - } - else if (strcmp(key, "bat2_font") == 0) { + } else if (strcmp(key, "bat2_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(battery_font_line2), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(battery_font_line2_set), TRUE); - } - else if (strcmp(key, "battery_font_color") == 0) { + } else if (strcmp(key, "battery_font_color") == 0) { extract_values(value, &value1, &value2, &value3); 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); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(battery_font_color), (alpha * 65535) / 100); } - } - else if (strcmp(key, "battery_padding") == 0) { + } else if (strcmp(key, "battery_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_padding_x), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_padding_y), atoi(value2)); - } - else if (strcmp(key, "battery_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_padding_y), atoi(value2)); + } else if (strcmp(key, "battery_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(battery_background), id); - } - else if (strcmp(key, "battery_hide") == 0) { + } else if (strcmp(key, "battery_hide") == 0) { 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), atoi(value)); - } - else if (strcmp(key, "battery_lclick_command") == 0) { + } else if (strcmp(key, "battery_lclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(battery_left_command), value); - } - else if (strcmp(key, "battery_rclick_command") == 0) { + } else if (strcmp(key, "battery_rclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(battery_right_command), value); - } - else if (strcmp(key, "battery_mclick_command") == 0) { + } else if (strcmp(key, "battery_mclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(battery_mclick_command), value); - } - else if (strcmp(key, "battery_uwheel_command") == 0) { + } else if (strcmp(key, "battery_uwheel_command") == 0) { gtk_entry_set_text(GTK_ENTRY(battery_uwheel_command), value); - } - else if (strcmp(key, "battery_dwheel_command") == 0) { + } else if (strcmp(key, "battery_dwheel_command") == 0) { gtk_entry_set_text(GTK_ENTRY(battery_dwheel_command), value); - } - else if (strcmp(key, "ac_connected_cmd") == 0) { + } else if (strcmp(key, "ac_connected_cmd") == 0) { gtk_entry_set_text(GTK_ENTRY(ac_connected_cmd), value); - } - else if (strcmp(key, "ac_disconnected_cmd") == 0) { + } else if (strcmp(key, "ac_disconnected_cmd") == 0) { gtk_entry_set_text(GTK_ENTRY(ac_disconnected_cmd), value); }

@@ -1241,62 +1268,48 @@ /* Clock */

else if (strcmp(key, "time1_format") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_format_line1), value); no_items_clock_enabled = strlen(value) > 0; - } - else if (strcmp(key, "time2_format") == 0) { + } else if (strcmp(key, "time2_format") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_format_line2), value); - } - else if (strcmp(key, "time1_font") == 0) { + } else if (strcmp(key, "time1_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(clock_font_line1), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(clock_font_line1_set), TRUE); - } - else if (strcmp(key, "time1_timezone") == 0) { + } else if (strcmp(key, "time1_timezone") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_tmz_line1), value); - } - else if (strcmp(key, "time2_timezone") == 0) { + } else if (strcmp(key, "time2_timezone") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_tmz_line2), value); - } - else if (strcmp(key, "time2_font") == 0) { + } else if (strcmp(key, "time2_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(clock_font_line2), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(clock_font_line2_set), TRUE); - } - else if (strcmp(key, "clock_font_color") == 0) { + } else if (strcmp(key, "clock_font_color") == 0) { extract_values(value, &value1, &value2, &value3); 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); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(clock_font_color), (alpha * 65535) / 100); } - } - else if (strcmp(key, "clock_padding") == 0) { + } else if (strcmp(key, "clock_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(clock_padding_x), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(clock_padding_y), atoi(value2)); - } - else if (strcmp(key, "clock_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(clock_padding_y), atoi(value2)); + } else if (strcmp(key, "clock_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(clock_background), id); - } - else if (strcmp(key, "clock_tooltip") == 0) { + } else if (strcmp(key, "clock_tooltip") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_format_tooltip), value); - } - else if (strcmp(key, "clock_tooltip_timezone") == 0) { + } else if (strcmp(key, "clock_tooltip_timezone") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_tmz_tooltip), value); - } - else if (strcmp(key, "clock_lclick_command") == 0) { + } else if (strcmp(key, "clock_lclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_left_command), value); - } - else if (strcmp(key, "clock_rclick_command") == 0) { + } else if (strcmp(key, "clock_rclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_right_command), value); - } - else if (strcmp(key, "clock_mclick_command") == 0) { + } else if (strcmp(key, "clock_mclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_mclick_command), value); - } - else if (strcmp(key, "clock_uwheel_command") == 0) { + } else if (strcmp(key, "clock_uwheel_command") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_uwheel_command), value); - } - else if (strcmp(key, "clock_dwheel_command") == 0) { + } else if (strcmp(key, "clock_dwheel_command") == 0) { gtk_entry_set_text(GTK_ENTRY(clock_dwheel_command), value); }

@@ -1306,14 +1319,11 @@ if (strcmp(value, "multi_desktop") == 0)

gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_show_desktop), 1); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_show_desktop), 0); - } - else if (strcmp(key, "taskbar_hide_if_empty") == 0) { + } else if (strcmp(key, "taskbar_hide_if_empty") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_hide_empty), atoi(value)); - } - else if (strcmp(key, "taskbar_distribute_size") == 0) { + } else if (strcmp(key, "taskbar_distribute_size") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_distribute_size), atoi(value)); - } - else if (strcmp(key, "taskbar_sort_order") == 0) { + } else if (strcmp(key, "taskbar_sort_order") == 0) { if (strcmp(value, "none") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 0); else if (strcmp(value, "title") == 0)

@@ -1326,8 +1336,7 @@ else if (strcmp(value, "lru") == 0)

gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 4); else gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_sort_order), 0); - } - else if (strcmp(key, "task_align") == 0) { + } else if (strcmp(key, "task_align") == 0) { if (strcmp(value, "left") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_alignment), 0); else if (strcmp(value, "center") == 0)

@@ -1336,114 +1345,98 @@ else if (strcmp(value, "right") == 0)

gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_alignment), 2); else gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_alignment), 0); - } - else if (strcmp(key, "taskbar_padding") == 0) { + } else if (strcmp(key, "taskbar_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_padding_x), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_spacing), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_padding_y), atoi(value2)); - if (value3) gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_spacing), atoi(value3)); - } - else if (strcmp(key, "taskbar_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_padding_y), atoi(value2)); + if (value3) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_spacing), atoi(value3)); + } else if (strcmp(key, "taskbar_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_inactive_background), id); if (gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_active_background)) < 0) gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_active_background), id); - } - else if (strcmp(key, "taskbar_active_background_id") == 0) { + } else if (strcmp(key, "taskbar_active_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_active_background), id); - } - else if (strcmp(key, "taskbar_name") == 0) { + } else if (strcmp(key, "taskbar_name") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_show_name), atoi(value)); - } - else if (strcmp(key, "taskbar_hide_inactive_tasks") == 0) { + } else if (strcmp(key, "taskbar_hide_inactive_tasks") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_hide_inactive_tasks), atoi(value)); - } - else if (strcmp(key, "taskbar_hide_different_monitor") == 0) { + } else if (strcmp(key, "taskbar_hide_different_monitor") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_hide_diff_monitor), atoi(value)); - } - else if (strcmp(key, "taskbar_always_show_all_desktop_tasks") == 0) { + } else if (strcmp(key, "taskbar_always_show_all_desktop_tasks") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_always_show_all_desktop_tasks), atoi(value)); - } - else if (strcmp(key, "taskbar_name_padding") == 0) { + } else if (strcmp(key, "taskbar_name_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_name_padding_x), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_name_padding_y), atoi(value2)); - } - else if (strcmp(key, "taskbar_name_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_name_padding_y), atoi(value2)); + } else if (strcmp(key, "taskbar_name_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_name_inactive_background), id); if (gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_name_active_background)) < 0) gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_name_active_background), id); - } - else if (strcmp(key, "taskbar_name_active_background_id") == 0) { + } else if (strcmp(key, "taskbar_name_active_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_name_active_background), id); - } - else if (strcmp(key, "taskbar_name_font") == 0) { + } else if (strcmp(key, "taskbar_name_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(taskbar_name_font), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_name_font_set), TRUE); - } - else if (strcmp(key, "taskbar_name_font_color") == 0) { + } else if (strcmp(key, "taskbar_name_font_color") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(taskbar_name_inactive_color), &col); if (value2) { int alpha = atoi(value2); - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(taskbar_name_inactive_color), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(taskbar_name_inactive_color), (alpha * 65535) / 100); } - } - else if (strcmp(key, "taskbar_name_active_font_color") == 0) { + } else if (strcmp(key, "taskbar_name_active_font_color") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(taskbar_name_active_color), &col); if (value2) { int alpha = atoi(value2); - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(taskbar_name_active_color), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(taskbar_name_active_color), (alpha * 65535) / 100); } } /* Task */ else if (strcmp(key, "task_text") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(task_show_text), atoi(value)); - } - else if (strcmp(key, "task_icon") == 0) { + } else if (strcmp(key, "task_icon") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(task_show_icon), atoi(value)); - } - else if (strcmp(key, "task_centered") == 0) { + } else if (strcmp(key, "task_centered") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(task_align_center), atoi(value)); - } - else if (strcmp(key, "urgent_nb_of_blink") == 0) { + } else if (strcmp(key, "urgent_nb_of_blink") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_urgent_blinks), atoi(value)); - } - else if (strcmp(key, "task_width") == 0) { + } else if (strcmp(key, "task_width") == 0) { // old parameter : just for backward compatibility gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_maximum_width), atoi(value)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_maximum_height), 30.0); - } - else if (strcmp(key, "task_maximum_size") == 0) { + } else if (strcmp(key, "task_maximum_size") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_maximum_width), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_maximum_height), 30.0); if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_maximum_height), atoi(value2)); - } - else if (strcmp(key, "task_padding") == 0) { + } else if (strcmp(key, "task_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_padding_x), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_spacing), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_padding_y), atoi(value2)); - if (value3) gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_spacing), atoi(value3)); - } - else if (strcmp(key, "task_font") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_padding_y), atoi(value2)); + if (value3) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(task_spacing), atoi(value3)); + } else if (strcmp(key, "task_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(task_font), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(task_font_set), TRUE); - } - else if (g_regex_match_simple("task.*_font_color", key, 0, 0)) { - gchar** split = g_regex_split_simple("_", key, 0, 0); + } else if (g_regex_match_simple("task.*_font_color", key, 0, 0)) { + gchar **split = g_regex_split_simple("_", key, 0, 0); GtkWidget *widget = NULL; if (strcmp(split[1], "normal") == 0) { widget = task_normal_color;

@@ -1469,12 +1462,11 @@ hex2gdk(value1, &col);

gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &col); if (value2) { int alpha = atoi(value2); - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(widget), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(widget), (alpha * 65535) / 100); } } - } - else if (g_regex_match_simple("task.*_icon_asb", key, 0, 0)) { - gchar** split = g_regex_split_simple("_", key, 0, 0); + } else if (g_regex_match_simple("task.*_icon_asb", key, 0, 0)) { + gchar **split = g_regex_split_simple("_", key, 0, 0); GtkWidget *widget_opacity = NULL; GtkWidget *widget_saturation = NULL; GtkWidget *widget_brightness = NULL;

@@ -1511,9 +1503,8 @@ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget_opacity), atoi(value1));

gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget_saturation), atoi(value2)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget_brightness), atoi(value3)); } - } - else if (g_regex_match_simple("task.*_background_id", key, 0, 0)) { - gchar** split = g_regex_split_simple("_", key, 0, 0); + } else if (g_regex_match_simple("task.*_background_id", key, 0, 0)) { + gchar **split = g_regex_split_simple("_", key, 0, 0); GtkWidget *widget = NULL; if (strcmp(split[1], "normal") == 0) { widget = task_normal_background;

@@ -1547,34 +1538,31 @@ else if (strcmp(key, "systray") == 0) {

// Obsolete option config_has_systray = 1; config_systray_enabled = atoi(value); - } - else if (strcmp(key, "systray_padding") == 0) { + } else if (strcmp(key, "systray_padding") == 0) { no_items_systray_enabled = 1; extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_padding_x), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_spacing), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_padding_y), atoi(value2)); - if (value3) gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_spacing), atoi(value3)); - } - else if (strcmp(key, "systray_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_padding_y), atoi(value2)); + if (value3) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_spacing), atoi(value3)); + } else if (strcmp(key, "systray_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(systray_background), id); - } - else if (strcmp(key, "systray_sort") == 0) { + } else if (strcmp(key, "systray_sort") == 0) { if (strcmp(value, "descending") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(systray_icon_order), 1); else if (strcmp(value, "ascending") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(systray_icon_order), 0); else if (strcmp(value, "right2left") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(systray_icon_order), 3); - else // default to left2right + else // default to left2right gtk_combo_box_set_active(GTK_COMBO_BOX(systray_icon_order), 2); - } - else if (strcmp(key, "systray_icon_size") == 0) { + } else if (strcmp(key, "systray_icon_size") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_size), atoi(value)); - } - else if (strcmp(key, "systray_monitor") == 0) { + } else if (strcmp(key, "systray_monitor") == 0) { if (strcmp(value, "1") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(systray_monitor), 0); else if (strcmp(value, "2") == 0)

@@ -1587,8 +1575,7 @@ else if (strcmp(value, "5") == 0)

gtk_combo_box_set_active(GTK_COMBO_BOX(systray_monitor), 4); else if (strcmp(value, "6") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(systray_monitor), 5); - } - else if (strcmp(key, "systray_icon_asb") == 0) { + } else if (strcmp(key, "systray_icon_asb") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_opacity), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_saturation), atoi(value2));

@@ -1600,27 +1587,24 @@ else if (strcmp(key, "launcher_padding") == 0) {

extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_padding_x), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_spacing), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_padding_y), atoi(value2)); - if (value3) gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_spacing), atoi(value3)); - } - else if (strcmp(key, "launcher_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_padding_y), atoi(value2)); + if (value3) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_spacing), atoi(value3)); + } else if (strcmp(key, "launcher_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(launcher_background), id); - } - else if (strcmp(key, "launcher_icon_background_id") == 0) { + } else if (strcmp(key, "launcher_icon_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(launcher_icon_background), id); - } - else if (strcmp(key, "launcher_icon_size") == 0) { + } else if (strcmp(key, "launcher_icon_size") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_size), atoi(value)); - } - else if (strcmp(key, "launcher_item_app") == 0) { + } else if (strcmp(key, "launcher_item_app") == 0) { char *path = expand_tilde(value); load_desktop_file(path, TRUE); load_desktop_file(path, FALSE); free(path); - } - else if (strcmp(key, "launcher_apps_dir") == 0) { + } else if (strcmp(key, "launcher_apps_dir") == 0) { char *path = expand_tilde(value); if (gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs)) > 0) {

@@ -1629,20 +1613,15 @@ }

gtk_entry_append_text(GTK_ENTRY(launcher_apps_dirs), path); free(path); - } - else if (strcmp(key, "launcher_icon_theme") == 0) { + } else if (strcmp(key, "launcher_icon_theme") == 0) { set_current_icon_theme(value); - } - else if (strcmp(key, "launcher_icon_theme_override") == 0) { + } else if (strcmp(key, "launcher_icon_theme_override") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(launcher_icon_theme_override), atoi(value)); - } - else if (strcmp(key, "launcher_tooltip") == 0) { + } else if (strcmp(key, "launcher_tooltip") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(launcher_tooltip), atoi(value)); - } - else if (strcmp(key, "startup_notifications") == 0) { + } else if (strcmp(key, "startup_notifications") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(startup_notifications), atoi(value)); - } - else if (strcmp(key, "launcher_icon_asb") == 0) { + } else if (strcmp(key, "launcher_icon_asb") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_opacity), atoi(value1)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_saturation), atoi(value2));

@@ -1652,30 +1631,26 @@

/* Tooltip */ else if (strcmp(key, "tooltip_show_timeout") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_show_after), atof(value)); - } - else if (strcmp(key, "tooltip_hide_timeout") == 0) { + } else if (strcmp(key, "tooltip_hide_timeout") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_hide_after), atof(value)); - } - else if (strcmp(key, "tooltip_padding") == 0) { + } else if (strcmp(key, "tooltip_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_padding_x), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_padding_y), atoi(value2)); - } - else if (strcmp(key, "tooltip_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_padding_y), atoi(value2)); + } else if (strcmp(key, "tooltip_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(tooltip_background), id); - } - else if (strcmp(key, "tooltip_font_color") == 0) { + } else if (strcmp(key, "tooltip_font_color") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(tooltip_font_color), &col); if (value2) { int alpha = atoi(value2); - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(tooltip_font_color), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(tooltip_font_color), (alpha * 65535) / 100); } - } - else if (strcmp(key, "tooltip_font") == 0) { + } else if (strcmp(key, "tooltip_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(tooltip_font), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tooltip_font_set), TRUE); }

@@ -1683,133 +1658,123 @@

/* Mouse actions */ else if (strcmp(key, "mouse_left") == 0) { set_action(value, task_mouse_left); - } - else if (strcmp(key, "mouse_middle") == 0) { + } else if (strcmp(key, "mouse_middle") == 0) { set_action(value, task_mouse_middle); - } - else if (strcmp(key, "mouse_right") == 0) { + } else if (strcmp(key, "mouse_right") == 0) { set_action(value, task_mouse_right); - } - else if (strcmp(key, "mouse_scroll_up") == 0) { + } else if (strcmp(key, "mouse_scroll_up") == 0) { set_action(value, task_mouse_scroll_up); - } - else if (strcmp(key, "mouse_scroll_down") == 0) { + } else if (strcmp(key, "mouse_scroll_down") == 0) { set_action(value, task_mouse_scroll_down); } /* Separator */ else if (strcmp(key, "separator") == 0) { separator_create_new(); - } - else if (strcmp(key, "separator_background_id") == 0) { + } else if (strcmp(key, "separator_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(separator_get_last()->separator_background), id); - } - else if (strcmp(key, "separator_color") == 0) { + } else if (strcmp(key, "separator_color") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(separator_get_last()->separator_color), &col); if (value2) { int alpha = atoi(value2); - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(separator_get_last()->separator_color), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(separator_get_last()->separator_color), (alpha * 65535) / 100); } - } - else if (strcmp(key, "separator_style") == 0) { - gtk_spin_button_set_value(GTK_SPIN_BUTTON(separator_get_last()->separator_style), atoi(value)); + } else if (strcmp(key, "separator_style") == 0) { + if (g_str_equal(value, "empty")) + gtk_combo_box_set_active(GTK_COMBO_BOX(separator_get_last()->separator_style), 0); + else if (g_str_equal(value, "line")) + gtk_combo_box_set_active(GTK_COMBO_BOX(separator_get_last()->separator_style), 1); + else if (g_str_equal(value, "dots")) + gtk_combo_box_set_active(GTK_COMBO_BOX(separator_get_last()->separator_style), 2); + } else if (strcmp(key, "separator_size") == 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(separator_get_last()->separator_size), atoi(value)); + } else if (strcmp(key, "separator_padding") == 0) { + extract_values(value, &value1, &value2, &value3); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(separator_get_last()->separator_padding_x), atoi(value1)); + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(separator_get_last()->separator_padding_y), atoi(value2)); } /* Executor */ else if (strcmp(key, "execp") == 0) { execp_create_new(); - } - else if (strcmp(key, "execp_command") == 0) { + } else if (strcmp(key, "execp_command") == 0) { gtk_entry_set_text(GTK_ENTRY(execp_get_last()->execp_command), value); - } - else if (strcmp(key, "execp_interval") == 0) { + } else if (strcmp(key, "execp_interval") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_interval), atoi(value)); - } - else if (strcmp(key, "execp_has_icon") == 0) { + } else if (strcmp(key, "execp_has_icon") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_has_icon), atoi(value)); - } - else if (strcmp(key, "execp_cache_icon") == 0) { + } else if (strcmp(key, "execp_cache_icon") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_cache_icon), atoi(value)); - } - else if (strcmp(key, "execp_continuous") == 0) { + } else if (strcmp(key, "execp_continuous") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_continuous), atoi(value)); - } - else if (strcmp(key, "execp_markup") == 0) { + } else if (strcmp(key, "execp_markup") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_markup), atoi(value)); - } - else if (strcmp(key, "execp_tooltip") == 0) { + } else if (strcmp(key, "execp_tooltip") == 0) { if (strlen(value) > 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_show_tooltip), 1); - } - else { + } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_show_tooltip), 0); } gtk_entry_set_text(GTK_ENTRY(execp_get_last()->execp_tooltip), value); - } - else if (strcmp(key, "execp_lclick_command") == 0) { + } else if (strcmp(key, "execp_lclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(execp_get_last()->execp_left_command), value); - } - else if (strcmp(key, "execp_rclick_command") == 0) { + } else if (strcmp(key, "execp_rclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(execp_get_last()->execp_right_command), value); - } - else if (strcmp(key, "execp_mclick_command") == 0) { + } else if (strcmp(key, "execp_mclick_command") == 0) { gtk_entry_set_text(GTK_ENTRY(execp_get_last()->execp_mclick_command), value); - } - else if (strcmp(key, "execp_uwheel_command") == 0) { + } else if (strcmp(key, "execp_uwheel_command") == 0) { gtk_entry_set_text(GTK_ENTRY(execp_get_last()->execp_uwheel_command), value); - } - else if (strcmp(key, "execp_dwheel_command") == 0) { + } else if (strcmp(key, "execp_dwheel_command") == 0) { gtk_entry_set_text(GTK_ENTRY(execp_get_last()->execp_dwheel_command), value); - } - else if (strcmp(key, "execp_font") == 0) { + } else if (strcmp(key, "execp_font") == 0) { gtk_font_button_set_font_name(GTK_FONT_BUTTON(execp_get_last()->execp_font), value); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_font_set), TRUE); - } - else if (strcmp(key, "execp_font_color") == 0) { + } else if (strcmp(key, "execp_font_color") == 0) { extract_values(value, &value1, &value2, &value3); GdkColor col; hex2gdk(value1, &col); gtk_color_button_set_color(GTK_COLOR_BUTTON(execp_get_last()->execp_font_color), &col); if (value2) { int alpha = atoi(value2); - gtk_color_button_set_alpha(GTK_COLOR_BUTTON(execp_get_last()->execp_font_color), (alpha*65535)/100); + gtk_color_button_set_alpha(GTK_COLOR_BUTTON(execp_get_last()->execp_font_color), (alpha * 65535) / 100); } - } - else if (strcmp(key, "execp_padding") == 0) { + } else if (strcmp(key, "execp_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_padding_x), atoi(value1)); - if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_padding_y), atoi(value2)); - } - else if (strcmp(key, "execp_background_id") == 0) { + if (value2) + gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_padding_y), atoi(value2)); + } else if (strcmp(key, "execp_background_id") == 0) { int id = background_index_safe(atoi(value)); gtk_combo_box_set_active(GTK_COMBO_BOX(execp_get_last()->execp_background), id); - } - else if (strcmp(key, "execp_icon_w") == 0) { + } else if (strcmp(key, "execp_icon_w") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_icon_w), atoi(value)); - } - else if (strcmp(key, "execp_icon_h") == 0) { + } else if (strcmp(key, "execp_icon_h") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(execp_get_last()->execp_icon_h), atoi(value)); - } - else if (strcmp(key, "execp_centered") == 0) { + } else if (strcmp(key, "execp_centered") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_centered), atoi(value)); } - if (value1) free(value1); - if (value2) free(value2); - if (value3) free(value3); + if (value1) + free(value1); + if (value2) + free(value2); + if (value3) + free(value3); } void hex2gdk(char *hex, GdkColor *color) { - if (hex == NULL || hex[0] != '#') return; + if (hex == NULL || hex[0] != '#') + return; - color->red = 257 * (hex_char_to_int(hex[1]) * 16 + hex_char_to_int(hex[2])); + color->red = 257 * (hex_char_to_int(hex[1]) * 16 + hex_char_to_int(hex[2])); color->green = 257 * (hex_char_to_int(hex[3]) * 16 + hex_char_to_int(hex[4])); - color->blue = 257 * (hex_char_to_int(hex[5]) * 16 + hex_char_to_int(hex[6])); + color->blue = 257 * (hex_char_to_int(hex[5]) * 16 + hex_char_to_int(hex[6])); color->pixel = 0; }