Documentation: Use G_SOURCE_CONTINUE and G_SOURCE_REMOVE
[geeqie.git] / src / search.cc
index d8e1691..a42a0f8 100644 (file)
@@ -58,7 +58,7 @@
 #define SEARCH_BUFFER_MATCH_MISS 1
 #define SEARCH_BUFFER_FLUSH_SIZE 99
 
-#define FORMAT_CLASS_BROKEN FILE_FORMAT_CLASSES + 1
+#define FORMAT_CLASS_BROKEN static_cast<FileFormatClass>(FILE_FORMAT_CLASSES + 1)
 
 typedef enum {
        SEARCH_MATCH_NONE,
@@ -351,18 +351,18 @@ hard_coded_window_keys search_window_keys[] = {
        {GDK_CONTROL_MASK, 'R', N_("Rename")},
        {GDK_CONTROL_MASK, 'D', N_("Move to Trash")},
        {GDK_SHIFT_MASK, GDK_KEY_Delete, N_("Delete")},
-       {0, GDK_KEY_Delete, N_("Remove")},
+       {static_cast<GdkModifierType>(0), GDK_KEY_Delete, N_("Remove")},
        {GDK_CONTROL_MASK, 'A', N_("Select all")},
-       {GDK_CONTROL_MASK + GDK_SHIFT_MASK, 'A', N_("Select none")},
+       {static_cast<GdkModifierType>(GDK_CONTROL_MASK + GDK_SHIFT_MASK), 'A', N_("Select none")},
        {GDK_CONTROL_MASK, GDK_KEY_Delete, N_("Clear")},
        {GDK_CONTROL_MASK, 'T', N_("Toggle thumbs")},
        {GDK_CONTROL_MASK, 'W', N_("Close window")},
-       {0, GDK_KEY_Return, N_("View")},
-       {0, 'V', N_("View in new window")},
-       {0, 'C', N_("Collection from selection")},
+       {static_cast<GdkModifierType>(0), GDK_KEY_Return, N_("View")},
+       {static_cast<GdkModifierType>(0), 'V', N_("View in new window")},
+       {static_cast<GdkModifierType>(0), 'C', N_("Collection from selection")},
        {GDK_CONTROL_MASK, GDK_KEY_Return, N_("Start/stop search")},
-       {0, GDK_KEY_F3, N_("Find duplicates")},
-       {0, 0, NULL}
+       {static_cast<GdkModifierType>(0), GDK_KEY_F3, N_("Find duplicates")},
+       {static_cast<GdkModifierType>(0), 0, NULL}
 };
 /*
  *-------------------------------------------------------------------
@@ -790,7 +790,7 @@ static gboolean search_result_update_idle_cb(gpointer data)
        search_status_update(sd);
 
        sd->update_idle_id = 0;
-       return FALSE;
+       return G_SOURCE_REMOVE;
 }
 
 static void search_result_update_idle_cancel(SearchData *sd)
@@ -1491,14 +1491,14 @@ static gboolean search_window_keypress_cb(GtkWidget *UNUSED(widget), GdkEventKey
  */
 
 static GtkTargetEntry result_drag_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_result_drag_types = 2;
 
 static GtkTargetEntry result_drop_types[] = {
-       { "text/uri-list", 0, TARGET_URI_LIST },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_result_drop_types = 2;
 
@@ -1647,9 +1647,9 @@ static void search_image_content_dnd_received_cb(GtkWidget *UNUSED(pane), GdkDra
 
 static void search_dnd_init(SearchData *sd)
 {
-       gtk_drag_source_set(sd->result_view, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
+       gtk_drag_source_set(sd->result_view, static_cast<GdkModifierType>(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK),
                            result_drag_types, n_result_drag_types,
-                           GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
+                           static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK));
        g_signal_connect(G_OBJECT(sd->result_view), "drag_data_get",
                         G_CALLBACK(search_dnd_data_set), sd);
        g_signal_connect(G_OBJECT(sd->result_view), "drag_begin",
@@ -1991,13 +1991,13 @@ static gboolean search_file_next(SearchData *sd)
                                }
                        if (sd->search_name_match_case)
                                {
-                               match = g_regex_match(sd->search_name_regex, fd_name_or_path, 0, NULL);
+                               match = g_regex_match(sd->search_name_regex, fd_name_or_path, GRegexMatchFlags(0), NULL);
                                }
                        else
                                {
                                /* sd->search_name is converted in search_start() */
                                gchar *haystack = g_utf8_strdown(fd_name_or_path, -1);
-                               match = g_regex_match(sd->search_name_regex, haystack, 0, NULL);
+                               match = g_regex_match(sd->search_name_regex, haystack, GRegexMatchFlags(0), NULL);
                                g_free(haystack);
                                }
                        }
@@ -2188,11 +2188,11 @@ static gboolean search_file_next(SearchData *sd)
 
                        if (sd->match_comment == SEARCH_MATCH_CONTAINS)
                                {
-                               match = g_regex_match(sd->search_comment_regex, comment, 0, NULL);
+                               match = g_regex_match(sd->search_comment_regex, comment, GRegexMatchFlags(0), NULL);
                                }
                        else if (sd->match_comment == SEARCH_MATCH_NONE)
                                {
-                               match = !g_regex_match(sd->search_comment_regex, comment, 0, NULL);
+                               match = !g_regex_match(sd->search_comment_regex, comment, GRegexMatchFlags(0), NULL);
                                }
                        g_free(comment);
                        }
@@ -2457,9 +2457,9 @@ static gboolean search_step_cb(gpointer data)
                if (search_file_next(sd))
                        {
                        sd->search_idle_id = 0;
-                       return FALSE;
+                       return G_SOURCE_REMOVE;
                        }
-               return TRUE;
+               return G_SOURCE_CONTINUE;
                }
 
        if (!sd->search_file_list && !sd->search_folder_list)
@@ -2469,7 +2469,7 @@ static gboolean search_step_cb(gpointer data)
                search_stop(sd);
                search_result_thumb_step(sd);
 
-               return FALSE;
+               return G_SOURCE_REMOVE;
                }
 
        fd = static_cast<FileData *>(sd->search_folder_list->data);
