SortModeType mode;
SortActionType action;
- const gchar *filter_key;
+ gchar *filter_key;
SortSelectionType selection;
if (action == BAR_SORT_FILTER)
{
if (!filter_key) filter_key = "";
- sd->filter_key = filter_key;
+ sd->filter_key = g_strdup(filter_key);
}
else
{
bar_sort_add_close(sd);
+ g_free(sd->filter_key);
g_free(sd->undo_src);
g_free(sd->undo_dest);
g_free(sd);
}
+static void bar_sort_edit_button_free(gpointer data)
+{
+ g_free(data);
+}
+
static GtkWidget *bar_sort_new(LayoutWindow *lw, SortActionType action, SortModeType mode, SortSelectionType selection, const gchar *filter_key)
{
SortData *sd;
{
GtkWidget *button;
EditorDescription *editor = work->data;
- work = work->next;
+ gchar *key;
gboolean select = FALSE;
-
- if (!editor_is_filter(editor->key)) continue;
- if (sd->action == BAR_SORT_FILTER && strcmp(editor->key, filter_key) == 0)
+ work = work->next;
+
+ if (!editor_is_filter(editor->key)) continue;
+
+ key = g_strdup(editor->key);
+ if (sd->action == BAR_SORT_FILTER && strcmp(key, filter_key) == 0)
{
- bar_sort_set_action(sd, sd->action, editor->key);
+ bar_sort_set_action(sd, sd->action, key);
select = TRUE;
have_filter = TRUE;
}
-
+
button = pref_radiobutton_new(sd->folder_group, buttongrp,
editor->name, select,
G_CALLBACK(bar_sort_set_filter_cb), sd);
-
- g_object_set_data(G_OBJECT(button), "filter_key", editor->key);
+ g_object_set_data_full(G_OBJECT(button), "filter_key", key, bar_sort_edit_button_free);
}
g_list_free(editors_list);
* edit menu
*-----------------------------------------------------------------------------
*/
+static void edit_item_destroy_cb(GtkWidget *widget, gpointer data)
+{
+ g_free(data);
+}
static void add_edit_items(GtkWidget *menu, GCallback func, GList *fd_list)
{
if (active)
{
+ GtkWidget *item;
const gchar *stock_id = NULL;
- if (editor->icon && register_theme_icon_as_stock(editor->key, editor->icon))
- stock_id = editor->key;
+ gchar *key = g_strdup(editor->key);
+
+ if (editor->icon && register_theme_icon_as_stock(key, editor->icon))
+ stock_id = key;
- menu_item_add_stock(menu, editor->name, stock_id, func, editor->key);
+ item = menu_item_add_stock(menu, editor->name, stock_id, func, key);
+ g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(edit_item_destroy_cb), key);
}
}
file_util_start_filter_from_filelist(key, list, path, vd->widget);
}
-
+static void vd_drop_menu_edit_item_free(gpointer data)
+{
+ g_free(data);
+}
GtkWidget *vd_drop_menu(ViewDir *vd, gint active)
{
{
GtkWidget *item;
const EditorDescription *editor = work->data;
+ gchar *key;
work = work->next;
if (!editor_is_filter(editor->key)) continue;
+ key = g_strdup(editor->key);
item = menu_item_add_sensitive(menu, editor->name, active, G_CALLBACK(vd_drop_menu_filter_cb), vd);
-
- g_object_set_data(G_OBJECT(item), "filter_key", editor->key);
+ g_object_set_data_full(G_OBJECT(item), "filter_key", key, vd_drop_menu_edit_item_free);
}
g_list_free(editors_list);