Use unsigned int consistently for ignore type, and use IG_* constants instead of numeric literals.
This commit is contained in:
parent
a031a24cfd
commit
cadff706e7
@ -77,7 +77,7 @@ ignore_exists (char *mask)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
ignore_add (char *mask, int type, gboolean overwrite)
|
ignore_add (char *mask, unsigned int type, gboolean overwrite)
|
||||||
{
|
{
|
||||||
struct ignore *ig = NULL;
|
struct ignore *ig = NULL;
|
||||||
int change_only = FALSE;
|
int change_only = FALSE;
|
||||||
@ -200,7 +200,7 @@ ignore_del (char *mask, struct ignore *ig)
|
|||||||
/* check if a msg should be ignored by browsing our ignore list */
|
/* check if a msg should be ignored by browsing our ignore list */
|
||||||
|
|
||||||
int
|
int
|
||||||
ignore_check (char *host, int type)
|
ignore_check (char *host, unsigned int type)
|
||||||
{
|
{
|
||||||
struct ignore *ig;
|
struct ignore *ig;
|
||||||
GSList *list = ignore_list;
|
GSList *list = ignore_list;
|
||||||
|
@ -44,10 +44,10 @@ struct ignore
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ignore *ignore_exists (char *mask);
|
struct ignore *ignore_exists (char *mask);
|
||||||
int ignore_add (char *mask, int type, gboolean overwrite);
|
int ignore_add (char *mask, unsigned int type, gboolean overwrite);
|
||||||
void ignore_showlist (session *sess);
|
void ignore_showlist (session *sess);
|
||||||
int ignore_del (char *mask, struct ignore *ig);
|
int ignore_del (char *mask, struct ignore *ig);
|
||||||
int ignore_check (char *mask, int type);
|
int ignore_check (char *mask, unsigned int type);
|
||||||
void ignore_load (void);
|
void ignore_load (void);
|
||||||
void ignore_save (void);
|
void ignore_save (void);
|
||||||
void ignore_gui_open (void);
|
void ignore_gui_open (void);
|
||||||
|
@ -58,14 +58,22 @@ get_store (void)
|
|||||||
return gtk_tree_view_get_model (g_object_get_data (G_OBJECT (ignorewin), "view"));
|
return gtk_tree_view_get_model (g_object_get_data (G_OBJECT (ignorewin), "view"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static unsigned int
|
||||||
ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
|
ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
gboolean chan, priv, noti, ctcp, dcc, invi, unig;
|
gboolean chan, priv, noti, ctcp, dcc, invi, unig;
|
||||||
int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter, 1, &chan, 2, &priv, 3, ¬i,
|
gtk_tree_model_get (
|
||||||
4, &ctcp, 5, &dcc, 6, &invi, 7, &unig, -1);
|
model, iter,
|
||||||
|
CHAN_COLUMN, &chan,
|
||||||
|
PRIV_COLUMN, &priv,
|
||||||
|
NOTICE_COLUMN, ¬i,
|
||||||
|
CTCP_COLUMN, &ctcp,
|
||||||
|
DCC_COLUMN, &dcc,
|
||||||
|
INVITE_COLUMN, &invi,
|
||||||
|
UNIGNORE_COLUMN, &unig,
|
||||||
|
-1);
|
||||||
if (chan)
|
if (chan)
|
||||||
flags |= IG_CHAN;
|
flags |= IG_CHAN;
|
||||||
if (priv)
|
if (priv)
|
||||||
@ -89,11 +97,11 @@ mask_edited (GtkCellRendererText *render, gchar *path, gchar *new, gpointer dat)
|
|||||||
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
char *old;
|
char *old;
|
||||||
int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
||||||
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &old, -1);
|
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &old, -1);
|
||||||
|
|
||||||
if (!strcmp (old, new)) /* no change */
|
if (!strcmp (old, new)) /* no change */
|
||||||
;
|
;
|
||||||
else if (ignore_exists (new)) /* duplicate, ignore */
|
else if (ignore_exists (new)) /* duplicate, ignore */
|
||||||
@ -109,7 +117,6 @@ mask_edited (GtkCellRendererText *render, gchar *path, gchar *new, gpointer dat)
|
|||||||
gtk_list_store_set (store, &iter, MASK_COLUMN, new, -1);
|
gtk_list_store_set (store, &iter, MASK_COLUMN, new, -1);
|
||||||
}
|
}
|
||||||
g_free (old);
|
g_free (old);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -120,7 +127,7 @@ option_toggled (GtkCellRendererToggle *render, gchar *path, gpointer data)
|
|||||||
int col_id = GPOINTER_TO_INT (data);
|
int col_id = GPOINTER_TO_INT (data);
|
||||||
gboolean active;
|
gboolean active;
|
||||||
char *mask;
|
char *mask;
|
||||||
int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
gtkutil_treemodel_string_to_iter (GTK_TREE_MODEL (store), path, &iter);
|
||||||
|
|
||||||
@ -233,7 +240,7 @@ ignore_store_new (int cancel, char *mask, gpointer data)
|
|||||||
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
GtkListStore *store = GTK_LIST_STORE (get_store ());
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
int flags = IG_CHAN | IG_PRIV | IG_NOTI | IG_CTCP | IG_DCC | IG_INVI;
|
unsigned int flags = IG_CHAN | IG_PRIV | IG_NOTI | IG_CTCP | IG_DCC | IG_INVI;
|
||||||
|
|
||||||
if (cancel)
|
if (cancel)
|
||||||
return;
|
return;
|
||||||
@ -248,8 +255,17 @@ ignore_store_new (int cancel, char *mask, gpointer data)
|
|||||||
|
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
/* ignore everything by default */
|
/* ignore everything by default */
|
||||||
gtk_list_store_set (store, &iter, 0, mask, 1, TRUE, 2, TRUE, 3, TRUE,
|
gtk_list_store_set (
|
||||||
4, TRUE, 5, TRUE, 6, TRUE, 7, FALSE, -1);
|
store, &iter,
|
||||||
|
MASK_COLUMN, mask,
|
||||||
|
CHAN_COLUMN, TRUE,
|
||||||
|
PRIV_COLUMN, TRUE,
|
||||||
|
NOTICE_COLUMN, TRUE,
|
||||||
|
CTCP_COLUMN, TRUE,
|
||||||
|
DCC_COLUMN, TRUE,
|
||||||
|
INVITE_COLUMN, TRUE,
|
||||||
|
UNIGNORE_COLUMN, FALSE,
|
||||||
|
-1);
|
||||||
/* make sure the new row is visible and selected */
|
/* make sure the new row is visible and selected */
|
||||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
|
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
|
||||||
gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 1.0, 0.0);
|
gtk_tree_view_scroll_to_cell (view, path, NULL, TRUE, 1.0, 0.0);
|
||||||
|
Loading…
Reference in New Issue
Block a user