@@ -2549,7 +2549,7 @@ static gboolean search_step_cb(gpointer data)
                file_data_unref(fd);
                }
 
-       return TRUE;
+       return G_SOURCE_CONTINUE;
 }
 
 static void search_similarity_load_done_cb(ImageLoader *UNUSED(il), gpointer data)
@@ -2583,13 +2583,13 @@ static void search_start(SearchData *sd)
                g_regex_unref(sd->search_name_regex);
                }
 
-       sd->search_name_regex = g_regex_new(sd->search_name, 0, 0, &error);
+       sd->search_name_regex = g_regex_new(sd->search_name, GRegexCompileFlags(0), GRegexMatchFlags(0), &error);
        if (error)
                {
                log_printf("Error: could not compile regular expression %s\n%s\n", sd->search_name, error->message);
                g_error_free(error);
                error = NULL;
-               sd->search_name_regex = g_regex_new("", 0, 0, NULL);
+               sd->search_name_regex = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), NULL);
                }
 
        if (!sd->search_comment_match_case)
@@ -2605,13 +2605,13 @@ static void search_start(SearchData *sd)
                g_regex_unref(sd->search_comment_regex);
                }
 
-       sd->search_comment_regex = g_regex_new(sd->search_comment, 0, 0, &error);
+       sd->search_comment_regex = g_regex_new(sd->search_comment, GRegexCompileFlags(0), GRegexMatchFlags(0), &error);
        if (error)
                {
                log_printf("Error: could not compile regular expression %s\n%s\n", sd->search_comment, error->message);
                g_error_free(error);
                error = NULL;
-               sd->search_comment_regex = g_regex_new("", 0, 0, NULL);
+               sd->search_comment_regex = g_regex_new("", GRegexCompileFlags(0), GRegexMatchFlags(0), NULL);
                }
 
        sd->search_count = 0;
@@ -3348,7 +3348,7 @@ void search_new(FileData *dir_fd, FileData *example_file)
        geometry.base_width = DEF_SEARCH_WIDTH;
        geometry.base_height = DEF_SEARCH_HEIGHT;
        gtk_window_set_geometry_hints(GTK_WINDOW(sd->window), NULL, &geometry,
-                                     GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
+                                     static_cast<GdkWindowHints>(GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE));
 
        if (lw && options->save_window_positions)
                {