Documentation: Use G_SOURCE_CONTINUE and G_SOURCE_REMOVE
[geeqie.git] / src / bar-keywords.cc
index 4ff9f3e..4076b8e 100644 (file)
@@ -88,7 +88,7 @@ static void keyword_list_push(GtkWidget *textview, GList *list)
 
        while (list)
                {
-               const gchar *word = list->data;
+               const gchar *word = static_cast<const gchar *>(list->data);
                GtkTextIter iter;
 
                gtk_text_buffer_get_end_iter(buffer, &iter);
@@ -173,7 +173,7 @@ static void bar_pane_keywords_write(PaneKeywordsData *pkd)
 
 gboolean bar_keyword_tree_expand_if_set_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gboolean set;
 
        gtk_tree_model_get(model, iter, FILTER_KEYWORD_COLUMN_TOGGLE, &set, -1);
@@ -187,7 +187,7 @@ gboolean bar_keyword_tree_expand_if_set_cb(GtkTreeModel *model, GtkTreePath *pat
 
 gboolean bar_keyword_tree_collapse_if_unset_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gboolean set;
 
        gtk_tree_model_get(model, iter, FILTER_KEYWORD_COLUMN_TOGGLE, &set, -1);
@@ -236,7 +236,7 @@ static void bar_pane_keywords_update(PaneKeywordsData *pkd)
 
        while (work1 && work2)
                {
-               if (strcmp(work1->data, work2->data) != 0) break;
+               if (strcmp(static_cast<const gchar *>(work1->data), static_cast<const gchar *>(work2->data)) != 0) break;
                work1 = work1->next;
                work2 = work2->next;
                }
@@ -256,7 +256,7 @@ void bar_pane_keywords_set_fd(GtkWidget *pane, FileData *fd)
 {
        PaneKeywordsData *pkd;
 
-       pkd = g_object_get_data(G_OBJECT(pane), "pane_data");
+       pkd = static_cast<PaneKeywordsData *>(g_object_get_data(G_OBJECT(pane), "pane_data"));
        if (!pkd) return;
 
        file_data_unref(pkd->fd);
@@ -267,7 +267,7 @@ void bar_pane_keywords_set_fd(GtkWidget *pane, FileData *fd)
 
 void bar_keyword_tree_get_expanded_cb(GtkTreeView *keyword_treeview, GtkTreePath *path,  gpointer data)
 {
-       GList **expanded = (GList **)data;
+       GList **expanded = static_cast<GList **>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
        gchar *path_string;
@@ -300,7 +300,7 @@ static void bar_pane_keywords_write_config(GtkWidget *pane, GString *outstr, gin
        GList *path_expanded = NULL;
        gint w, h;
 
-       pkd = g_object_get_data(G_OBJECT(pane), "pane_data");
+       pkd = static_cast<PaneKeywordsData *>(g_object_get_data(G_OBJECT(pane), "pane_data"));
        if (!pkd) return;
 
        gtk_widget_get_size_request(GTK_WIDGET(pane), &w, &h);
@@ -321,7 +321,7 @@ static void bar_pane_keywords_write_config(GtkWidget *pane, GString *outstr, gin
        g_list_first(path_expanded);
        while (path_expanded)
                {
-               bar_pane_keywords_entry_write_config(path_expanded->data, outstr, indent);
+               bar_pane_keywords_entry_write_config(static_cast<gchar *>(path_expanded->data), outstr, indent);
                g_free(path_expanded->data);
                path_expanded = path_expanded->next;
                }
@@ -336,7 +336,7 @@ gint bar_pane_keywords_event(GtkWidget *bar, GdkEvent *event)
 {
        PaneKeywordsData *pkd;
 
-       pkd = g_object_get_data(G_OBJECT(bar), "pane_data");
+       pkd = static_cast<PaneKeywordsData *>(g_object_get_data(G_OBJECT(bar), "pane_data"));
        if (!pkd) return FALSE;
 
        if (gtk_widget_has_focus(pkd->keyword_view)) return gtk_widget_event(pkd->keyword_view, event);
@@ -350,7 +350,7 @@ gint bar_pane_keywords_event(GtkWidget *bar, GdkEvent *event)
 
 static void bar_pane_keywords_keyword_toggle(GtkCellRendererToggle *UNUSED(toggle), const gchar *path, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
        GtkTreePath *tpath;
@@ -391,7 +391,7 @@ static void bar_pane_keywords_keyword_toggle(GtkCellRendererToggle *UNUSED(toggl
 
 void bar_pane_keywords_filter_modify(GtkTreeModel *model, GtkTreeIter *iter, GValue *value, gint column, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *keyword_tree = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(model));
        GtkTreeIter child_iter;
 
@@ -427,7 +427,7 @@ void bar_pane_keywords_filter_modify(GtkTreeModel *model, GtkTreeIter *iter, GVa
 
 gboolean bar_pane_keywords_filter_visible(GtkTreeModel *keyword_tree, GtkTreeIter *iter, gpointer data)
 {
-       GtkTreeModel *filter = (GtkTreeModel *)data;
+       GtkTreeModel *filter = static_cast<GtkTreeModel *>(data);
 
        return !keyword_is_hidden_in(keyword_tree, iter, filter);
 }
@@ -446,7 +446,7 @@ static void bar_pane_keywords_set_selection(PaneKeywordsData *pkd, gboolean appe
        work = list;
        while (work)
                {
-               FileData *fd = (FileData *)work->data;
+               FileData *fd = static_cast<FileData *>(work->data);
                work = work->next;
 
                if (append)
@@ -465,21 +465,21 @@ static void bar_pane_keywords_set_selection(PaneKeywordsData *pkd, gboolean appe
 
 static void bar_pane_keywords_sel_add_cb(GtkWidget *UNUSED(button), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        bar_pane_keywords_set_selection(pkd, TRUE);
 }
 
 static void bar_pane_keywords_sel_replace_cb(GtkWidget *UNUSED(button), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        bar_pane_keywords_set_selection(pkd, FALSE);
 }
 
 static void bar_pane_keywords_populate_popup_cb(GtkTextView *UNUSED(textview), GtkMenu *menu, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        menu_item_add_divider(GTK_WIDGET(menu));
        menu_item_add_stock(GTK_WIDGET(menu), _("Add selected keywords to selected files"), GTK_STOCK_ADD, G_CALLBACK(bar_pane_keywords_sel_add_cb), pkd);
@@ -489,7 +489,7 @@ static void bar_pane_keywords_populate_popup_cb(GtkTextView *UNUSED(textview), G
 
 static void bar_pane_keywords_notify_cb(FileData *fd, NotifyType type, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        if ((type & (NOTIFY_REREAD | NOTIFY_CHANGE | NOTIFY_METADATA)) && fd == pkd->fd)
                {
                DEBUG_1("Notify pane_keywords: %s %04x", fd->path, type);
@@ -499,17 +499,17 @@ static void bar_pane_keywords_notify_cb(FileData *fd, NotifyType type, gpointer
 
 static gboolean bar_pane_keywords_changed_idle_cb(gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        bar_pane_keywords_write(pkd);
        bar_keyword_tree_sync(pkd);
        pkd->idle_id = 0;
-       return FALSE;
+       return G_SOURCE_REMOVE;
 }
 
 static void bar_pane_keywords_changed(GtkTextBuffer *UNUSED(buffer), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        if (pkd->idle_id) return;
        /* higher prio than redraw */
@@ -525,15 +525,15 @@ static void bar_pane_keywords_changed(GtkTextBuffer *UNUSED(buffer), gpointer da
 
 
 static GtkTargetEntry bar_pane_keywords_drag_types[] = {
-       { TARGET_APP_KEYWORD_PATH_STRING, GTK_TARGET_SAME_WIDGET, TARGET_APP_KEYWORD_PATH },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>(TARGET_APP_KEYWORD_PATH_STRING), GTK_TARGET_SAME_WIDGET, TARGET_APP_KEYWORD_PATH },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_keywords_drag_types = 2;
 
 
 static GtkTargetEntry bar_pane_keywords_drop_types[] = {
-       { TARGET_APP_KEYWORD_PATH_STRING, GTK_TARGET_SAME_WIDGET, TARGET_APP_KEYWORD_PATH },
-       { "text/plain", 0, TARGET_TEXT_PLAIN }
+       { const_cast<gchar *>(TARGET_APP_KEYWORD_PATH_STRING), GTK_TARGET_SAME_WIDGET, TARGET_APP_KEYWORD_PATH },
+       { const_cast<gchar *>("text/plain"), 0, TARGET_TEXT_PLAIN }
 };
 static gint n_keywords_drop_types = 2;
 
@@ -560,7 +560,7 @@ static void bar_pane_keywords_dnd_get(GtkWidget *tree_view, GdkDragContext *UNUS
                        {
                        GList *path = keyword_tree_get_path(keyword_tree, &child_iter);
                        gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
-                                              8, (gpointer) &path, sizeof(path));
+                                              8, reinterpret_cast<const guchar *>(&path), sizeof(path));
                        break;
                        }
 
@@ -632,7 +632,7 @@ static gboolean bar_pane_keywords_dnd_skip_existing(GtkTreeModel *keyword_tree,
        GList *work = *keywords;
        while (work)
                {
-               gchar *keyword = work->data;
+               gchar *keyword = static_cast<gchar *>(work->data);
                if (keyword_exists(keyword_tree, NULL, dest_kw_iter, keyword, FALSE, NULL))
                        {
                        GList *next = work->next;
@@ -653,7 +653,7 @@ static void bar_pane_keywords_dnd_receive(GtkWidget *tree_view, GdkDragContext *
                                          GtkSelectionData *selection_data, guint info,
                                          guint UNUSED(time), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreePath *tpath = NULL;
         GtkTreeViewDropPosition pos;
        GtkTreeModel *model;
@@ -680,7 +680,7 @@ static void bar_pane_keywords_dnd_receive(GtkWidget *tree_view, GdkDragContext *
                {
                case TARGET_APP_KEYWORD_PATH:
                        {
-                       GList *path = *(gpointer *)gtk_selection_data_get_data(selection_data);
+                       GList *path = static_cast<GList *>(*(gpointer *)(gtk_selection_data_get_data(selection_data)));
                        src_valid = keyword_tree_get_iter(keyword_tree, &src_kw_iter, path);
                        string_list_free(path);
                        break;
@@ -766,7 +766,7 @@ static void bar_pane_keywords_dnd_receive(GtkWidget *tree_view, GdkDragContext *
        work = new_keywords;
        while (work)
                {
-               gchar *keyword = work->data;
+               gchar *keyword = static_cast<gchar *>(work->data);
                keyword_set(GTK_TREE_STORE(keyword_tree), &new_kw_iter, keyword, TRUE);
                work = work->next;
 
@@ -819,7 +819,7 @@ static gint bar_pane_keywords_dnd_motion(GtkWidget *tree_view, GdkDragContext *c
 
 static void bar_pane_keywords_edit_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
 {
-       ConfDialogData *cdd = (ConfDialogData *)data;
+       ConfDialogData *cdd = static_cast<ConfDialogData *>(data);
        gtk_tree_path_free(cdd->click_tpath);
        g_free(cdd);
 }
@@ -832,7 +832,7 @@ static void bar_pane_keywords_edit_cancel_cb(GenericDialog *UNUSED(gd), gpointer
 
 static void bar_pane_keywords_edit_ok_cb(GenericDialog *UNUSED(gd), gpointer data)
 {
-       ConfDialogData *cdd = (ConfDialogData *)data;
+       ConfDialogData *cdd = static_cast<ConfDialogData *>(data);
        PaneKeywordsData *pkd = cdd->pkd;
        GtkTreeModel *model;
 
@@ -863,9 +863,9 @@ static void bar_pane_keywords_edit_ok_cb(GenericDialog *UNUSED(gd), gpointer dat
        if (cdd->edit_existing)
                {
                if (keywords && keywords->data && /* there should be one keyword */
-                   !keyword_exists(keyword_tree, NULL, &kw_iter, keywords->data, TRUE, NULL))
+                   !keyword_exists(keyword_tree, NULL, &kw_iter, static_cast<const gchar *>(keywords->data), TRUE, NULL))
                        {
-                       keyword_set(GTK_TREE_STORE(keyword_tree), &kw_iter, keywords->data, cdd->is_keyword);
+                       keyword_set(GTK_TREE_STORE(keyword_tree), &kw_iter, static_cast<const gchar *>(keywords->data), cdd->is_keyword);
                        }
                }
        else
@@ -876,7 +876,7 @@ static void bar_pane_keywords_edit_ok_cb(GenericDialog *UNUSED(gd), gpointer dat
                while (work)
                        {
                        GtkTreeIter add;
-                       if (keyword_exists(keyword_tree, NULL, (have_dest || append_to) ? &kw_iter : NULL, work->data, FALSE, NULL))
+                       if (keyword_exists(keyword_tree, NULL, (have_dest || append_to) ? &kw_iter : NULL, static_cast<const gchar *>(work->data), FALSE, NULL))
                                {
                                work = work->next;
                                continue;
@@ -895,7 +895,7 @@ static void bar_pane_keywords_edit_ok_cb(GenericDialog *UNUSED(gd), gpointer dat
                                append_to = TRUE;
                                kw_iter = add;
                                }
-                       keyword_set(GTK_TREE_STORE(keyword_tree), &add, work->data, cdd->is_keyword);
+                       keyword_set(GTK_TREE_STORE(keyword_tree), &add, static_cast<const gchar *>(work->data), cdd->is_keyword);
                        work = work->next;
                        }
                }
@@ -904,13 +904,13 @@ static void bar_pane_keywords_edit_ok_cb(GenericDialog *UNUSED(gd), gpointer dat
 
 static void bar_pane_keywords_conf_set_helper(GtkWidget *UNUSED(widget), gpointer data)
 {
-       ConfDialogData *cdd = (ConfDialogData *)data;
+       ConfDialogData *cdd = static_cast<ConfDialogData *>(data);
        cdd->is_keyword = FALSE;
 }
 
 static void bar_pane_keywords_conf_set_kw(GtkWidget *UNUSED(widget), gpointer data)
 {
-       ConfDialogData *cdd = (ConfDialogData *)data;
+       ConfDialogData *cdd = static_cast<ConfDialogData *>(data);
        cdd->is_keyword = TRUE;
 }
 
@@ -1005,19 +1005,19 @@ static void bar_pane_keywords_edit_dialog(PaneKeywordsData *pkd, gboolean edit_e
 
 static void bar_pane_keywords_edit_dialog_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        bar_pane_keywords_edit_dialog(pkd, TRUE);
 }
 
 static void bar_pane_keywords_add_dialog_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        bar_pane_keywords_edit_dialog(pkd, FALSE);
 }
 
 static void bar_pane_keywords_connect_mark_cb(GtkWidget *menu_widget, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -1050,7 +1050,7 @@ static void dummy_cancel_cb(GenericDialog *UNUSED(gd), gpointer UNUSED(data))
 
 static void bar_pane_keywords_disconnect_marks_cb(GtkWidget *menu_widget, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        GenericDialog *gd;
        GString *message = g_string_new("");
@@ -1070,7 +1070,7 @@ static void bar_pane_keywords_disconnect_marks_cb(GtkWidget *menu_widget, gpoint
 
 static void bar_pane_keywords_delete_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
 
@@ -1090,7 +1090,7 @@ static void bar_pane_keywords_delete_cb(GtkWidget *UNUSED(menu_widget), gpointer
 
 static void bar_pane_keywords_hide_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
 
@@ -1110,7 +1110,7 @@ static void bar_pane_keywords_hide_cb(GtkWidget *UNUSED(menu_widget), gpointer d
 
 static void bar_pane_keywords_show_all_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        GtkTreeModel *keyword_tree;
@@ -1133,7 +1133,7 @@ static void bar_pane_keywords_show_all_cb(GtkWidget *UNUSED(menu_widget), gpoint
 
 static void bar_pane_keywords_revert_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GList *work;
        GtkTreePath *tree_path;
        gchar *path;
@@ -1143,7 +1143,7 @@ static void bar_pane_keywords_revert_cb(GtkWidget *UNUSED(menu_widget), gpointer
        work = pkd->expanded_rows;
        while (work)
                {
-               path = work->data;
+               path = static_cast<gchar *>(work->data);
                tree_path = gtk_tree_path_new_from_string(path);
                gtk_tree_view_expand_to_path(GTK_TREE_VIEW(pkd->keyword_treeview), tree_path);
                work = work->next;
@@ -1155,7 +1155,7 @@ static void bar_pane_keywords_revert_cb(GtkWidget *UNUSED(menu_widget), gpointer
 
 static void bar_pane_keywords_expand_checked_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(pkd->keyword_treeview));
@@ -1164,7 +1164,7 @@ static void bar_pane_keywords_expand_checked_cb(GtkWidget *UNUSED(menu_widget),
 
 static void bar_pane_keywords_collapse_all_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        string_list_free(pkd->expanded_rows);
        pkd->expanded_rows = NULL;
@@ -1178,7 +1178,7 @@ static void bar_pane_keywords_collapse_all_cb(GtkWidget *UNUSED(menu_widget), gp
 
 static void bar_pane_keywords_revert_hidden_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeModel *keyword_tree;
 
@@ -1192,7 +1192,7 @@ static void bar_pane_keywords_revert_hidden_cb(GtkWidget *UNUSED(menu_widget), g
 
 static void bar_pane_keywords_collapse_unchecked_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(pkd->keyword_treeview));
@@ -1201,7 +1201,7 @@ static void bar_pane_keywords_collapse_unchecked_cb(GtkWidget *UNUSED(menu_widge
 
 static void bar_pane_keywords_hide_unchecked_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        GtkTreeModel *keyword_tree;
@@ -1218,21 +1218,21 @@ static void bar_pane_keywords_hide_unchecked_cb(GtkWidget *UNUSED(menu_widget),
 
 static void bar_pane_keywords_expand_checked_toggle_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        pkd->expand_checked = !pkd->expand_checked;
        bar_keyword_tree_sync(pkd);
 }
 
 static void bar_pane_keywords_collapse_unchecked_toggle_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        pkd->collapse_unchecked = !pkd->collapse_unchecked;
        bar_keyword_tree_sync(pkd);
 }
 
 static void bar_pane_keywords_hide_unchecked_toggle_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        pkd->hide_unchecked = !pkd->hide_unchecked;
        bar_keyword_tree_sync(pkd);
 }
@@ -1242,7 +1242,7 @@ static void bar_pane_keywords_hide_unchecked_toggle_cb(GtkWidget *UNUSED(menu_wi
  */
 static void bar_pane_keywords_add_to_selected_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeIter iter; /* This is the iter which initial holds the current keyword */
        GtkTreeIter child_iter;
        GtkTreeModel *model;
@@ -1285,7 +1285,7 @@ static void bar_pane_keywords_add_to_selected_cb(GtkWidget *UNUSED(menu_widget),
        work = list;
        while (work)
                {
-               FileData *fd = (FileData *)work->data;
+               FileData *fd = static_cast<FileData *>(work->data);
                work = work->next;
                metadata_append_list(fd, KEYWORD_KEY, keywords);
                }
@@ -1410,7 +1410,7 @@ static void bar_pane_keywords_menu_popup(GtkWidget *UNUSED(widget), PaneKeywords
 
 static gboolean bar_pane_keywords_menu_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        if (bevent->button == MOUSE_BUTTON_RIGHT)
                {
                bar_pane_keywords_menu_popup(widget, pkd, bevent->x, bevent->y);
@@ -1438,7 +1438,7 @@ static gboolean bar_pane_keywords_menu_cb(GtkWidget *widget, GdkEventButton *bev
 
 static void bar_pane_keywords_destroy(GtkWidget *UNUSED(widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gchar *path;
 
        path = g_build_filename(get_rc_dir(), "keywords", NULL);
@@ -1600,9 +1600,9 @@ static GtkWidget *bar_pane_keywords_new(const gchar *id, const gchar *title, con
        gtk_tree_view_set_expander_column(GTK_TREE_VIEW(pkd->keyword_treeview), column);
 
        gtk_drag_source_set(pkd->keyword_treeview,
-                           GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
+                           static_cast<GdkModifierType>(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK),
                            bar_pane_keywords_drag_types, n_keywords_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(pkd->keyword_treeview), "drag_data_get",
                         G_CALLBACK(bar_pane_keywords_dnd_get), pkd);
@@ -1613,9 +1613,9 @@ static GtkWidget *bar_pane_keywords_new(const gchar *id, const gchar *title, con
                         G_CALLBACK(bar_pane_keywords_dnd_end), pkd);
 
        gtk_drag_dest_set(pkd->keyword_treeview,
-                         GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP,
+                         static_cast<GtkDestDefaults>(GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP),
                          bar_pane_keywords_drop_types, n_keywords_drop_types,
-                         GDK_ACTION_COPY | GDK_ACTION_MOVE);
+                         static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE));
 
        g_signal_connect(G_OBJECT(pkd->keyword_treeview), "drag_data_received",
                         G_CALLBACK(bar_pane_keywords_dnd_receive), pkd);
@@ -1674,7 +1674,7 @@ void bar_pane_keywords_update_from_config(GtkWidget *pane, const gchar **attribu
 {
        PaneKeywordsData *pkd;
 
-       pkd = g_object_get_data(G_OBJECT(pane), "pane_data");
+       pkd = static_cast<PaneKeywordsData *>(g_object_get_data(G_OBJECT(pane), "pane_data"));
        if (!pkd) return;
 
        gchar *title = NULL;
@@ -1711,7 +1711,7 @@ void bar_pane_keywords_entry_add_from_config(GtkWidget *pane, const gchar **attr
        gchar *path = NULL;
        GtkTreePath *tree_path;
 
-       pkd = g_object_get_data(G_OBJECT(pane), "pane_data");
+       pkd = static_cast<PaneKeywordsData *>(g_object_get_data(G_OBJECT(pane), "pane_data"));
        if (!pkd) return;
 
        while (*attribute_names)
@@ -1739,7 +1739,7 @@ void bar_pane_keywords_entry_add_from_config(GtkWidget *pane, const gchar **attr
 
 static gboolean autocomplete_activate_cb(GtkWidget *UNUSED(widget), gpointer data)
 {
-       PaneKeywordsData *pkd = (PaneKeywordsData *)data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gchar *entry_text;
        GtkTextBuffer *buffer;
        GtkTextIter iter;
@@ -1985,7 +1985,7 @@ gboolean bar_keywords_autocomplete_focus(LayoutWindow *lw)
                }
        else
                {
-               gtk_widget_grab_focus(children->data);
+               gtk_widget_grab_focus(GTK_WIDGET(children->data));
                ret = FALSE;
                }