Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
film_gui.c
Go to the documentation of this file.
1/*
2 * This file is part of darktable,
3 * Copyright (C) 2016 johannes hanika.
4 * Copyright (C) 2016, 2020 Tobias Ellinghaus.
5 * Copyright (C) 2020 Pascal Obry.
6 * Copyright (C) 2021 Sakari Kapanen.
7 * Copyright (C) 2022 Martin Baƙinka.
8 *
9 * darktable is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * darktable is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with darktable. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23
24#include "gui/common/film_gui.h"
25
26#include "common/film.h"
27#include "control/signal.h"
28#include "system/mem_alloc.h"
29#include "gui/application.h"
30
31#include <glib/gi18n.h>
32#include <gtk/gtk.h>
35
36#ifdef GDK_WINDOWING_QUARTZ
37#include "osx/osx.h"
38#endif
39
40/* Runs on the GUI thread via g_idle_add(): dt_film_remove_empty() is reached from worker
41 * threads, and gtk_dialog_run() must not be. Takes ownership of the list. */
42static gboolean _ask_and_delete(gpointer user_data)
43{
44 GList *empty_dirs = (GList *)user_data;
46
50 ngettext("do you want to remove this empty directory?",
51 "do you want to remove these empty directories?",
53#ifdef GDK_WINDOWING_QUARTZ
55#endif
56
58 ngettext("remove empty directory?", "remove empty directories?", n_empty_dirs));
59
61
64 dt_gui_add_class(scroll, "dt_recessed_scroll");
65
67
69 {
72 gtk_list_store_set(store, &iter, 0, list_iter->data, -1);
73 }
74
77 gtk_widget_set_name(GTK_WIDGET(tree), "delete-dialog");
79 "text", 0, NULL);
81
82 gtk_container_add(GTK_CONTAINER(scroll), tree);
85
87
88 gtk_widget_show_all(dialog); // needed for the content area!
89
90 const gint res = gtk_dialog_run(GTK_DIALOG(dialog));
91 gtk_widget_destroy(dialog);
92
93 // The deleting itself is the backend's job; this module only obtained consent.
95
98
99 return FALSE;
100}
101
103{
104 // defer to the GUI thread; ownership travels with the list
106}
107
108/* The backend states the fact; the signal is how this application distributes it. Raised on
109 * whichever thread changed the rolls, same as the emission this replaces -- the Library
110 * panel's handler is what marshals itself onto the GUI thread. */
115
121
122// clang-format off
123// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
124// vim: shiftwidth=2 expandtab tabstop=2 cindent
125// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
126// clang-format on
GtkWidget * dt_gui_main_window(void)
#define TRUE
Definition ashift_lsd.c:162
#define FALSE
Definition ashift_lsd.c:158
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98
GtkTreeStore * store
its model, owned by the view
const int res
Definition dtpthread.h:351
void dt_film_set_rolls_changed_handler(dt_film_rolls_changed_handler_t handler)
Install the handler, or NULL to remove it.
Definition film.c:242
void dt_film_remove_directories(const GList *dirs)
Definition film.c:253
void dt_film_set_confirm_rmdir_handler(dt_film_confirm_rmdir_handler_t handler)
Definition film.c:233
static void _confirm_rmdir(GList *empty_dirs)
Definition film_gui.c:102
static gboolean _ask_and_delete(gpointer user_data)
Definition film_gui.c:42
void dt_film_gui_register_handlers(void)
Definition film_gui.c:116
static void _rolls_changed(void)
Definition film_gui.c:111
static void dt_free_gpointer(gpointer ptr)
g_free() one pointer, with the signature GDestroyNotify wants.
Definition mem_alloc.h:184
void dt_osx_disallow_fullscreen(GtkWidget *widget)
Definition osx.mm:105
#define DT_DEBUG_CONTROL_SIGNAL_RAISE(ctlsig, signal,...)
Definition signal.h:390
struct dt_control_signal_t * dt_control_signal_get_global(void)
Definition darktable.c:616
@ DT_SIGNAL_FILMROLLS_CHANGED
This signal is raised when a filmroll is deleted/changed but not imported.
Definition signal.h:160
#define DT_PIXEL_APPLY_DPI(value)
void dt_gui_add_class(GtkWidget *widget, const gchar *class_name)