From: Thierry Lorthiois Date: Tue, 7 Jun 2011 21:30:54 +0000 (+0000) Subject: tint2conf: work in progress X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=902b0ebf7cda5afb5e59bc7e9f412567825fea1c;p=chaz%2Ftint2 tint2conf: work in progress --- diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index d84af6f..769a634 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -509,7 +509,6 @@ void create_panel_items(GtkWidget *parent) void create_launcher(GtkWidget *parent) { GtkWidget *table, *label; - GtkWidget *margin_x, *margin_y, *combo_background; label = gtk_label_new (_("Applications")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -536,30 +535,30 @@ void create_launcher(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); + launcher_padding_x = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (launcher_padding_x); + gtk_entry_set_max_length (GTK_ENTRY (launcher_padding_x), 3); + gtk_table_attach (GTK_TABLE (table), launcher_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); + launcher_padding_y = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (launcher_padding_y); + gtk_entry_set_max_length (GTK_ENTRY (launcher_padding_y), 3); + gtk_table_attach (GTK_TABLE (table), launcher_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); + launcher_spacing = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (launcher_spacing); + gtk_entry_set_max_length (GTK_ENTRY (launcher_spacing), 3); + gtk_table_attach (GTK_TABLE (table), launcher_spacing, 3, 4, 2, 3, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Background")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -578,22 +577,22 @@ void create_launcher(GtkWidget *parent) 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, 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, 1, 2, GTK_FILL, 0, 0, 0); + launcher_icon_size = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (launcher_icon_size); + gtk_entry_set_max_length (GTK_ENTRY (launcher_icon_size), 3); + gtk_table_attach (GTK_TABLE (table), launcher_icon_size, 7, 8, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("Icon theme")); 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); - combo_background = gtk_combo_box_new_text (); - gtk_widget_show (combo_background); - gtk_table_attach (GTK_TABLE (table), combo_background, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (combo_background), _("Theme 1")); - gtk_combo_box_append_text (GTK_COMBO_BOX (combo_background), _("Theme 2")); - gtk_combo_box_append_text (GTK_COMBO_BOX (combo_background), _("Theme 3")); + launcher_icon_theme = gtk_combo_box_new_text (); + gtk_widget_show (launcher_icon_theme); + gtk_table_attach (GTK_TABLE (table), launcher_icon_theme, 7, 8, 2, 3, GTK_FILL, 0, 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (launcher_icon_theme), _("Theme 1")); + gtk_combo_box_append_text (GTK_COMBO_BOX (launcher_icon_theme), _("Theme 2")); + gtk_combo_box_append_text (GTK_COMBO_BOX (launcher_icon_theme), _("Theme 3")); change_paragraph(parent); } @@ -1011,16 +1010,6 @@ void create_clock(GtkWidget *parent) 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); - - 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); @@ -1041,16 +1030,6 @@ void create_clock(GtkWidget *parent) 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); - - 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); label = gtk_label_new (_("Mouse action")); @@ -1434,7 +1413,6 @@ void create_battery(GtkWidget *parent) void create_tooltip(GtkWidget *parent) { GtkWidget *table; - GtkWidget *margin_x, *margin_y, *combo_background; GtkWidget *label; table = gtk_table_new (1, 2, FALSE); @@ -1448,9 +1426,9 @@ void create_tooltip(GtkWidget *parent) gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - margin_x = gtk_check_button_new (); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + tooltip_task_show = gtk_check_button_new (); + gtk_widget_show (tooltip_task_show); + gtk_table_attach (GTK_TABLE (table), tooltip_task_show, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); change_paragraph(parent); @@ -1471,9 +1449,9 @@ void create_tooltip(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, 10000, 0.1); - gtk_widget_show (margin_x); - gtk_table_attach (GTK_TABLE (table), margin_x, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); + tooltip_show_after = gtk_spin_button_new_with_range (0, 10000, 0.1); + gtk_widget_show (tooltip_show_after); + gtk_table_attach (GTK_TABLE (table), tooltip_show_after, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("seconds")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -1485,9 +1463,9 @@ void create_tooltip(GtkWidget *parent) 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, 10000, 0.1); - gtk_widget_show (margin_y); - gtk_table_attach (GTK_TABLE (table), margin_y, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); + tooltip_hide_after = gtk_spin_button_new_with_range (0, 10000, 0.1); + gtk_widget_show (tooltip_hide_after); + gtk_table_attach (GTK_TABLE (table), tooltip_hide_after, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); label = gtk_label_new (_("seconds")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); @@ -1513,20 +1491,20 @@ void create_tooltip(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); + tooltip_padding_x = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (tooltip_padding_x); + gtk_entry_set_max_length (GTK_ENTRY (tooltip_padding_x), 3); + gtk_table_attach (GTK_TABLE (table), tooltip_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); + tooltip_padding_y = gtk_spin_button_new_with_range (0, 500, 1); + gtk_widget_show (tooltip_padding_y); + gtk_entry_set_max_length (GTK_ENTRY (tooltip_padding_y), 3); + gtk_table_attach (GTK_TABLE (table), tooltip_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); @@ -1545,20 +1523,54 @@ void create_tooltip(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); + tooltip_font = gtk_font_button_new (); + gtk_widget_show (tooltip_font); + gtk_table_attach (GTK_TABLE (table), tooltip_font, 7, 22, 0, 1, GTK_FILL, 0, 0, 0); +// gtk_font_button_set_show_style (GTK_FONT_BUTTON (tooltip_font), 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, 1, 2, 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, 1, 2, GTK_FILL, 0, 0, 0); + tooltip_font_color = gtk_color_button_new(); + gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(tooltip_font_color), TRUE); + gtk_widget_show (tooltip_font_color); + gtk_table_attach (GTK_TABLE (table), tooltip_font_color, 7, 8, 1, 2, GTK_FILL, 0, 0, 0); + + change_paragraph(parent); + + label = gtk_label_new (_("Clock tooltip")); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0); + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); + gtk_widget_show (label); + gtk_box_pack_start(GTK_BOX (parent), label, FALSE, FALSE, 0); + + table = gtk_table_new (3, 10, FALSE); + gtk_widget_show (table); + gtk_box_pack_start (GTK_BOX (parent), table, FALSE, FALSE, 0); + gtk_table_set_row_spacings (GTK_TABLE (table), ROW_SPACING); + gtk_table_set_col_spacings (GTK_TABLE (table), COL_SPACING); + + label = gtk_label_new (_("Clock tooltip format")); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, 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, 0, 1, GTK_FILL, 0, 0, 0); + + label = gtk_label_new (_("Clock tooltip timezone")); + 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); + + 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, 3, 4, 1, 2, GTK_FILL, 0, 0, 0); change_paragraph(parent); } diff --git a/src/tint2conf/properties.h b/src/tint2conf/properties.h index 4c0ed36..3fe0239 100644 --- a/src/tint2conf/properties.h +++ b/src/tint2conf/properties.h @@ -17,7 +17,7 @@ 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_format_line1, *clock_format_line2, *clock_tmz_line1, *clock_tmz_line2; GtkWidget *clock_left_command, *clock_right_command; GtkWidget *clock_padding_x, *clock_padding_y, *clock_font_line1, *clock_font_line2, *clock_font_color; @@ -30,8 +30,12 @@ GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray GtkWidget *systray_icon_size, *systray_icon_opacity, *systray_icon_saturation, *systray_icon_brightness; // tooltip +GtkWidget *tooltip_padding_x, *tooltip_padding_y, *tooltip_font, *tooltip_font_color; +GtkWidget *tooltip_task_show, *tooltip_show_after, *tooltip_hide_after; +GtkWidget *clock_format_tooltip, *clock_tmz_tooltip; // launcher +GtkWidget *launcher_icon_size, *launcher_icon_theme, *launcher_padding_x, *launcher_padding_y, *launcher_spacing; // background GtkWidget *combo_background; diff --git a/src/tint2conf/properties_rw.c b/src/tint2conf/properties_rw.c index 96a3323..1436450 100644 --- a/src/tint2conf/properties_rw.c +++ b/src/tint2conf/properties_rw.c @@ -415,7 +415,7 @@ void add_entry (char *key, char *value) } // "tooltip" is deprecated but here for backwards compatibility else if (strcmp (key, "task_tooltip") == 0 || strcmp(key, "tooltip") == 0) { - //panel_config.g_task.tooltip_enabled = atoi(value); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tooltip_task_show), atoi(value)); } /* Systray */ @@ -454,9 +454,10 @@ void add_entry (char *key, char *value) /* Launcher */ else if (strcmp (key, "launcher_padding") == 0) { extract_values(value, &value1, &value2, &value3); - //panel_config.launcher.area.paddingxlr = panel_config.launcher.area.paddingx = atoi (value1); - //if (value2) panel_config.launcher.area.paddingy = atoi (value2); - //if (value3) panel_config.launcher.area.paddingx = atoi (value3); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_padding_x), atof(value1)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_spacing), atof(value1)); + if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_padding_y), atof(value2)); + if (value3) gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_spacing), atof(value3)); } else if (strcmp (key, "launcher_background_id") == 0) { //int id = atoi (value); @@ -464,7 +465,7 @@ void add_entry (char *key, char *value) //panel_config.launcher.area.bg = &g_array_index(backgrounds, Background, id); } else if (strcmp(key, "launcher_icon_size") == 0) { - //launcher_max_icon_size = atoi(value); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_size), atof(value)); } else if (strcmp(key, "launcher_item_app") == 0) { //char *app = strdup(value); @@ -477,15 +478,15 @@ void add_entry (char *key, char *value) /* Tooltip */ else if (strcmp (key, "tooltip_show_timeout") == 0) { - //int timeout_msec = 1000*atof(value); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_show_after), atof(value)); } else if (strcmp (key, "tooltip_hide_timeout") == 0) { - //int timeout_msec = 1000*atof(value); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_hide_after), atof(value)); } else if (strcmp (key, "tooltip_padding") == 0) { extract_values(value, &value1, &value2, &value3); - //if (value1) g_tooltip.paddingx = atoi(value1); - //if (value2) g_tooltip.paddingy = atoi(value2); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_padding_x), atof(value1)); + if (value2) gtk_spin_button_set_value(GTK_SPIN_BUTTON(tooltip_padding_y), atof(value2)); } else if (strcmp (key, "tooltip_background_id") == 0) { //int id = atoi (value); @@ -494,12 +495,16 @@ void add_entry (char *key, char *value) } else if (strcmp (key, "tooltip_font_color") == 0) { extract_values(value, &value1, &value2, &value3); - //get_color(value1, g_tooltip.font_color.color); - //if (value2) g_tooltip.font_color.alpha = (atoi (value2) / 100.0); - //else g_tooltip.font_color.alpha = 0.1; + 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); + } } else if (strcmp (key, "tooltip_font") == 0) { - //g_tooltip.font_desc = pango_font_description_from_string(value); + gtk_font_button_set_font_name(GTK_FONT_BUTTON(tooltip_font), value); } /* Mouse actions */