Some problems in banlist.c are fixed

This commit is contained in:
RichardHitt 2014-06-17 17:16:45 -07:00
parent 62209618e1
commit 7374637d34
2 changed files with 7 additions and 8 deletions

View File

@ -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,16 +446,14 @@ 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;
}
*tbufp = 0;
g_snprintf (tbuf, sizeof tbuf, "quote mode %s +%c", sess->channel, modes[i].letter);
handle_command (sess, tbuf, FALSE);
}
}
}
else
{
fe_message (_("Not connected."), FE_MSG_ERROR);

View File

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