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;
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);
{
while (rc->clients)
{
- RemoteClient *client = rc->clients->data;
+ RemoteClient *client = static_cast<RemoteClient *>(rc->clients->data);
rc->clients = g_list_remove(rc->clients, client);
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;
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))
{
exit_program();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void gr_quit(const gchar *UNUSED(text), GIOChannel *UNUSED(channel), gpointer UNUSED(data))
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);
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;
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",
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);
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))
{
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)
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");
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))
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);
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;
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;
typedef struct _RemoteCommandEntry RemoteCommandEntry;
struct _RemoteCommandEntry {
- gchar *opt_s;
- gchar *opt_l;
+ const gchar *opt_s;
+ const gchar *opt_l;
void (*func)(const gchar *text, GIOChannel *channel, gpointer data);
gboolean needs_extra;
gboolean prefer_command_line;
- gchar *parameter;
- gchar *description;
+ const gchar *parameter;
+ const gchar *description;
};
static RemoteCommandEntry remote_commands[] = {
gchar *text;
RemoteCommandEntry *entry;
- text = work->data;
+ text = static_cast<gchar *>(work->data);
work = work->next;
entry = remote_command_find(text, NULL);
gchar *text;
RemoteCommandEntry *entry;
- text = work->data;
+ text = static_cast<gchar *>(work->data);
work = work->next;
entry = remote_command_find(text, NULL);
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);