From e833b275331941fa023b8d0c2be7afd3a9c36542 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 4 Mar 2017 22:14:23 +0100 Subject: [PATCH] tint2conf: disable buttons for gradient/background 0 --- src/systray/systraybar.c | 2 +- src/tint2conf/background_gui.c | 17 +++++++++++++++++ src/tint2conf/gradient_gui.c | 13 +++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index 34af6ee..b07643e 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -586,7 +586,7 @@ void print_icons() gboolean reject_icon(Window win) { - if (systray_hide_name_filter) { + if (systray_hide_name_filter && strlen(systray_hide_name_filter)) { if (!systray_hide_name_regex) { systray_hide_name_regex = (regex_t *) calloc(1, sizeof(*systray_hide_name_regex)); if (regcomp(systray_hide_name_regex, systray_hide_name_filter, 0) != 0) { diff --git a/src/tint2conf/background_gui.c b/src/tint2conf/background_gui.c index 11b9083..ada5fa3 100644 --- a/src/tint2conf/background_gui.c +++ b/src/tint2conf/background_gui.c @@ -846,6 +846,23 @@ void current_background_changed(GtkWidget *widget, gpointer data) if (index < 0) return; + gtk_widget_set_sensitive(gradient_combo_type, index > 0); + gtk_widget_set_sensitive(background_fill_color, index > 0); + gtk_widget_set_sensitive(background_border_color, index > 0); + gtk_widget_set_sensitive(background_gradient, index > 0); + gtk_widget_set_sensitive(background_fill_color_over, index > 0); + gtk_widget_set_sensitive(background_border_color_over, index > 0); + gtk_widget_set_sensitive(background_gradient_over, index > 0); + gtk_widget_set_sensitive(background_fill_color_press, index > 0); + gtk_widget_set_sensitive(background_border_color_press, index > 0); + gtk_widget_set_sensitive(background_gradient_press, index > 0); + gtk_widget_set_sensitive(background_border_width, index > 0); + gtk_widget_set_sensitive(background_border_sides_top, index > 0); + gtk_widget_set_sensitive(background_border_sides_bottom, index > 0); + gtk_widget_set_sensitive(background_border_sides_left, index > 0); + gtk_widget_set_sensitive(background_border_sides_right, index > 0); + gtk_widget_set_sensitive(background_corner_radius, index > 0); + background_updates_disabled = TRUE; GtkTreePath *path; diff --git a/src/tint2conf/gradient_gui.c b/src/tint2conf/gradient_gui.c index 0ceaa52..1f78c26 100644 --- a/src/tint2conf/gradient_gui.c +++ b/src/tint2conf/gradient_gui.c @@ -208,7 +208,7 @@ void gradient_create_new(GradientConfigType t) gtk_list_store_set(gradient_ids, &iter, grColPixbuf, NULL, grColId, &index, - grColText, "", + grColText, index == 0 ? _("None") : "", -1); gradient_update_image(index); @@ -239,6 +239,8 @@ void gradient_duplicate(GtkWidget *widget, gpointer data) GradientConfig *g = (GradientConfig *)calloc(1, sizeof(GradientConfig)); g->type = g_old->type; + g->start_color = g_old->start_color; + g->end_color = g_old->end_color; g->extra_color_stops = g_list_copy_deep(g->extra_color_stops, copy_GradientConfigColorStop, NULL); gradients = g_list_append(gradients, g); GtkTreeIter iter; @@ -352,7 +354,7 @@ void gradient_update(GtkWidget *widget, gpointer data) if (gradient_updates_disabled) return; int index = gtk_combo_box_get_active(GTK_COMBO_BOX(current_gradient)); - if (index < 0) + if (index <= 0) return; GtkTreePath *path; @@ -394,6 +396,13 @@ void current_gradient_changed(GtkWidget *widget, gpointer data) if (index < 0) return; + gtk_widget_set_sensitive(gradient_combo_type, index > 0); + gtk_widget_set_sensitive(gradient_start_color, index > 0); + gtk_widget_set_sensitive(gradient_end_color, index > 0); + gtk_widget_set_sensitive(current_gradient_stop, index > 0); + gtk_widget_set_sensitive(gradient_stop_color, index > 0); + gtk_widget_set_sensitive(gradient_stop_offset, index > 0); + gradient_updates_disabled = TRUE; GradientConfig *g = (GradientConfig *)g_list_nth(gradients, (guint)index)->data;