Documentation: Use G_SOURCE_CONTINUE and G_SOURCE_REMOVE
[geeqie.git] / src / remote.cc
index 4b9c3b4..f7ffc29 100644 (file)
@@ -116,7 +116,7 @@ static gchar *set_pwd(gchar *filename)
 
 static gboolean remote_server_client_cb(GIOChannel *source, GIOCondition condition, gpointer data)
 {
-       RemoteClient *client = (RemoteClient *)data;
+       RemoteClient *client = static_cast<RemoteClient *>(data);
        RemoteConnection *rc;
        GIOStatus status = G_IO_STATUS_NORMAL;
 
@@ -187,7 +187,7 @@ static void remote_server_client_add(RemoteConnection *rc, gint fd)
        client->fd = fd;
 
        channel = g_io_channel_unix_new(fd);
-       client->channel_id = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, G_IO_IN | G_IO_HUP,
+       client->channel_id = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, static_cast<GIOCondition>(G_IO_IN | G_IO_HUP),
                                                 remote_server_client_cb, client, NULL);
        g_io_channel_unref(channel);
 
@@ -199,7 +199,7 @@ static void remote_server_clients_close(RemoteConnection *rc)
 {
        while (rc->clients)
                {
-               RemoteClient *client = rc->clients->data;
+               RemoteClient *client = static_cast<RemoteClient *>(rc->clients->data);
 
                rc->clients = g_list_remove(rc->clients, client);
 
@@ -211,7 +211,7 @@ static void remote_server_clients_close(RemoteConnection *rc)
 
 static gboolean remote_server_read_cb(GIOChannel *UNUSED(source), GIOCondition UNUSED(condition), gpointer data)
 {
-       RemoteConnection *rc = (RemoteConnection *)data;
+       RemoteConnection *rc = static_cast<RemoteConnection *>(data);
        gint fd;
        guint alen;
 
@@ -463,18 +463,18 @@ static void gr_new_window(const gchar *UNUSED(text), GIOChannel *UNUSED(channel)
        layout_set_path(lw_id, pwd);
 }
 
-static gboolean gr_close_window_cb()
+static gboolean gr_close_window_cb(gpointer UNUSED(data))
 {
        if (!layout_valid(&lw_id)) return FALSE;
 
        layout_menu_close_cb(NULL, lw_id);
 
-       return FALSE;
+       return G_SOURCE_REMOVE;
 }
 
 static void gr_close_window(const gchar *UNUSED(text), GIOChannel *UNUSED(channel), gpointer UNUSED(data))
 {
-       g_idle_add(gr_close_window_cb, NULL);
+       g_idle_add((gr_close_window_cb), NULL);
 }
 
 static void gr_image_prev(const gchar *UNUSED(text), GIOChannel *UNUSED(channel), gpointer UNUSED(data))
@@ -674,7 +674,7 @@ static gboolean gr_quit_idle_cb(gpointer UNUSED(data))
 {
        exit_program();
 
-       return FALSE;
+       return G_SOURCE_REMOVE;
 }
 
 static void gr_quit(const gchar *UNUSED(text), GIOChannel *UNUSED(channel), gpointer UNUSED(data))
@@ -876,7 +876,7 @@ static void get_filelist(const gchar *text, GIOChannel *channel, gboolean recurs
        work = list;
        while (work)
                {
-               fd = work->data;
+               fd = static_cast<FileData *>(work->data);
                g_string_append_printf(out_string, "%s", fd->path);
                format_class = filter_file_get_class(fd->path);
 
@@ -922,7 +922,7 @@ static void get_filelist(const gchar *text, GIOChannel *channel, gboolean recurs
        file_data_unref(dir_fd);
 }
 
-static void gr_get_selection(const gchar *UNUSED(text), GIOChannel *channel, gboolean UNUSED(data))
+static void gr_get_selection(const gchar *UNUSED(text), GIOChannel *channel, gpointer UNUSED(data))
 {
        if (!layout_valid(&lw_id)) return;
 
@@ -932,7 +932,7 @@ static void gr_get_selection(const gchar *UNUSED(text), GIOChannel *channel, gbo
        GList *work = selected;
        while (work)
                {
-               FileData *fd = (FileData *)work->data;
+               FileData *fd = static_cast<FileData *>(work->data);
                g_assert(fd->magick == FD_MAGICK);
 
                g_string_append_printf(out_string, "%s    %s\n",
@@ -970,7 +970,7 @@ static void gr_selection_add(const gchar *text, GIOChannel *UNUSED(channel), gpo
                GList *file_list = layout_list(lw_id);
                for (GList *work = file_list; work && !fd_to_select; work = work->next)
                        {
-                       FileData *fd = (FileData *)work->data;
+                       FileData *fd = static_cast<FileData *>(work->data);
                        if (!strcmp(path, fd->path) || g_str_has_suffix(fd->path, slash_plus_filename))
                                {
                                fd_to_select = file_data_ref(fd);
@@ -979,7 +979,7 @@ static void gr_selection_add(const gchar *text, GIOChannel *UNUSED(channel), gpo
 
                        for (GList *sidecar = fd->sidecar_files; sidecar && !fd_to_select; sidecar = sidecar->next)
                                {
-                               FileData *side_fd = sidecar->data;
+                               FileData *side_fd = static_cast<FileData *>(sidecar->data);
                                if (!strcmp(path, side_fd->path)
                                    || g_str_has_suffix(side_fd->path, slash_plus_filename))
                                        {
@@ -1054,7 +1054,7 @@ static void gr_selection_remove(const gchar *text, GIOChannel *UNUSED(channel),
        GList *link_to_remove = NULL;
        for (GList *work = selected; work; prior_link = work, work = work->next)
                {
-               FileData *fd = (FileData *)work->data;
+               FileData *fd = static_cast<FileData *>(work->data);
                if (fd_to_deselect)
                        {
                        if (fd == fd_to_deselect)
@@ -1147,7 +1147,7 @@ static void gr_collection_list(const gchar *UNUSED(text), GIOChannel *channel, g
        work = collection_list;
        while (work)
                {
-               const gchar *collection_name = work->data;
+               const gchar *collection_name = static_cast<const gchar *>(work->data);
                out_string = g_string_append(out_string, g_strdup(collection_name));
                out_string = g_string_append(out_string, "\n");
 
@@ -1169,7 +1169,7 @@ static gboolean wait_cb(const gpointer data)
 
        gtk_window_move(GTK_WINDOW(lw_id->window), x, y);
 
-       return FALSE;
+       return G_SOURCE_REMOVE;
 }
 
 static void gr_geometry(const gchar *text, GIOChannel *UNUSED(channel), gpointer UNUSED(data))
@@ -1396,7 +1396,7 @@ static void gr_get_sidecars(const gchar *text, GIOChannel *channel, gpointer UNU
 
        while (work)
                {
-               fd = work->data;
+               fd = static_cast<FileData *>(work->data);
                work = work->next;
                g_io_channel_write_chars(channel, fd->path, -1, NULL, NULL);
                g_io_channel_write_chars(channel, "<gq_end_of_command>", -1, NULL, NULL);
@@ -1431,7 +1431,7 @@ static void gr_file_view(const gchar *text, GIOChannel *UNUSED(channel), gpointe
 
 static void gr_list_clear(const gchar *UNUSED(text), GIOChannel *UNUSED(channel), gpointer data)
 {
-       RemoteData *remote_data = (RemoteData *)data;
+       RemoteData *remote_data = static_cast<RemoteData *>(data);
 
        remote_data->command_collection = NULL;
        remote_data->file_list = NULL;
@@ -1440,7 +1440,7 @@ static void gr_list_clear(const gchar *UNUSED(text), GIOChannel *UNUSED(channel)
 
 static void gr_list_add(const gchar *text, GIOChannel *UNUSED(channel), gpointer data)
 {
-       RemoteData *remote_data = (RemoteData *)data;
+       RemoteData *remote_data = static_cast<RemoteData *>(data);
        gboolean is_new = TRUE;
        gchar *path = NULL;
        FileData *fd;
@@ -1795,7 +1795,7 @@ void remote_control(const gchar *arg_exec, GList *remote_list, const gchar *path
                        gchar *text;
                        RemoteCommandEntry *entry;
 
-                       text = work->data;
+                       text = static_cast<gchar *>(work->data);
                        work = work->next;
 
                        entry = remote_command_find(text, NULL);
@@ -1853,7 +1853,7 @@ void remote_control(const gchar *arg_exec, GList *remote_list, const gchar *path
                        gchar *text;
                        RemoteCommandEntry *entry;
 
-                       text = work->data;
+                       text = static_cast<gchar *>(work->data);
                        work = work->next;
 
                        entry = remote_command_find(text, NULL);
@@ -1906,7 +1906,7 @@ void remote_control(const gchar *arg_exec, GList *remote_list, const gchar *path
                        const gchar *name;
                        gchar *text;
 
-                       name = work->data;
+                       name = static_cast<const gchar *>(work->data);
                        work = work->next;
 
                        text = g_strdup_printf("file:%s", name);