Mercurial > geeqie.yaz
comparison src/search.c @ 1444:a005287bffc7
gint -> gboolean.
author | zas_ |
---|---|
date | Sun, 15 Mar 2009 15:01:07 +0000 |
parents | a3d3208b0c50 |
children | cb0040be832e |
comparison
equal
deleted
inserted
replaced
1443:f879e7d94c6d | 1444:a005287bffc7 |
---|---|
129 GtkWidget *check_comment; | 129 GtkWidget *check_comment; |
130 GtkWidget *menu_comment; | 130 GtkWidget *menu_comment; |
131 GtkWidget *entry_comment; | 131 GtkWidget *entry_comment; |
132 | 132 |
133 FileData *search_dir_fd; | 133 FileData *search_dir_fd; |
134 gint search_path_recurse; | 134 gboolean search_path_recurse; |
135 gchar *search_name; | 135 gchar *search_name; |
136 gint search_name_match_case; | 136 gboolean search_name_match_case; |
137 gint64 search_size; | 137 gint64 search_size; |
138 gint64 search_size_end; | 138 gint64 search_size_end; |
139 gint search_date_y; | 139 gint search_date_y; |
140 gint search_date_m; | 140 gint search_date_m; |
141 gint search_date_d; | 141 gint search_date_d; |
149 gint search_similarity; | 149 gint search_similarity; |
150 gchar *search_similarity_path; | 150 gchar *search_similarity_path; |
151 CacheData *search_similarity_cd; | 151 CacheData *search_similarity_cd; |
152 GList *search_keyword_list; | 152 GList *search_keyword_list; |
153 gchar *search_comment; | 153 gchar *search_comment; |
154 gint search_comment_match_case; | 154 gboolean search_comment_match_case; |
155 | 155 |
156 MatchType search_type; | 156 MatchType search_type; |
157 | 157 |
158 MatchType match_name; | 158 MatchType match_name; |
159 MatchType match_size; | 159 MatchType match_size; |
186 CacheData *img_cd; | 186 CacheData *img_cd; |
187 | 187 |
188 FileData *click_fd; | 188 FileData *click_fd; |
189 | 189 |
190 ThumbLoader *thumb_loader; | 190 ThumbLoader *thumb_loader; |
191 gint thumb_enable; | 191 gboolean thumb_enable; |
192 FileData *thumb_fd; | 192 FileData *thumb_fd; |
193 | 193 |
194 /* file list for edit menu */ | 194 /* file list for edit menu */ |
195 GList *editmenu_fd_list; | 195 GList *editmenu_fd_list; |
196 | 196 |
308 | 308 |
309 gtk_label_set_text(GTK_LABEL(sd->label_status), buf); | 309 gtk_label_set_text(GTK_LABEL(sd->label_status), buf); |
310 g_free(buf); | 310 g_free(buf); |
311 } | 311 } |
312 | 312 |
313 static void search_progress_update(SearchData *sd, gint search, gdouble thumbs) | 313 static void search_progress_update(SearchData *sd, gboolean search, gdouble thumbs) |
314 { | 314 { |
315 | 315 |
316 if (search || thumbs >= 0.0) | 316 if (search || thumbs >= 0.0) |
317 { | 317 { |
318 gchar *buf; | 318 gchar *buf; |
345 */ | 345 */ |
346 | 346 |
347 static gint search_result_find_row(SearchData *sd, FileData *fd, GtkTreeIter *iter) | 347 static gint search_result_find_row(SearchData *sd, FileData *fd, GtkTreeIter *iter) |
348 { | 348 { |
349 GtkTreeModel *store; | 349 GtkTreeModel *store; |
350 gint valid; | 350 gboolean valid; |
351 gint n = 0; | 351 gint n = 0; |
352 | 352 |
353 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); | 353 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); |
354 valid = gtk_tree_model_get_iter_first(store, iter); | 354 valid = gtk_tree_model_get_iter_first(store, iter); |
355 while (valid) | 355 while (valid) |
363 } | 363 } |
364 | 364 |
365 return -1; | 365 return -1; |
366 } | 366 } |
367 | 367 |
368 static gint search_result_row_selected(SearchData *sd, FileData *fd) | 368 static gboolean search_result_row_selected(SearchData *sd, FileData *fd) |
369 { | 369 { |
370 GtkTreeModel *store; | 370 GtkTreeModel *store; |
371 GtkTreeSelection *selection; | 371 GtkTreeSelection *selection; |
372 GList *slist; | 372 GList *slist; |
373 GList *work; | 373 GList *work; |
450 | 450 |
451 static gint search_result_util(SearchData *sd, gint64 *bytes, GList **list) | 451 static gint search_result_util(SearchData *sd, gint64 *bytes, GList **list) |
452 { | 452 { |
453 GtkTreeModel *store; | 453 GtkTreeModel *store; |
454 GtkTreeIter iter; | 454 GtkTreeIter iter; |
455 gint valid; | 455 gboolean valid; |
456 gint n = 0; | 456 gint n = 0; |
457 gint64 total = 0; | 457 gint64 total = 0; |
458 GList *plist = NULL; | 458 GList *plist = NULL; |
459 | 459 |
460 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); | 460 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); |
529 static GList *search_result_refine_list(SearchData *sd) | 529 static GList *search_result_refine_list(SearchData *sd) |
530 { | 530 { |
531 GList *list = NULL; | 531 GList *list = NULL; |
532 GtkTreeModel *store; | 532 GtkTreeModel *store; |
533 GtkTreeIter iter; | 533 GtkTreeIter iter; |
534 gint valid; | 534 gboolean valid; |
535 | 535 |
536 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); | 536 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); |
537 | 537 |
538 valid = gtk_tree_model_get_iter_first(store, &iter); | 538 valid = gtk_tree_model_get_iter_first(store, &iter); |
539 while (valid) | 539 while (valid) |
601 | 601 |
602 static void search_result_remove(SearchData *sd, FileData *fd) | 602 static void search_result_remove(SearchData *sd, FileData *fd) |
603 { | 603 { |
604 GtkTreeModel *store; | 604 GtkTreeModel *store; |
605 GtkTreeIter iter; | 605 GtkTreeIter iter; |
606 gint valid; | 606 gboolean valid; |
607 | 607 |
608 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); | 608 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); |
609 valid = gtk_tree_model_get_iter_first(store, &iter); | 609 valid = gtk_tree_model_get_iter_first(store, &iter); |
610 while (valid) | 610 while (valid) |
611 { | 611 { |
678 w = collection_window_new(NULL); | 678 w = collection_window_new(NULL); |
679 collection_table_add_filelist(w->table, list); | 679 collection_table_add_filelist(w->table, list); |
680 filelist_free(list); | 680 filelist_free(list); |
681 } | 681 } |
682 | 682 |
683 static gint search_result_update_idle_cb(gpointer data) | 683 static gboolean search_result_update_idle_cb(gpointer data) |
684 { | 684 { |
685 SearchData *sd = data; | 685 SearchData *sd = data; |
686 | 686 |
687 search_status_update(sd); | 687 search_status_update(sd); |
688 | 688 |
753 static void search_result_thumb_step(SearchData *sd) | 753 static void search_result_thumb_step(SearchData *sd) |
754 { | 754 { |
755 GtkTreeModel *store; | 755 GtkTreeModel *store; |
756 GtkTreeIter iter; | 756 GtkTreeIter iter; |
757 MatchFileData *mfd = NULL; | 757 MatchFileData *mfd = NULL; |
758 gint valid; | 758 gboolean valid; |
759 gint row = 0; | 759 gint row = 0; |
760 gint length = 0; | 760 gint length = 0; |
761 | 761 |
762 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); | 762 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); |
763 valid = gtk_tree_model_get_iter_first(store, &iter); | 763 valid = gtk_tree_model_get_iter_first(store, &iter); |
836 | 836 |
837 g_object_set(G_OBJECT(cell), "height", (sd->thumb_enable) ? options->thumbnails.max_height : -1, NULL); | 837 g_object_set(G_OBJECT(cell), "height", (sd->thumb_enable) ? options->thumbnails.max_height : -1, NULL); |
838 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(sd->result_view)); | 838 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(sd->result_view)); |
839 } | 839 } |
840 | 840 |
841 static void search_result_thumb_enable(SearchData *sd, gint enable) | 841 static void search_result_thumb_enable(SearchData *sd, gboolean enable) |
842 { | 842 { |
843 if (sd->thumb_enable == enable) return; | 843 if (sd->thumb_enable == enable) return; |
844 | 844 |
845 if (sd->thumb_enable) | 845 if (sd->thumb_enable) |
846 { | 846 { |
847 GtkTreeModel *store; | 847 GtkTreeModel *store; |
848 GtkTreeIter iter; | 848 GtkTreeIter iter; |
849 gint valid; | 849 gboolean valid; |
850 | 850 |
851 thumb_loader_free(sd->thumb_loader); | 851 thumb_loader_free(sd->thumb_loader); |
852 sd->thumb_loader = NULL; | 852 sd->thumb_loader = NULL; |
853 | 853 |
854 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); | 854 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); |
989 | 989 |
990 filelist_free(sd->editmenu_fd_list); | 990 filelist_free(sd->editmenu_fd_list); |
991 sd->editmenu_fd_list = NULL; | 991 sd->editmenu_fd_list = NULL; |
992 } | 992 } |
993 | 993 |
994 static GtkWidget *search_result_menu(SearchData *sd, gint on_row, gint empty) | 994 static GtkWidget *search_result_menu(SearchData *sd, gboolean on_row, gboolean empty) |
995 { | 995 { |
996 GtkWidget *menu; | 996 GtkWidget *menu; |
997 GtkWidget *item; | 997 GtkWidget *item; |
998 | 998 |
999 menu = popup_menu_short_lived(); | 999 menu = popup_menu_short_lived(); |
1061 *------------------------------------------------------------------- | 1061 *------------------------------------------------------------------- |
1062 * result list input | 1062 * result list input |
1063 *------------------------------------------------------------------- | 1063 *------------------------------------------------------------------- |
1064 */ | 1064 */ |
1065 | 1065 |
1066 static gint search_result_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) | 1066 static gboolean search_result_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
1067 { | 1067 { |
1068 SearchData *sd = data; | 1068 SearchData *sd = data; |
1069 GtkTreeModel *store; | 1069 GtkTreeModel *store; |
1070 GtkTreePath *tpath; | 1070 GtkTreePath *tpath; |
1071 GtkTreeIter iter; | 1071 GtkTreeIter iter; |
1128 } | 1128 } |
1129 | 1129 |
1130 return FALSE; | 1130 return FALSE; |
1131 } | 1131 } |
1132 | 1132 |
1133 static gint search_result_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) | 1133 static gboolean search_result_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
1134 { | 1134 { |
1135 SearchData *sd = data; | 1135 SearchData *sd = data; |
1136 GtkTreeModel *store; | 1136 GtkTreeModel *store; |
1137 GtkTreePath *tpath; | 1137 GtkTreePath *tpath; |
1138 GtkTreeIter iter; | 1138 GtkTreeIter iter; |
1190 } | 1190 } |
1191 | 1191 |
1192 return FALSE; | 1192 return FALSE; |
1193 } | 1193 } |
1194 | 1194 |
1195 static gint search_result_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | 1195 static gboolean search_result_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
1196 { | 1196 { |
1197 SearchData *sd = data; | 1197 SearchData *sd = data; |
1198 gboolean stop_signal = FALSE; | 1198 gboolean stop_signal = FALSE; |
1199 GtkTreeModel *store; | 1199 GtkTreeModel *store; |
1200 GtkTreeSelection *selection; | 1200 GtkTreeSelection *selection; |
1333 } | 1333 } |
1334 | 1334 |
1335 return stop_signal; | 1335 return stop_signal; |
1336 } | 1336 } |
1337 | 1337 |
1338 static gint search_window_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | 1338 static gboolean search_window_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
1339 { | 1339 { |
1340 SearchData *sd = data; | 1340 SearchData *sd = data; |
1341 gboolean stop_signal = FALSE; | 1341 gboolean stop_signal = FALSE; |
1342 | 1342 |
1343 if (event->state & GDK_CONTROL_MASK) | 1343 if (event->state & GDK_CONTROL_MASK) |
1455 *------------------------------------------------------------------- | 1455 *------------------------------------------------------------------- |
1456 */ | 1456 */ |
1457 | 1457 |
1458 #define MATCH_IS_BETWEEN(val, a, b) (b > a ? (val >= a && val <= b) : (val >= b && val <= a)) | 1458 #define MATCH_IS_BETWEEN(val, a, b) (b > a ? (val >= a && val <= b) : (val >= b && val <= a)) |
1459 | 1459 |
1460 static gint search_step_cb(gpointer data); | 1460 static gboolean search_step_cb(gpointer data); |
1461 | 1461 |
1462 | 1462 |
1463 static void search_buffer_flush(SearchData *sd) | 1463 static void search_buffer_flush(SearchData *sd) |
1464 { | 1464 { |
1465 GList *work; | 1465 GList *work; |
1568 { | 1568 { |
1569 SearchData *sd = data; | 1569 SearchData *sd = data; |
1570 search_file_load_process(sd, sd->img_cd); | 1570 search_file_load_process(sd, sd->img_cd); |
1571 } | 1571 } |
1572 | 1572 |
1573 static gint search_file_do_extra(SearchData *sd, FileData *fd, gint *match, | 1573 static gboolean search_file_do_extra(SearchData *sd, FileData *fd, gint *match, |
1574 gint *width, gint *height, gint *simval) | 1574 gint *width, gint *height, gint *simval) |
1575 { | 1575 { |
1576 gboolean new_data = FALSE; | 1576 gboolean new_data = FALSE; |
1577 gboolean tmatch = TRUE; | 1577 gboolean tmatch = TRUE; |
1578 gboolean tested = FALSE; | 1578 gboolean tested = FALSE; |
1579 | 1579 |
1679 *match = (tmatch && tested); | 1679 *match = (tmatch && tested); |
1680 | 1680 |
1681 return FALSE; | 1681 return FALSE; |
1682 } | 1682 } |
1683 | 1683 |
1684 static gint search_file_next(SearchData *sd) | 1684 static gboolean search_file_next(SearchData *sd) |
1685 { | 1685 { |
1686 FileData *fd; | 1686 FileData *fd; |
1687 gboolean match = TRUE; | 1687 gboolean match = TRUE; |
1688 gboolean tested = FALSE; | 1688 gboolean tested = FALSE; |
1689 gboolean extra_only = FALSE; | 1689 gboolean extra_only = FALSE; |
1890 | 1890 |
1891 comment = metadata_read_string(fd, COMMENT_KEY, METADATA_PLAIN); | 1891 comment = metadata_read_string(fd, COMMENT_KEY, METADATA_PLAIN); |
1892 | 1892 |
1893 if (comment) | 1893 if (comment) |
1894 { | 1894 { |
1895 if (! sd->search_comment_match_case) | 1895 if (!sd->search_comment_match_case) |
1896 { | 1896 { |
1897 gchar *tmp = g_utf8_strdown(comment, -1); | 1897 gchar *tmp = g_utf8_strdown(comment, -1); |
1898 g_free(comment); | 1898 g_free(comment); |
1899 comment = tmp; | 1899 comment = tmp; |
1900 } | 1900 } |
1952 } | 1952 } |
1953 | 1953 |
1954 return FALSE; | 1954 return FALSE; |
1955 } | 1955 } |
1956 | 1956 |
1957 static gint search_step_cb(gpointer data) | 1957 static gboolean search_step_cb(gpointer data) |
1958 { | 1958 { |
1959 SearchData *sd = data; | 1959 SearchData *sd = data; |
1960 FileData *fd; | 1960 FileData *fd; |
1961 | 1961 |
1962 if (sd->search_buffer_count > SEARCH_BUFFER_FLUSH_SIZE) | 1962 if (sd->search_buffer_count > SEARCH_BUFFER_FLUSH_SIZE) |
2324 } | 2324 } |
2325 | 2325 |
2326 return 0; | 2326 return 0; |
2327 } | 2327 } |
2328 | 2328 |
2329 static void search_result_add_column(SearchData * sd, gint n, const gchar *title, gint image, gint right_justify) | 2329 static void search_result_add_column(SearchData * sd, gint n, const gchar *title, gboolean image, gboolean right_justify) |
2330 { | 2330 { |
2331 GtkTreeViewColumn *column; | 2331 GtkTreeViewColumn *column; |
2332 GtkCellRenderer *renderer; | 2332 GtkCellRenderer *renderer; |
2333 | 2333 |
2334 column = gtk_tree_view_column_new(); | 2334 column = gtk_tree_view_column_new(); |
2357 } | 2357 } |
2358 | 2358 |
2359 gtk_tree_view_append_column(GTK_TREE_VIEW(sd->result_view), column); | 2359 gtk_tree_view_append_column(GTK_TREE_VIEW(sd->result_view), column); |
2360 } | 2360 } |
2361 | 2361 |
2362 static void menu_choice_set_visible(GtkWidget *widget, gint visible) | 2362 static void menu_choice_set_visible(GtkWidget *widget, gboolean visible) |
2363 { | 2363 { |
2364 if (visible) | 2364 if (visible) |
2365 { | 2365 { |
2366 if (!GTK_WIDGET_VISIBLE(widget)) gtk_widget_show(widget); | 2366 if (!GTK_WIDGET_VISIBLE(widget)) gtk_widget_show(widget); |
2367 } | 2367 } |
2558 static void search_window_close(SearchData *sd) | 2558 static void search_window_close(SearchData *sd) |
2559 { | 2559 { |
2560 gtk_widget_destroy(sd->window); | 2560 gtk_widget_destroy(sd->window); |
2561 } | 2561 } |
2562 | 2562 |
2563 static gint search_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) | 2563 static gboolean search_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) |
2564 { | 2564 { |
2565 SearchData *sd = data; | 2565 SearchData *sd = data; |
2566 | 2566 |
2567 search_window_close(sd); | 2567 search_window_close(sd); |
2568 return TRUE; | 2568 return TRUE; |
2910 | 2910 |
2911 static void search_result_change_path(SearchData *sd, FileData *fd) | 2911 static void search_result_change_path(SearchData *sd, FileData *fd) |
2912 { | 2912 { |
2913 GtkTreeModel *store; | 2913 GtkTreeModel *store; |
2914 GtkTreeIter iter; | 2914 GtkTreeIter iter; |
2915 gint valid; | 2915 gboolean valid; |
2916 | 2916 |
2917 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); | 2917 store = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->result_view)); |
2918 valid = gtk_tree_model_get_iter_first(store, &iter); | 2918 valid = gtk_tree_model_get_iter_first(store, &iter); |
2919 while (valid) | 2919 while (valid) |
2920 { | 2920 { |