*/
#include <cstring>
+#include <memory>
#include "main.h"
#include "ui-bookmark.h"
#include "history-list.h"
+#include "misc.h"
+#include "pixbuf-util.h"
#include "ui-fileops.h"
#include "ui-menu.h"
#include "ui-misc.h"
-#include "ui-utildlg.h"
#include "ui-tabcomp.h"
+#include "ui-utildlg.h"
#include "uri-utils.h"
-
-
/*
*-----------------------------------------------------------------------------
* bookmarks
if (bm->select_func) bm->select_func(b->path, bm->select_data);
}
-static void bookmark_edit_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void bookmark_edit_destroy_cb(GtkWidget *, gpointer data)
{
auto p = static_cast<BookPropData *>(data);
g_free(p);
}
-static void bookmark_edit_cancel_cb(GenericDialog *UNUSED(gd), gpointer UNUSED(data))
+static void bookmark_edit_cancel_cb(GenericDialog *, gpointer)
{
}
-static void bookmark_edit_ok_cb(GenericDialog *UNUSED(gd), gpointer data)
+static void bookmark_edit_ok_cb(GenericDialog *, gpointer data)
{
auto p = static_cast<BookPropData *>(data);
const gchar *name;
const gchar *icon;
gchar *new_string;
- name = gtk_entry_get_text(GTK_ENTRY(p->name_entry));
- path = remove_trailing_slash(gtk_entry_get_text(GTK_ENTRY(p->path_entry)));
- icon = gtk_entry_get_text(GTK_ENTRY(p->icon_entry));
+ name = gq_gtk_entry_get_text(GTK_ENTRY(p->name_entry));
+ path = remove_trailing_slash(gq_gtk_entry_get_text(GTK_ENTRY(p->path_entry)));
+ icon = gq_gtk_entry_get_text(GTK_ENTRY(p->icon_entry));
new_string = bookmark_string(name, path, icon);
generic_dialog_add_message(gd, nullptr, _("Edit Bookmark"), nullptr, FALSE);
- generic_dialog_add_button(gd, GTK_STOCK_OK, nullptr,
+ generic_dialog_add_button(gd, GQ_ICON_OK, "OK",
bookmark_edit_ok_cb, TRUE);
table = pref_table_new(gd->vbox, 3, 2, FALSE, TRUE);
- pref_table_label(table, 0, 0, _("Name:"), 1.0);
+ pref_table_label(table, 0, 0, _("Name:"), GTK_ALIGN_END);
p->name_entry = gtk_entry_new();
gtk_widget_set_size_request(p->name_entry, 300, -1);
- if (p->bb->name) gtk_entry_set_text(GTK_ENTRY(p->name_entry), p->bb->name);
- gtk_table_attach_defaults(GTK_TABLE(table), p->name_entry, 1, 2, 0, 1);
+ if (p->bb->name) gq_gtk_entry_set_text(GTK_ENTRY(p->name_entry), p->bb->name);
+ gq_gtk_grid_attach_default(GTK_GRID(table), p->name_entry, 1, 2, 0, 1);
generic_dialog_attach_default(gd, p->name_entry);
gtk_widget_show(p->name_entry);
- pref_table_label(table, 0, 1, _("Path:"), 1.0);
+ pref_table_label(table, 0, 1, _("Path:"), GTK_ALIGN_END);
label = tab_completion_new_with_history(&p->path_entry, p->bb->path,
"bookmark_path", -1, nullptr, nullptr);
tab_completion_add_select_button(p->path_entry, nullptr, TRUE);
- gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 1, 2);
+ gq_gtk_grid_attach_default(GTK_GRID(table), label, 1, 2, 1, 2);
generic_dialog_attach_default(gd, p->path_entry);
gtk_widget_show(label);
- pref_table_label(table, 0, 2, _("Icon:"), 1.0);
+ pref_table_label(table, 0, 2, _("Icon:"), GTK_ALIGN_END);
icon = p->bb->icon;
if (!icon) icon = "";
label = tab_completion_new_with_history(&p->icon_entry, icon,
"bookmark_icons", -1, nullptr, nullptr);
tab_completion_add_select_button(p->icon_entry, _("Select icon"), FALSE);
- gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 2, 3);
+ gq_gtk_grid_attach_default(GTK_GRID(table), label, 1, 2, 2, 3);
generic_dialog_attach_default(gd, p->icon_entry);
gtk_widget_show(label);
bookmark_move(bm, bm->active_button->button, direction);
}
-static void bookmark_menu_up_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void bookmark_menu_up_cb(GtkWidget *, gpointer data)
{
bookmark_menu_move(static_cast<BookMarkData *>(data), -1);
}
-static void bookmark_menu_down_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void bookmark_menu_down_cb(GtkWidget *, gpointer data)
{
bookmark_menu_move(static_cast<BookMarkData *>(data), 1);
}
-static void bookmark_menu_remove_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void bookmark_menu_remove_cb(GtkWidget *, gpointer data)
{
auto bm = static_cast<BookMarkData *>(data);
bookmark_populate_all(bm->key);
}
-static void bookmark_menu_popup(BookMarkData *bm, GtkWidget *button,
- gint UNUSED(button_n), guint32 UNUSED(time), gboolean local)
+static void bookmark_menu_popup(BookMarkData *bm, GtkWidget *button, gint, guint32, gboolean local)
{
GtkWidget *menu;
BookButtonData *b;
bm->active_button = b;
menu = popup_menu_short_lived();
- menu_item_add_stock_sensitive(menu, _("_Properties..."), GTK_STOCK_PROPERTIES, bm->editable,
+ menu_item_add_icon_sensitive(menu, _("_Properties..."), PIXBUF_INLINE_ICON_PROPERTIES, bm->editable,
G_CALLBACK(bookmark_menu_prop_cb), bm);
- menu_item_add_stock_sensitive(menu, _("Move _up"), GTK_STOCK_GO_UP, bm->editable,
+ menu_item_add_icon_sensitive(menu, _("Move _up"), GQ_ICON_GO_UP, bm->editable,
G_CALLBACK(bookmark_menu_up_cb), bm);
- menu_item_add_stock_sensitive(menu, _("Move _down"), GTK_STOCK_GO_DOWN, bm->editable,
+ menu_item_add_icon_sensitive(menu, _("Move _down"), GQ_ICON_GO_DOWN, bm->editable,
G_CALLBACK(bookmark_menu_down_cb), bm);
- menu_item_add_stock_sensitive(menu, _("_Remove"), GTK_STOCK_REMOVE, bm->editable,
+ menu_item_add_icon_sensitive(menu, _("_Remove"), GQ_ICON_REMOVE, bm->editable,
G_CALLBACK(bookmark_menu_remove_cb), bm);
if (local)
static void bookmark_drag_set_data(GtkWidget *button,
GdkDragContext *context, GtkSelectionData *selection_data,
- guint UNUSED(info), guint UNUSED(time), gpointer data)
+ guint, guint, gpointer data)
{
auto bm = static_cast<BookMarkData *>(data);
BookButtonData *b;
g_list_free(list);
}
-static void bookmark_drag_begin(GtkWidget *button, GdkDragContext *context, gpointer UNUSED(data))
+static void bookmark_drag_begin(GtkWidget *button, GdkDragContext *context, gpointer)
{
GdkPixbuf *pixbuf;
GdkModifierType mask;
g_object_unref(pixbuf);
}
-static gboolean bookmark_path_tooltip_cb(GtkWidget *button, gpointer UNUSED(data))
+static gboolean bookmark_path_tooltip_cb(GtkWidget *button, gpointer)
{
BookButtonData *b;
{
GtkWidget *widget = GTK_WIDGET(work->data);
work = work->next;
- gtk_widget_destroy(widget);
+ gq_gtk_widget_destroy(widget);
}
if (!bm->no_defaults && !history_list_get_by_key(bm->key))
b->button = gtk_button_new();
gtk_button_set_relief(GTK_BUTTON(b->button), GTK_RELIEF_NONE);
- gtk_box_pack_start(GTK_BOX(bm->box), b->button, FALSE, FALSE, 0);
+ gq_gtk_box_pack_start(GTK_BOX(bm->box), b->button, FALSE, FALSE, 0);
gtk_widget_show(b->button);
g_object_set_data_full(G_OBJECT(b->button), "bookbuttondata",
b, reinterpret_cast<GDestroyNotify>(bookmark_free));
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP);
- gtk_container_add(GTK_CONTAINER(b->button), box);
+ gq_gtk_container_add(GTK_WIDGET(b->button), box);
gtk_widget_show(box);
if (b->icon)
}
else
{
- b->image = gtk_image_new_from_icon_name("folder",
- GTK_ICON_SIZE_BUTTON);
+ b->image = gtk_image_new_from_icon_name(GQ_ICON_DIRECTORY, GTK_ICON_SIZE_BUTTON);
}
}
else
{
- b->image = gtk_image_new_from_icon_name("folder", GTK_ICON_SIZE_BUTTON);
+ b->image = gtk_image_new_from_icon_name(GQ_ICON_DIRECTORY, GTK_ICON_SIZE_BUTTON);
}
- gtk_box_pack_start(GTK_BOX(box), b->image, FALSE, FALSE, 0);
+ gq_gtk_box_pack_start(GTK_BOX(box), b->image, FALSE, FALSE, 0);
gtk_widget_show(b->image);
b->label = gtk_label_new(b->name);
- gtk_box_pack_start(GTK_BOX(box), b->label, FALSE, FALSE, 0);
+ gq_gtk_box_pack_start(GTK_BOX(box), b->label, FALSE, FALSE, 0);
gtk_widget_show(b->label);
g_signal_connect(G_OBJECT(b->button), "clicked",
}
}
-static void bookmark_dnd_get_data(GtkWidget *UNUSED(widget),
- GdkDragContext *UNUSED(context), gint UNUSED(x), gint UNUSED(y),
- GtkSelectionData *selection_data, guint UNUSED(info),
- guint UNUSED(time), gpointer data)
+static void bookmark_dnd_get_data(GtkWidget *, GdkDragContext *,
+ gint, gint,
+ GtkSelectionData *selection_data, guint,
+ guint, gpointer data)
{
auto bm = static_cast<BookMarkData *>(data);
GList *list = nullptr;
if(errors)
{
warning_dialog_dnd_uri_error(errors);
- string_list_free(errors);
+ g_list_free_full(errors, g_free);
}
g_strfreev(uris);
if (strstr(real_path, get_collections_dir()) && isfile(path))
{
- buf = bookmark_string(filename_from_path(path), path, "gq-collection");
+ buf = bookmark_string(filename_from_path(path), path, "gq-icon-collection");
}
else if (isfile(path))
{
- buf = bookmark_string(filename_from_path(path), path, GTK_STOCK_FILE);
+ buf = bookmark_string(filename_from_path(path), path, GQ_ICON_FILE);
}
else
{
g_free(real_path);
}
- string_list_free(list);
+ g_list_free_full(list, g_free);
bookmark_populate_all(bm->key);
}
}
-static void bookmark_list_destroy(GtkWidget *UNUSED(widget), gpointer data)
+static void bookmark_list_destroy(GtkWidget *, gpointer data)
{
auto bm = static_cast<BookMarkData *>(data);
bm->editable = TRUE;
bm->only_directories = FALSE;
- scrolled = gtk_scrolled_window_new(nullptr, nullptr);
+ scrolled = gq_gtk_scrolled_window_new(nullptr, nullptr);
PangoLayout *layout;
gint width, height;
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
bm->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add(GTK_CONTAINER(scrolled), bm->box);
+ gq_gtk_container_add(GTK_WIDGET(scrolled), bm->box);
gtk_widget_show(bm->box);
bookmark_populate(bm);
void bookmark_list_add(GtkWidget *list, const gchar *name, const gchar *path)
{
BookMarkData *bm;
- gchar *buf;
gchar *real_path;
bm = static_cast<BookMarkData *>(g_object_get_data(G_OBJECT(list), BOOKMARK_DATA_KEY));
if (!bm) return;
- buf = bookmark_string(name, path, nullptr);
+ std::unique_ptr<gchar, decltype(&g_free)> buf(bookmark_string(name, path, nullptr), g_free);
real_path = realpath(path, nullptr);
if (strstr(real_path, get_collections_dir()) && isfile(path))
{
- buf = bookmark_string(name, path, "gq-collection");
+ buf.reset(bookmark_string(name, path, "gq-icon-collection"));
}
else
{
if (isfile(path))
{
- buf = bookmark_string(name, path, "gtk-file");
+ buf.reset(bookmark_string(name, path, GQ_ICON_FILE));
}
else
{
- buf = bookmark_string(name, path, nullptr);
+ buf.reset(bookmark_string(name, path, nullptr));
}
}
- history_list_add_to_key(bm->key, buf, 0);
- g_free(buf);
+ history_list_add_to_key(bm->key, buf.get(), 0);
g_free(real_path);
bookmark_populate_all(bm->key);
gint history_levels;
};
-static void history_combo_destroy(GtkWidget *UNUSED(widget), gpointer data)
+static void history_combo_destroy(GtkWidget *, gpointer data)
{
auto hc = static_cast<HistoryComboData *>(data);
if (text)
{
- gtk_entry_set_text(GTK_ENTRY(hc->entry), text);
+ gq_gtk_entry_set_text(GTK_ENTRY(hc->entry), text);
}
else if (n > 0)
{
}
else
{
- new_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(hc->entry)));
+ new_text = g_strdup(gq_gtk_entry_get_text(GTK_ENTRY(hc->entry)));
}
if (new_text && strlen(new_text) > 0)