summary refs log tree commit diff stats
path: root/src/fe-gtk/banlist.c
diff options
context:
space:
mode:
authorRichardHitt <rbh00@netcom.com>2014-06-17 17:16:45 -0700
committerRichardHitt <rbh00@netcom.com>2014-06-17 17:16:45 -0700
commit7374637d34a4eb1b0e7461e2721fe936e6f31105 (patch)
treed725c1c7604c05372aa962de269f33ea22373d11 /src/fe-gtk/banlist.c
parent62209618e148b18cc508a6af51235c660ee9799a (diff)
Some problems in banlist.c are fixed
Diffstat (limited to 'src/fe-gtk/banlist.c')
-rw-r--r--src/fe-gtk/banlist.c14
1 files changed, 7 insertions, 7 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<<i)
 				{
-					*tbufp++ = modes[i].letter;
+					g_snprintf (tbuf, sizeof tbuf, "quote mode %s +%c", sess->channel, modes[i].letter);
+					handle_command (sess, tbuf, FALSE);
 				}
-			*tbufp = 0;
-			handle_command (sess, tbuf, FALSE);
 		}
 	}
 	else