tint2conf: disable buttons for gradient/background 0

This commit is contained in:
o9000 2017-03-04 22:14:23 +01:00
parent d17b2d8015
commit e833b27533
3 changed files with 29 additions and 3 deletions

View file

@ -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) {

View file

@ -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;

View file

@ -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;