diff src/collect-table.c @ 1420:3a9fb1b52559

Use gboolean where applicable, for the sake of consistency.
author zas_
date Thu, 12 Mar 2009 21:06:37 +0000
parents a0bd58a6535f
children c9ed5a43c576
line wrap: on
line diff
--- a/src/collect-table.c	Wed Mar 11 23:36:01 2009 +0000
+++ b/src/collect-table.c	Thu Mar 12 21:06:37 2009 +0000
@@ -65,7 +65,7 @@
 #define INFO_SELECTED(x) (x->flag_mask & SELECTION_SELECTED)
 
 
-static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gint force);
+static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gboolean force);
 
 
 /*
@@ -74,7 +74,7 @@
  *-------------------------------------------------------------------
  */
 
-static gint collection_table_find_position(CollectTable *ct, CollectInfo *info, gint *row, gint *col)
+static gboolean collection_table_find_position(CollectTable *ct, CollectInfo *info, gint *row, gint *col)
 {
 	gint n;
 
@@ -88,7 +88,7 @@
 	return TRUE;
 }
 
-static gint collection_table_find_iter(CollectTable *ct, CollectInfo *info, GtkTreeIter *iter, gint *column)
+static gboolean collection_table_find_iter(CollectTable *ct, CollectInfo *info, GtkTreeIter *iter, gint *column)
 {
 	GtkTreeModel *store;
 	gint row, col;
@@ -227,7 +227,7 @@
 	g_free(buf);
 }
 
-static void collection_table_update_extras(CollectTable *ct, gint loading, gdouble value)
+static void collection_table_update_extras(CollectTable *ct, gboolean loading, gdouble value)
 {
 	gchar *text;
 
@@ -422,7 +422,7 @@
 	collection_table_update_status(ct);
 }
 
-static void collection_table_select_util(CollectTable *ct, CollectInfo *info, gint select)
+static void collection_table_select_util(CollectTable *ct, CollectInfo *info, gboolean select)
 {
 	if (select)
 		{
@@ -434,7 +434,7 @@
 		}
 }
 
-static void collection_table_select_region_util(CollectTable *ct, CollectInfo *start, CollectInfo *end, gint select)
+static void collection_table_select_region_util(CollectTable *ct, CollectInfo *start, CollectInfo *end, gboolean select)
 {
 	gint row1, col1;
 	gint row2, col2;
@@ -548,7 +548,7 @@
 	ct->tip_window = NULL;
 }
 
-static gint tip_schedule_cb(gpointer data)
+static gboolean tip_schedule_cb(gpointer data)
 {
 	CollectTable *ct = data;
 
@@ -844,7 +844,7 @@
 	ct->editmenu_fd_list = NULL;
 }
 
-static GtkWidget *collection_table_popup_menu(CollectTable *ct, gint over_icon)
+static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_icon)
 {
 	GtkWidget *menu;
 	GtkWidget *item;
@@ -969,7 +969,7 @@
 		}
 }
 
-static void collection_table_move_focus(CollectTable *ct, gint row, gint col, gint relative)
+static void collection_table_move_focus(CollectTable *ct, gint row, gint col, gboolean relative)
 {
 	gint new_row;
 	gint new_col;
@@ -1115,15 +1115,14 @@
 	popup_menu_position_clamp(menu, x, y, 0);
 }
 
-static gint collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
+static gboolean collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
 	CollectTable *ct = data;
 	gint focus_row = 0;
 	gint focus_col = 0;
 	CollectInfo *info;
-	gint stop_signal;
-
-	stop_signal = TRUE;
+	gboolean stop_signal = TRUE;
+
 	switch (event->keyval)
 		{
 		case GDK_Left: case GDK_KP_Left:
@@ -1240,8 +1239,8 @@
  *-------------------------------------------------------------------
  */
 
-static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *source, gint *after, GdkRectangle *cell,
-						 gint use_coord, gint x, gint y)
+static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *source, gboolean *after, GdkRectangle *cell,
+						 gboolean use_coord, gint x, gint y)
 {
 	CollectInfo *info = NULL;
 	GtkTreeModel *store;
@@ -1264,7 +1263,7 @@
 			gtk_tree_path_free(tpath);
 
 			info = source;
-			*after = (x > cell->x + (cell->width / 2));
+			*after = !!(x > cell->x + (cell->width / 2));
 			}
 		return info;
 		}
@@ -1284,7 +1283,7 @@
 		if (info)
 			{
 			gtk_tree_view_get_background_area(GTK_TREE_VIEW(ct->listview), tpath, column, cell);
-			*after = (x > cell->x + (cell->width / 2));
+			*after = !!(x > cell->x + (cell->width / 2));
 			}
 
 		gtk_tree_path_free(tpath);
@@ -1319,7 +1318,7 @@
 {
 	CollectInfo *info;
 	GdkRectangle cell;
-	gint after = FALSE;
+	gboolean after = FALSE;
 
 	info = collection_table_insert_find(ct, NULL, &after, &cell, TRUE, x, y);
 
@@ -1341,10 +1340,10 @@
 	return info;
 }
 
