#include "main.h"
#include "bar-keywords.h"
+#include "bar.h"
+#include "dnd.h"
#include "filedata.h"
+#include "layout.h"
#include "metadata.h"
+#include "misc.h"
+#include "rcfile.h"
+#include "secure-save.h"
#include "ui-fileops.h"
+#include "ui-menu.h"
#include "ui-misc.h"
#include "ui-utildlg.h"
-#include "bar.h"
-#include "ui-menu.h"
-#include "rcfile.h"
-#include "layout.h"
-#include "dnd.h"
-#include "secure-save.h"
-
-//static void bar_pane_keywords_keyword_update_all(void);
static void bar_pane_keywords_changed(GtkTextBuffer *buffer, gpointer data);
static void autocomplete_keywords_list_load(const gchar *path);
static GType filter_keyword_column_types[] = {G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN};
-typedef struct _PaneKeywordsData PaneKeywordsData;
-struct _PaneKeywordsData
+struct PaneKeywordsData
{
PaneData pane;
GtkWidget *widget;
GtkWidget *autocomplete;
};
-typedef struct _ConfDialogData ConfDialogData;
-struct _ConfDialogData
+struct ConfDialogData
{
PaneKeywordsData *pkd;
GtkTreePath *click_tpath;
metadata_write_list(pkd->fd, KEYWORD_KEY, list);
- string_list_free(list);
+ g_list_free_full(list, g_free);
}
-gboolean bar_keyword_tree_expand_if_set_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
+static gboolean bar_keyword_tree_expand_if_set_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
gboolean set;
return FALSE;
}
-gboolean bar_keyword_tree_collapse_if_unset_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
+static gboolean bar_keyword_tree_collapse_if_unset_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
gboolean set;
keywords = keyword_list_pull(pkd->keyword_view);
keyword_show_set_in(GTK_TREE_STORE(keyword_tree), model, keywords);
if (pkd->hide_unchecked) keyword_hide_unset_in(GTK_TREE_STORE(keyword_tree), model, keywords);
- string_list_free(keywords);
+ g_list_free_full(keywords, g_free);
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(model));
bar_keyword_tree_sync(pkd);
g_signal_handlers_unblock_by_func(keyword_buffer, (gpointer)bar_pane_keywords_changed, pkd);
}
- string_list_free(keywords);
- string_list_free(orig_keywords);
+ g_list_free_full(keywords, g_free);
+ g_list_free_full(orig_keywords, g_free);
}
-void bar_pane_keywords_set_fd(GtkWidget *pane, FileData *fd)
+static void bar_pane_keywords_set_fd(GtkWidget *pane, FileData *fd)
{
PaneKeywordsData *pkd;
bar_pane_keywords_update(pkd);
}
-void bar_keyword_tree_get_expanded_cb(GtkTreeView *keyword_treeview, GtkTreePath *path, gpointer data)
+static void bar_keyword_tree_get_expanded_cb(GtkTreeView *keyword_treeview, GtkTreePath *path, gpointer data)
{
auto expanded = static_cast<GList **>(data);
GtkTreeModel *model;
gtk_tree_view_map_expanded_rows(GTK_TREE_VIEW(pkd->keyword_treeview),
(bar_keyword_tree_get_expanded_cb), &path_expanded);
- g_list_first(path_expanded);
- while (path_expanded)
+ GList *work = g_list_first(path_expanded);
+ while (work)
{
- bar_pane_keywords_entry_write_config(static_cast<gchar *>(path_expanded->data), outstr, indent);
- g_free(path_expanded->data);
- path_expanded = path_expanded->next;
+ bar_pane_keywords_entry_write_config(static_cast<gchar *>(work->data), outstr, indent);
+ work = work->next;
}
- g_list_free(path_expanded);
+ g_list_free_full(path_expanded, g_free);
indent--;
WRITE_NL();
WRITE_STRING("</pane_keywords>");
}
-gint bar_pane_keywords_event(GtkWidget *bar, GdkEvent *event)
+static gint bar_pane_keywords_event(GtkWidget *bar, GdkEvent *event)
{
PaneKeywordsData *pkd;
return FALSE;
}
-static void bar_pane_keywords_keyword_toggle(GtkCellRendererToggle *UNUSED(toggle), const gchar *path, gpointer data)
+static void bar_pane_keywords_keyword_toggle(GtkCellRendererToggle *, const gchar *path, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
g_signal_handlers_block_by_func(keyword_buffer, (gpointer)bar_pane_keywords_changed, pkd);
keyword_list_push(pkd->keyword_view, list);
- string_list_free(list);
+ g_list_free_full(list, g_free);
g_signal_handlers_unblock_by_func(keyword_buffer, (gpointer)bar_pane_keywords_changed, pkd);
/* call this just once in the end */
bar_pane_keywords_changed(keyword_buffer, pkd);
}
-void bar_pane_keywords_filter_modify(GtkTreeModel *model, GtkTreeIter *iter, GValue *value, gint column, gpointer data)
+static void bar_pane_keywords_filter_modify(GtkTreeModel *model, GtkTreeIter *iter, GValue *value, gint column, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *keyword_tree = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(model));
{
GList *keywords = keyword_list_pull(pkd->keyword_view);
gboolean set = keyword_tree_is_set(keyword_tree, &child_iter, keywords);
- string_list_free(keywords);
+ g_list_free_full(keywords, g_free);
g_value_init(value, G_TYPE_BOOLEAN);
g_value_set_boolean(value, set);
gtk_tree_model_get_value(keyword_tree, &child_iter, KEYWORD_COLUMN_IS_KEYWORD, value);
break;
}
- return;
-
}
-gboolean bar_pane_keywords_filter_visible(GtkTreeModel *keyword_tree, GtkTreeIter *iter, gpointer data)
+static gboolean bar_pane_keywords_filter_visible(GtkTreeModel *keyword_tree, GtkTreeIter *iter, gpointer data)
{
auto filter = static_cast<GtkTreeModel *>(data);
}
filelist_free(list);
- string_list_free(keywords);
+ g_list_free_full(keywords, g_free);
}
-static void bar_pane_keywords_sel_add_cb(GtkWidget *UNUSED(button), gpointer data)
+static void bar_pane_keywords_sel_add_cb(GtkWidget *, gpointer data)
{
auto 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)
+static void bar_pane_keywords_sel_replace_cb(GtkWidget *, gpointer data)
{
auto 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)
+static void bar_pane_keywords_populate_popup_cb(GtkTextView *, GtkMenu *menu, gpointer data)
{
auto 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);
- menu_item_add_stock(GTK_WIDGET(menu), _("Replace existing keywords in selected files with selected keywords"), GTK_STOCK_CONVERT, G_CALLBACK(bar_pane_keywords_sel_replace_cb), pkd);
+ menu_item_add_icon(GTK_WIDGET(menu), _("Add selected keywords to selected files"), GQ_ICON_ADD, G_CALLBACK(bar_pane_keywords_sel_add_cb), pkd);
+ menu_item_add_icon(GTK_WIDGET(menu), _("Replace existing keywords in selected files with selected keywords"), GQ_ICON_REPLACE, G_CALLBACK(bar_pane_keywords_sel_replace_cb), pkd);
}
return G_SOURCE_REMOVE;
}
-static void bar_pane_keywords_changed(GtkTextBuffer *UNUSED(buffer), gpointer data)
+static void bar_pane_keywords_changed(GtkTextBuffer *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
static gint n_keywords_drop_types = 2;
-static void bar_pane_keywords_dnd_get(GtkWidget *tree_view, GdkDragContext *UNUSED(context),
+static void bar_pane_keywords_dnd_get(GtkWidget *tree_view, GdkDragContext *,
GtkSelectionData *selection_data, guint info,
- guint UNUSED(time), gpointer UNUSED(data))
+ guint, gpointer)
{
GtkTreeIter iter;
GtkTreeModel *model;
}
}
-static void bar_pane_keywords_dnd_begin(GtkWidget *tree_view, GdkDragContext *context, gpointer UNUSED(data))
+static void bar_pane_keywords_dnd_begin(GtkWidget *tree_view, GdkDragContext *context, gpointer)
{
GtkTreeIter iter;
GtkTreeModel *model;
}
-static void bar_pane_keywords_dnd_end(GtkWidget *UNUSED(widget), GdkDragContext *UNUSED(context), gpointer UNUSED(data))
+static void bar_pane_keywords_dnd_end(GtkWidget *, GdkDragContext *, gpointer)
{
}
return !!*keywords;
}
-static void bar_pane_keywords_dnd_receive(GtkWidget *tree_view, GdkDragContext *UNUSED(context),
+static void bar_pane_keywords_dnd_receive(GtkWidget *tree_view, GdkDragContext *,
gint x, gint y,
GtkSelectionData *selection_data, guint info,
- guint UNUSED(time), gpointer data)
+ guint, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreePath *tpath = nullptr;
{
case TARGET_APP_KEYWORD_PATH:
{
- auto path = (GList *)(gtk_selection_data_get_data(selection_data));
+ auto path = static_cast<GList *>(*reinterpret_cast<const gpointer *>(gtk_selection_data_get_data(selection_data)));
src_valid = keyword_tree_get_iter(keyword_tree, &src_kw_iter, path);
- string_list_free(path);
+ g_list_free_full(path, g_free);
break;
}
default:
new_kw_iter = add;
}
}
- string_list_free(new_keywords);
+ g_list_free_full(new_keywords, g_free);
bar_keyword_tree_sync(pkd);
}
static gint bar_pane_keywords_dnd_motion(GtkWidget *tree_view, GdkDragContext *context,
- gint x, gint y, guint time, gpointer UNUSED(data))
+ gint x, gint y, guint time, gpointer)
{
GtkTreePath *tpath = nullptr;
GtkTreeViewDropPosition pos;
*-------------------------------------------------------------------
*/
-static void bar_pane_keywords_edit_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void bar_pane_keywords_edit_destroy_cb(GtkWidget *, gpointer data)
{
auto cdd = static_cast<ConfDialogData *>(data);
gtk_tree_path_free(cdd->click_tpath);
}
-static void bar_pane_keywords_edit_cancel_cb(GenericDialog *UNUSED(gd), gpointer UNUSED(data))
+static void bar_pane_keywords_edit_cancel_cb(GenericDialog *, gpointer)
{
}
-static void bar_pane_keywords_edit_ok_cb(GenericDialog *UNUSED(gd), gpointer data)
+static void bar_pane_keywords_edit_ok_cb(GenericDialog *, gpointer data)
{
auto cdd = static_cast<ConfDialogData *>(data);
PaneKeywordsData *pkd = cdd->pkd;
work = work->next;
}
}
- string_list_free(keywords);
+ g_list_free_full(keywords, g_free);
}
-static void bar_pane_keywords_conf_set_helper(GtkWidget *UNUSED(widget), gpointer data)
+static void bar_pane_keywords_conf_set_helper(GtkWidget *, gpointer data)
{
auto cdd = static_cast<ConfDialogData *>(data);
cdd->is_keyword = FALSE;
}
-static void bar_pane_keywords_conf_set_kw(GtkWidget *UNUSED(widget), gpointer data)
+static void bar_pane_keywords_conf_set_kw(GtkWidget *, gpointer data)
{
auto cdd = static_cast<ConfDialogData *>(data);
cdd->is_keyword = TRUE;
generic_dialog_add_message(gd, nullptr, name ? _("Configure keyword") : _("New keyword"), nullptr, FALSE);
- generic_dialog_add_button(gd, GTK_STOCK_OK, nullptr,
+ generic_dialog_add_button(gd, GQ_ICON_OK, "OK",
bar_pane_keywords_edit_ok_cb, TRUE);
table = pref_table_new(gd->vbox, 3, 1, FALSE, TRUE);
- pref_table_label(table, 0, 0, _("Keyword:"), 1.0);
+ pref_table_label(table, 0, 0, _("Keyword:"), GTK_ALIGN_END);
cdd->edit_widget = gtk_entry_new();
gtk_widget_set_size_request(cdd->edit_widget, 300, -1);
- if (name) gtk_entry_set_text(GTK_ENTRY(cdd->edit_widget), name);
- gtk_table_attach_defaults(GTK_TABLE(table), cdd->edit_widget, 1, 2, 0, 1);
+ if (name) gq_gtk_entry_set_text(GTK_ENTRY(cdd->edit_widget), name);
+ gq_gtk_grid_attach_default(GTK_GRID(table), cdd->edit_widget, 1, 2, 0, 1);
/* here could eventually be a text view instead of entry */
generic_dialog_attach_default(gd, cdd->edit_widget);
gtk_widget_show(cdd->edit_widget);
*-------------------------------------------------------------------
*/
-static void bar_pane_keywords_edit_dialog_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_edit_dialog_cb(GtkWidget *, gpointer data)
{
auto 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)
+static void bar_pane_keywords_add_dialog_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
bar_pane_keywords_edit_dialog(pkd, FALSE);
meta_data_connect_mark_with_keyword(keyword_tree, &kw_iter, mark);
}
-static void bar_pane_keywords_disconnect_marks_ok_cb(GenericDialog *UNUSED(gd), gpointer UNUSED(data))
+static void bar_pane_keywords_disconnect_marks_ok_cb(GenericDialog *, gpointer)
{
keyword_tree_disconnect_marks();
}
-static void dummy_cancel_cb(GenericDialog *UNUSED(gd), gpointer UNUSED(data))
+static void dummy_cancel_cb(GenericDialog *, gpointer)
{
/* no op, only so cancel button appears */
}
auto pkd = static_cast<PaneKeywordsData *>(data);
GenericDialog *gd;
- GString *message = g_string_new("");
-
- message = g_string_append(message, _("This will disconnect all Marks Keywords connections"));
gd = generic_dialog_new(_("Marks Keywords"),
"marks_keywords", menu_widget, TRUE, dummy_cancel_cb, pkd);
- generic_dialog_add_message(gd, GTK_STOCK_DIALOG_WARNING,
- "Disconnect all Marks Keywords connections?", message->str, TRUE);
- generic_dialog_add_button(gd, GTK_STOCK_OK, nullptr, bar_pane_keywords_disconnect_marks_ok_cb, TRUE);
+ generic_dialog_add_message(gd, GQ_ICON_DIALOG_WARNING,
+ "Disconnect all Marks Keywords connections?", _("This will disconnect all Marks Keywords connections"), TRUE);
+ generic_dialog_add_button(gd, GQ_ICON_OK, "OK", bar_pane_keywords_disconnect_marks_ok_cb, TRUE);
gtk_widget_show(gd->dialog);
-
- g_string_free(message, TRUE);
}
-static void bar_pane_keywords_delete_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_delete_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
keyword_delete(GTK_TREE_STORE(keyword_tree), &kw_iter);
}
-static void bar_pane_keywords_hide_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_hide_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
keyword_hide_in(GTK_TREE_STORE(keyword_tree), &kw_iter, model);
}
-static void bar_pane_keywords_show_all_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_show_all_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
GtkTreeModel *keyword_tree;
- string_list_free(pkd->expanded_rows);
+ g_list_free_full(pkd->expanded_rows, g_free);
pkd->expanded_rows = nullptr;
gtk_tree_view_map_expanded_rows(GTK_TREE_VIEW(pkd->keyword_treeview),
(bar_keyword_tree_get_expanded_cb), &pkd->expanded_rows);
bar_keyword_tree_sync(pkd);
}
-static void bar_pane_keywords_revert_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_revert_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GList *work;
bar_keyword_tree_sync(pkd);
}
-static void bar_pane_keywords_expand_checked_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_expand_checked_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
gtk_tree_model_foreach(model, bar_keyword_tree_expand_if_set_cb, pkd);
}
-static void bar_pane_keywords_collapse_all_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_collapse_all_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
- string_list_free(pkd->expanded_rows);
+ g_list_free_full(pkd->expanded_rows, g_free);
pkd->expanded_rows = nullptr;
gtk_tree_view_map_expanded_rows(GTK_TREE_VIEW(pkd->keyword_treeview),
(bar_keyword_tree_get_expanded_cb), &pkd->expanded_rows);
bar_keyword_tree_sync(pkd);
}
-static void bar_pane_keywords_revert_hidden_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_revert_hidden_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
bar_keyword_tree_sync(pkd);
}
-static void bar_pane_keywords_collapse_unchecked_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_collapse_unchecked_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
gtk_tree_model_foreach(model, bar_keyword_tree_collapse_if_unset_cb, pkd);
}
-static void bar_pane_keywords_hide_unchecked_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_hide_unchecked_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeModel *model;
keywords = keyword_list_pull(pkd->keyword_view);
keyword_hide_unset_in(GTK_TREE_STORE(keyword_tree), model, keywords);
- string_list_free(keywords);
+ g_list_free_full(keywords, g_free);
bar_keyword_tree_sync(pkd);
}
-static void bar_pane_keywords_expand_checked_toggle_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_expand_checked_toggle_cb(GtkWidget *, gpointer data)
{
auto 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)
+static void bar_pane_keywords_collapse_unchecked_toggle_cb(GtkWidget *, gpointer data)
{
auto 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)
+static void bar_pane_keywords_hide_unchecked_toggle_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
pkd->hide_unchecked = !pkd->hide_unchecked;
/**
* @brief Callback for adding selected keyword to all selected images.
*/
-static void bar_pane_keywords_add_to_selected_cb(GtkWidget *UNUSED(menu_widget), gpointer data)
+static void bar_pane_keywords_add_to_selected_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
GtkTreeIter iter; /* This is the iter which initial holds the current keyword */
keyword_tree_set(keyword_tree, &child_iter, &list);
keyword_list_push(pkd->keyword_view, list); /* Set the left keyword view */
- string_list_free(list);
+ g_list_free_full(list, g_free);
bar_pane_keywords_changed(keyword_buffer, pkd); /* Get list of all keywords in the hierarchy */
metadata_append_list(fd, KEYWORD_KEY, keywords);
}
filelist_free(list);
- string_list_free(keywords);
+ g_list_free_full(keywords, g_free);
}
-static void bar_pane_keywords_menu_popup(GtkWidget *UNUSED(widget), PaneKeywordsData *pkd, gint x, gint y)
+static void bar_pane_keywords_menu_popup(GtkWidget *, PaneKeywordsData *pkd, gint x, gint y)
{
GtkWidget *menu;
GtkWidget *item;
menu = popup_menu_short_lived();
- menu_item_add_stock(menu, _("New keyword"), GTK_STOCK_NEW, G_CALLBACK(bar_pane_keywords_add_dialog_cb), pkd);
+ menu_item_add_icon(menu, _("New keyword"), GQ_ICON_NEW, G_CALLBACK(bar_pane_keywords_add_dialog_cb), pkd);
menu_item_add_divider(menu);
if (keyword)
{
text = g_strdup_printf(_("Add \"%s\" to all selected images"), name);
- menu_item_add_stock(menu, text, GTK_STOCK_ADD, G_CALLBACK(bar_pane_keywords_add_to_selected_cb), pkd);
+ menu_item_add_icon(menu, text, GQ_ICON_ADD, G_CALLBACK(bar_pane_keywords_add_to_selected_cb), pkd);
g_free(text);
}
menu_item_add_divider(menu);
menu_item_add_divider(menu);
text = g_strdup_printf(_("Edit \"%s\""), name);
- menu_item_add_stock(menu, text, GTK_STOCK_EDIT, G_CALLBACK(bar_pane_keywords_edit_dialog_cb), pkd);
+ menu_item_add_icon(menu, text, GQ_ICON_EDIT, G_CALLBACK(bar_pane_keywords_edit_dialog_cb), pkd);
g_free(text);
text = g_strdup_printf(_("Remove \"%s\""), name);
- menu_item_add_stock(menu, text, GTK_STOCK_DELETE, G_CALLBACK(bar_pane_keywords_delete_cb), pkd);
+ menu_item_add_icon(menu, text, GQ_ICON_DELETE, G_CALLBACK(bar_pane_keywords_delete_cb), pkd);
g_free(text);
if (mark && mark[0])
{
text = g_strdup_printf(_("Disconnect \"%s\" from mark %s"), name, mark);
- menu_item_add_stock(menu, text, GTK_STOCK_DELETE, G_CALLBACK(bar_pane_keywords_connect_mark_cb), pkd);
+ menu_item_add_icon(menu, text, GQ_ICON_DELETE, G_CALLBACK(bar_pane_keywords_connect_mark_cb), pkd);
g_free(text);
}
if (keyword)
{
text = g_strdup_printf(_("Disconnect all Mark Keyword connections"));
- menu_item_add_stock(menu, text, GTK_STOCK_DELETE, G_CALLBACK(bar_pane_keywords_disconnect_marks_cb), pkd);
+ menu_item_add_icon(menu, text, GQ_ICON_DELETE, G_CALLBACK(bar_pane_keywords_disconnect_marks_cb), pkd);
g_free(text);
}
menu_item_add_divider(menu);
*-------------------------------------------------------------------
*/
-//void bar_pane_keywords_close(GtkWidget *bar)
-//{
- //PaneKeywordsData *pkd;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+void bar_pane_keywords_close_unused(GtkWidget *bar)
+{
+ PaneKeywordsData *pkd;
- //pkd = g_object_get_data(G_OBJECT(bar), "pane_data");
- //if (!pkd) return;
+ pkd = static_cast<PaneKeywordsData *>(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);
+ g_object_unref(pkd->widget);
+}
+#pragma GCC diagnostic pop
-static void bar_pane_keywords_destroy(GtkWidget *UNUSED(widget), gpointer data)
+static void bar_pane_keywords_destroy(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
gchar *path;
path = g_build_filename(get_rc_dir(), "keywords", NULL);
autocomplete_keywords_list_save(path);
- string_list_free(pkd->expanded_rows);
+ g_list_free_full(pkd->expanded_rows, g_free);
if (pkd->click_tpath) gtk_tree_path_free(pkd->click_tpath);
if (pkd->idle_id) g_source_remove(pkd->idle_id);
file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
+ gq_gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
pkd->widget = vbox;
g_object_set_data(G_OBJECT(pkd->widget), "pane_data", pkd);
gtk_widget_set_size_request(pkd->widget, -1, height);
gtk_widget_show(hbox);
- scrolled = gtk_scrolled_window_new(nullptr, nullptr);
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
+ scrolled = gq_gtk_scrolled_window_new(nullptr, nullptr);
+ gq_gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0);
+ gq_gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0);
gtk_widget_show(scrolled);
pkd->keyword_view = gtk_text_view_new();
- gtk_container_add(GTK_CONTAINER(scrolled), pkd->keyword_view);
+ gq_gtk_container_add(GTK_WIDGET(scrolled), pkd->keyword_view);
g_signal_connect(G_OBJECT(pkd->keyword_view), "populate-popup",
G_CALLBACK(bar_pane_keywords_populate_popup_cb), pkd);
gtk_widget_show(pkd->keyword_view);
if (options->show_predefined_keyword_tree)
{
- scrolled = gtk_scrolled_window_new(nullptr, nullptr);
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
+ scrolled = gq_gtk_scrolled_window_new(nullptr, nullptr);
+ gq_gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0);
+ gq_gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0);
gtk_widget_show(scrolled);
}
pkd->autocomplete = gtk_entry_new();
- gtk_box_pack_end(GTK_BOX(vbox), pkd->autocomplete, FALSE, FALSE, 0);
+ gq_gtk_box_pack_end(GTK_BOX(vbox), pkd->autocomplete, FALSE, FALSE, 0);
gtk_widget_show(pkd->autocomplete);
gtk_widget_show(vbox);
gtk_widget_set_tooltip_text(pkd->autocomplete, "Keyword autocomplete");
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(pkd->keyword_treeview), FALSE);
-// gtk_tree_view_set_search_column(GTK_TREE_VIEW(pkd->keyword_treeview), FILTER_KEYWORD_COLUMN_);
-
column = gtk_tree_view_column_new();
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
if (options->show_predefined_keyword_tree)
{
- gtk_container_add(GTK_CONTAINER(scrolled), pkd->keyword_treeview);
+ gq_gtk_container_add(GTK_WIDGET(scrolled), pkd->keyword_treeview);
gtk_widget_show(pkd->keyword_treeview);
}
*-----------------------------------------------------------------------------
*/
-static gboolean autocomplete_activate_cb(GtkWidget *UNUSED(widget), gpointer data)
+static gboolean autocomplete_activate_cb(GtkWidget *, gpointer data)
{
auto pkd = static_cast<PaneKeywordsData *>(data);
gchar *entry_text;
gboolean found = FALSE;
gchar *string;
- entry_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(pkd->autocomplete)));
+ entry_text = g_strdup(gq_gtk_entry_get_text(GTK_ENTRY(pkd->autocomplete)));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(pkd->keyword_view));
kw_split = strtok(entry_text, ",");
}
g_free(entry_text);
- entry_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(pkd->autocomplete)));
+ entry_text = g_strdup(gq_gtk_entry_get_text(GTK_ENTRY(pkd->autocomplete)));
- gtk_entry_set_text(GTK_ENTRY(pkd->autocomplete), "");
+ gq_gtk_entry_set_text(GTK_ENTRY(pkd->autocomplete), "");
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(keyword_store), &iter_t);
while (valid)
return FALSE;
}
-gint autocomplete_sort_iter_compare_func (GtkTreeModel *model,
+static gint autocomplete_sort_iter_compare_func (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
- gpointer UNUSED(userdata))
+ gpointer)
{
gint ret = 0;
gchar *name1, *name2;
pathl = path_from_utf8(path);
f = fopen(pathl, "r");
- g_free(pathl);
if (!f)
{
log_printf("Warning: keywords file %s not loaded", pathl);
+ g_free(pathl);
return;
}
{
fclose(f);
log_printf("Warning: keywords file %s not loaded", pathl);
+ g_free(pathl);
return;
}
+ g_free(pathl);
+
while (fgets(s_buf, sizeof(s_buf), f))
{
if (s_buf[0]=='#') continue;