static void collect_manager_entry_reset(CollectManagerEntry *entry);
static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr);
+namespace
+{
-static gboolean scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h)
+gboolean scan_geometry(gchar *buffer, GdkRectangle &window)
{
gint nx, ny, nw, nh;
if (sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE;
- *x = nx;
- *y = ny;
- *w = nw;
- *h = nh;
+ window.x = nx;
+ window.y = ny;
+ window.width = nw;
+ window.height = nh;
return TRUE;
}
+}
+
static gboolean collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
{
gchar s_buf[GQ_COLLECTION_READ_BUFSIZE];
guint append = !!(flags & COLLECTION_LOAD_APPEND);
guint only_geometry = !!(flags & COLLECTION_LOAD_GEOMETRY);
gboolean reading_extended_filename = FALSE;
- GString *extended_filename_buffer = g_string_new(nullptr);
gchar *buffer2;
if (!only_geometry)
return FALSE;
}
+ GString *extended_filename_buffer = g_string_new(nullptr);
while (fgets(s_buf, sizeof(s_buf), f))
{
gchar *buf;
limit_failures = FALSE;
}
else if (strncmp(p, "#geometry:", 10 ) == 0 &&
- scan_geometry(p + 10, &cd->window_x, &cd->window_y, &cd->window_w, &cd->window_h))
+ scan_geometry(p + 10, cd->window))
{
has_geometry_header = TRUE;
cd->window_read = TRUE;
}
}
- if (strlen(extended_filename_buffer->str) > 0)
+ if (extended_filename_buffer->len > 0)
{
buffer2 = g_strdup(extended_filename_buffer->str);
g_string_erase(extended_filename_buffer, 0, -1);
if (cd->info_updated_func) cd->info_updated_func(cd, cd->thumb_info, cd->info_updated_data);
}
-static void collection_load_thumb_error_cb(ThumbLoader *UNUSED(tl), gpointer data)
+static void collection_load_thumb_error_cb(ThumbLoader *, gpointer data)
{
auto cd = static_cast<CollectionData *>(data);
collection_load_thumb_step(cd);
}
-static void collection_load_thumb_done_cb(ThumbLoader *UNUSED(tl), gpointer data)
+static void collection_load_thumb_done_cb(ThumbLoader *, gpointer data)
{
auto cd = static_cast<CollectionData *>(data);
collection_update_geometry(cd);
if (cd->window_read)
{
- secure_fprintf(ssi, "#geometry: %d %d %d %d\n", cd->window_x, cd->window_y, cd->window_w, cd->window_h);
+ secure_fprintf(ssi, "#geometry: %d %d %d %d\n", cd->window.x, cd->window.y, cd->window.width, cd->window.height);
}
work = cd->list;
static void collect_manager_entry_free_data(CollectManagerEntry *entry)
{
- GList *work;
-
- work = entry->add_list;
- while (work)
- {
- CollectManagerAction *action;
-
- action = static_cast<CollectManagerAction *>(work->data);
- work = work->next;
-
- collect_manager_action_unref(action);
- }
- g_list_free(entry->add_list);
+ g_list_free_full(entry->add_list, reinterpret_cast<GDestroyNotify>(collect_manager_action_unref));
if (g_hash_table_size(entry->oldpath_hash) > 0)
g_hash_table_destroy(entry->oldpath_hash);
else
-static gboolean collect_manager_process_cb(gpointer UNUSED(data))
+static gboolean collect_manager_process_cb(gpointer)
{
if (collection_manager_action_list) collect_manager_refresh();
collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE);
return G_SOURCE_REMOVE;
}
-static gboolean collect_manager_timer_cb(gpointer UNUSED(data))
+static gboolean collect_manager_timer_cb(gpointer)
{
DEBUG_1("collection manager timer expired");
while (collect_manager_process_cb(nullptr));
}
-void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer UNUSED(data))
+void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer)
{
if (!(type & NOTIFY_CHANGE) || !fd->change) return;
}
if (paths != nullptr)
{
- *paths = g_list_insert_sorted(*paths,fd->path,
+ *paths = g_list_insert_sorted(*paths, g_strdup(fd->path),
collection_manager_sort_cb);
*paths = g_list_first(*paths);
}