-static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, gint enable)
+static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, gboolean enable)
 {
 	gint row, col;
-	gint after = FALSE;
+	gboolean after = FALSE;
 	GdkRectangle cell;
 
 	if (!enable)
@@ -1430,7 +1429,7 @@
  *-------------------------------------------------------------------
  */
 
-static void collection_table_motion_update(CollectTable *ct, gint x, gint y, gint drop_event)
+static void collection_table_motion_update(CollectTable *ct, gint x, gint y, gboolean drop_event)
 {
 	CollectInfo *info;
 
@@ -1447,7 +1446,7 @@
 		}
 }
 
-static gint collection_table_auto_scroll_idle_cb(gpointer data)
+static gboolean collection_table_auto_scroll_idle_cb(gpointer data)
 {
 	CollectTable *ct = data;
 	GdkWindow *window;
@@ -1468,7 +1467,7 @@
 	return FALSE;
 }
 
-static gint collection_table_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data)
+static gboolean collection_table_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data)
 {
 	CollectTable *ct = data;
 
@@ -1477,7 +1476,7 @@
 	return TRUE;
 }
 
-static void collection_table_scroll(CollectTable *ct, gint scroll)
+static void collection_table_scroll(CollectTable *ct, gboolean scroll)
 {
 	if (!scroll)
 		{
@@ -1503,7 +1502,7 @@
  *-------------------------------------------------------------------
  */
 
-static gint collection_table_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
+static gboolean collection_table_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
 {
 	CollectTable *ct = data;
 
@@ -1512,7 +1511,7 @@
 	return FALSE;
 }
 
-static gint collection_table_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
+static gboolean collection_table_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
 {
 	CollectTable *ct = data;
 	GtkTreeIter iter;
@@ -1551,7 +1550,7 @@
 	return TRUE;
 }
 
-static gint collection_table_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
+static gboolean collection_table_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
 {
 	CollectTable *ct = data;
 	GtkTreeIter iter;
@@ -1559,7 +1558,7 @@
 
 	tip_schedule(ct);
 
-	if ((gint)bevent->x != 0 || (gint) bevent->y != 0)
+	if ((gint)bevent->x != 0 || (gint)bevent->y != 0)
 		{
 		info = collection_table_find_data_by_coord(ct, (gint)bevent->x, (gint)bevent->y, &iter);
 		}
@@ -1576,9 +1575,8 @@
 
 		if (bevent->state & GDK_CONTROL_MASK)
 			{
-			gint select;
-
-			select = !INFO_SELECTED(info);
+			gboolean select = !INFO_SELECTED(info);
+
 			if ((bevent->state & GDK_SHIFT_MASK) && ct->prev_selection)
 				{
 				collection_table_select_region_util(ct, ct->prev_selection, info, select);
@@ -1612,7 +1610,7 @@
 	return TRUE;
 }
 
-static gint collection_table_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
+static gboolean collection_table_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
 {
 	CollectTable *ct = data;
 
@@ -1661,7 +1659,7 @@
 	return list;
 }
 
-static void collection_table_populate(CollectTable *ct, gint resize)
+static void collection_table_populate(CollectTable *ct, gboolean resize)
 {
 	gint row;
 	GList *work;
@@ -1725,7 +1723,7 @@
 	collection_table_update_status(ct);
 }
 
-static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gint force)
+static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gboolean force)
 {
 	gint new_cols;
 	gint thumb_width;
@@ -1809,7 +1807,7 @@
 	collection_table_update_status(ct);
 }
 
-static gint collection_table_sync_idle_cb(gpointer data)
+static gboolean collection_table_sync_idle_cb(gpointer data)
 {
 	CollectTable *ct = data;
 
@@ -1993,7 +1991,7 @@
  *-------------------------------------------------------------------
  */
 
-static void collection_table_add_dir_recursive(CollectTable *ct, FileData *dir_fd, gint recursive)
+static void collection_table_add_dir_recursive(CollectTable *ct, FileData *dir_fd, gboolean recursive)
 {
 	GList *d;
 	GList *f;
@@ -2021,7 +2019,7 @@
 	filelist_free(d);
 }
 
-static void confirm_dir_list_do(CollectTable *ct, GList *list, gint recursive)
+static void confirm_dir_list_do(CollectTable *ct, GList *list, gboolean recursive)
 {
 	GList *work = list;
 	while (work)
@@ -2102,7 +2100,7 @@
 				     guint time, gpointer data)
 {
 	CollectTable *ct = data;
-	gint selected;
+	gboolean selected;
 	GList *list = NULL;
 	gchar *uri_text = NULL;
 	gint total;
@@ -2513,4 +2511,5 @@
 {
 	return collection_table_find_data(ct, ct->focus_row, ct->focus_column, NULL);
 }
+
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */