From 7374637d34a4eb1b0e7461e2721fe936e6f31105 Mon Sep 17 00:00:00 2001 From: RichardHitt Date: Tue, 17 Jun 2014 17:16:45 -0700 Subject: [PATCH] Some problems in banlist.c are fixed --- src/fe-gtk/banlist.c | 14 +++++++------- src/fe-gtk/banlist.h | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/fe-gtk/banlist.c b/src/fe-gtk/banlist.c index 33b6da68..d6f44811 100644 --- a/src/fe-gtk/banlist.c +++ b/src/fe-gtk/banlist.c @@ -239,6 +239,9 @@ banlist_sensitize (banlist_info *banl) int checkable, i; gboolean is_op = FALSE; + if (banl->sess->me == NULL) + return; + /* FIXME: More access levels than these can unban */ if (banl->sess->me->op || banl->sess->me->hop) is_op = TRUE; @@ -283,7 +286,7 @@ banlist_sensitize (banlist_info *banl) else { gtk_widget_set_sensitive (banl->but_clear, FALSE); - gtk_widget_set_sensitive (banl->but_crop, TRUE); + gtk_widget_set_sensitive (banl->but_crop, banl->line_ct == banl->select_ct? FALSE: TRUE); gtk_widget_set_sensitive (banl->but_remove, TRUE); } } @@ -410,7 +413,7 @@ banlist_select_changed (GtkWidget *item, banlist_info *banl) else { list = gtk_tree_selection_get_selected_rows (GTK_TREE_SELECTION (item), NULL); - banl->select_ct = list? 1: 0; + banl->select_ct = g_list_length (list); g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL); g_list_free (list); } @@ -426,7 +429,6 @@ banlist_do_refresh (banlist_info *banl) session *sess = banl->sess; char tbuf[256]; int i; - char *tbufp; banlist_sensitize (banl); @@ -444,14 +446,12 @@ banlist_do_refresh (banlist_info *banl) banl->pending = banl->checked; if (banl->pending) { - tbufp = tbuf + g_snprintf (tbuf, sizeof tbuf, "quote mode %s +", sess->channel); for (i = 0; i < MODE_CT; i++) if (banl->pending & 1<channel, modes[i].letter); + handle_command (sess, tbuf, FALSE); } - *tbufp = 0; - handle_command (sess, tbuf, FALSE); } } else diff --git a/src/fe-gtk/banlist.h b/src/fe-gtk/banlist.h index 899ee5e5..ee31c2f8 100644 --- a/src/fe-gtk/banlist.h +++ b/src/fe-gtk/banlist.h @@ -53,7 +53,6 @@ typedef struct banlist_info_s { int current; /* index of currently processing mode */ int line_ct; /* count of presented lines */ int select_ct; /* count of selected lines */ - /* Not really; 1 if any are selected otherwise 0 */ GtkWidget *window; GtkWidget *treeview; GtkWidget *checkboxes[MODE_CT];