Documentation: Use G_SOURCE_CONTINUE and G_SOURCE_REMOVE
[geeqie.git] / src / bar-keywords.cc
index dea2956..4076b8e 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <glib/gprintf.h>
-
 #include "main.h"
 #include "bar-keywords.h"
 
 #include "filedata.h"
-#include "history-list.h"
 #include "metadata.h"
-#include "misc.h"
 #include "ui-fileops.h"
 #include "ui-misc.h"
 #include "ui-utildlg.h"
-#include "utilops.h"
 #include "bar.h"
 #include "ui-menu.h"
 #include "rcfile.h"
@@ -93,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);
@@ -178,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gboolean set;
 
        gtk_tree_model_get(model, iter, FILTER_KEYWORD_COLUMN_TOGGLE, &set, -1);
@@ -192,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gboolean set;
 
        gtk_tree_model_get(model, iter, FILTER_KEYWORD_COLUMN_TOGGLE, &set, -1);
@@ -241,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;
                }
@@ -261,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);
@@ -272,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 = data;
+       GList **expanded = static_cast<GList **>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
        gchar *path_string;
@@ -305,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);
@@ -326,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;
                }
@@ -341,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);
@@ -355,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
        GtkTreePath *tpath;
@@ -396,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *keyword_tree = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(model));
        GtkTreeIter child_iter;
 
@@ -432,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 = data;
+       GtkTreeModel *filter = static_cast<GtkTreeModel *>(data);
 
        return !keyword_is_hidden_in(keyword_tree, iter, filter);
 }
@@ -451,7 +446,7 @@ static void bar_pane_keywords_set_selection(PaneKeywordsData *pkd, gboolean appe
        work = list;
        while (work)
                {
-               FileData *fd = work->data;
+               FileData *fd = static_cast<FileData *>(work->data);
                work = work->next;
 
                if (append)
@@ -470,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 = 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 = 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 = 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);
@@ -494,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 = 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);
@@ -504,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 = 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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        if (pkd->idle_id) return;
        /* higher prio than redraw */
@@ -530,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;
 
@@ -565,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;
                        }
 
@@ -637,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;
@@ -658,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreePath *tpath = NULL;
         GtkTreeViewDropPosition pos;
        GtkTreeModel *model;
@@ -685,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;
@@ -771,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;
 
@@ -824,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 = data;
+       ConfDialogData *cdd = static_cast<ConfDialogData *>(data);
        gtk_tree_path_free(cdd->click_tpath);
        g_free(cdd);
 }
@@ -837,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 = data;
+       ConfDialogData *cdd = static_cast<ConfDialogData *>(data);
        PaneKeywordsData *pkd = cdd->pkd;
        GtkTreeModel *model;
 
@@ -868,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
@@ -881,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;
@@ -900,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;
                        }
                }
@@ -909,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 = 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 = data;
+       ConfDialogData *cdd = static_cast<ConfDialogData *>(data);
        cdd->is_keyword = TRUE;
 }
 
@@ -1010,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 = 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 = 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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -1055,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        GenericDialog *gd;
        GString *message = g_string_new("");
@@ -1075,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
 
@@ -1095,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeIter iter;
 
@@ -1115,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        GtkTreeModel *keyword_tree;
@@ -1138,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GList *work;
        GtkTreePath *tree_path;
        gchar *path;
@@ -1148,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;
@@ -1160,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(pkd->keyword_treeview));
@@ -1169,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
 
        string_list_free(pkd->expanded_rows);
        pkd->expanded_rows = NULL;
@@ -1183,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
        GtkTreeModel *keyword_tree;
 
@@ -1197,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(pkd->keyword_treeview));
@@ -1206,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeModel *model;
 
        GtkTreeModel *keyword_tree;
@@ -1223,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 = 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 = 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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        pkd->hide_unchecked = !pkd->hide_unchecked;
        bar_keyword_tree_sync(pkd);
 }
@@ -1247,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        GtkTreeIter iter; /* This is the iter which initial holds the current keyword */
        GtkTreeIter child_iter;
        GtkTreeModel *model;
@@ -1290,7 +1285,7 @@ static void bar_pane_keywords_add_to_selected_cb(GtkWidget *UNUSED(menu_widget),
        work = list;
        while (work)
                {
-               FileData *fd = work->data;
+               FileData *fd = static_cast<FileData *>(work->data);
                work = work->next;
                metadata_append_list(fd, KEYWORD_KEY, keywords);
                }
@@ -1415,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        if (bevent->button == MOUSE_BUTTON_RIGHT)
                {
                bar_pane_keywords_menu_popup(widget, pkd, bevent->x, bevent->y);
@@ -1430,20 +1425,20 @@ static gboolean bar_pane_keywords_menu_cb(GtkWidget *widget, GdkEventButton *bev
  *-------------------------------------------------------------------
  */
 
-void bar_pane_keywords_close(GtkWidget *bar)
-{
-       PaneKeywordsData *pkd;
+//void bar_pane_keywords_close(GtkWidget *bar)
+//{
+       //PaneKeywordsData *pkd;
 
-       pkd = g_object_get_data(G_OBJECT(bar), "pane_data");
-       if (!pkd) return;
+       //pkd = g_object_get_data(G_OBJECT(bar), "pane_data");
+       //if (!pkd) return;
 
-       g_free(pkd->pane.id);
-       gtk_widget_destroy(pkd->widget);
-}
+       //g_free(pkd->pane.id);
+       //gtk_widget_destroy(pkd->widget);
+//}
 
 static void bar_pane_keywords_destroy(GtkWidget *UNUSED(widget), gpointer data)
 {
-       PaneKeywordsData *pkd = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gchar *path;
 
        path = g_build_filename(get_rc_dir(), "keywords", NULL);
@@ -1605,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);
@@ -1618,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);
@@ -1679,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;
@@ -1716,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)
@@ -1744,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 = data;
+       PaneKeywordsData *pkd = static_cast<PaneKeywordsData *>(data);
        gchar *entry_text;
        GtkTextBuffer *buffer;
        GtkTextIter iter;
@@ -1929,16 +1924,19 @@ GList *keyword_list_get()
        GtkTreeIter iter;
        gboolean valid;
 
-       valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(keyword_store), &iter);
-
-       while (valid)
+       if (keyword_store)
                {
-               gtk_tree_model_get (GTK_TREE_MODEL(keyword_store), &iter, 0, &string, -1);
-               string_nl = g_strconcat(string, "\n", NULL);
-               ret_list = g_list_append(ret_list, string);
-               valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(keyword_store), &iter);
+               valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(keyword_store), &iter);
 
-               g_free(string_nl);
+               while (valid)
+                       {
+                       gtk_tree_model_get (GTK_TREE_MODEL(keyword_store), &iter, 0, &string, -1);
+                       string_nl = g_strconcat(string, "\n", NULL);
+                       ret_list = g_list_append(ret_list, string);
+                       valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(keyword_store), &iter);
+
+                       g_free(string_nl);
+                       }
                }
 
        return ret_list;
@@ -1950,7 +1948,14 @@ void keyword_list_set(GList *keyword_list)
 
        if (!keyword_list) return;
 
-       gtk_list_store_clear(keyword_store);
+       if (keyword_store)
+               {
+               gtk_list_store_clear(keyword_store);
+               }
+       else
+               {
+               keyword_store = gtk_list_store_new(1, G_TYPE_STRING);
+               }
 
        while (keyword_list)
                {
@@ -1980,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;
                }