Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
closing.c File Reference
#include "gui/closing.h"
#include "common/logging.h"
#include "control/control.h"
#include "control/jobs.h"
#include "control/progress.h"
#include "gui/application.h"
#include "system/macros.h"
#include "system/mem_alloc.h"
#include "widgets/dialog.h"
#include "widgets/widget_settings.h"
#include "widgets/widget_style.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+ Include dependency graph for closing.c:

Go to the source code of this file.

Data Structures

struct  dt_closing_t
 
struct  dt_closing_job_t
 

Macros

#define DT_CLOSING_NOTICE_DELAY   (G_USEC_PER_SEC)
 
#define DT_CLOSING_POLL_INTERVAL   100
 
#define DT_CLOSING_KIND_DARKROOM   DT_JOB_QUEUE_MAX
 

Typedefs

typedef enum dt_closing_mode_t dt_closing_mode_t
 
typedef struct dt_closing_t dt_closing_t
 
typedef struct dt_closing_job_t dt_closing_job_t
 

Enumerations

enum  dt_closing_mode_t {
  DT_CLOSING_CONFIRM ,
  DT_CLOSING_WAIT
}
 
enum  {
  DT_CLOSING_COL_KIND ,
  DT_CLOSING_COL_DESCRIPTION ,
  DT_CLOSING_COLS
}
 

Functions

static gboolean _closing_refuse_delete (GtkWidget *widget __attribute__((unused)), GdkEvent *event __attribute__((unused)), gpointer user_data __attribute__((unused)))
 
static void _closing_answer (dt_closing_t *closing, const gboolean quit)
 
static void _closing_quit_clicked (GtkButton *button __attribute__((unused)), gpointer user_data)
 
static void _closing_back_clicked (GtkButton *button __attribute__((unused)), gpointer user_data)
 
static gboolean _closing_confirm_delete (GtkWidget *widget __attribute__((unused)), GdkEvent *event __attribute__((unused)), gpointer user_data)
 
static gboolean _closing_confirm_key (GtkWidget *widget __attribute__((unused)), const GdkEventKey *event, gpointer user_data)
 
static void _closing_window_new (dt_closing_t *closing)
 
static void _closing_append_name (const gchar *message, void *data)
 
static const char * _closing_kind_name (const int kind)
 
static void _closing_job_clear (gpointer data)
 
static void _closing_collect_job (const char *description, const dt_job_queue_t queue, const gboolean reserved, void *data)
 
static void _closing_details_update (dt_closing_t *closing)
 
static void _closing_count_job (const char *description __attribute__((unused)), const dt_job_queue_t queue __attribute__((unused)), const gboolean reserved, void *data)
 
static int32_t _closing_running_jobs (void)
 
static void _closing_refresh (dt_closing_t *closing)
 
static gboolean _closing_poll (gpointer user_data)
 
static gboolean _closing_nothing_pending (void)
 
static gboolean _closing_confirm_poll (gpointer user_data)
 
static gboolean _closing_confirm (void)
 
void dt_gui_closing_quit (void)
 
void dt_gui_closing_wait (void)
 

Macro Definition Documentation

◆ DT_CLOSING_KIND_DARKROOM

#define DT_CLOSING_KIND_DARKROOM   DT_JOB_QUEUE_MAX

Definition at line 45 of file closing.c.

◆ DT_CLOSING_NOTICE_DELAY

#define DT_CLOSING_NOTICE_DELAY   (G_USEC_PER_SEC)

Definition at line 40 of file closing.c.

◆ DT_CLOSING_POLL_INTERVAL

#define DT_CLOSING_POLL_INTERVAL   100

Definition at line 42 of file closing.c.

Typedef Documentation

◆ dt_closing_job_t

◆ dt_closing_mode_t

◆ dt_closing_t

Enumeration Type Documentation

◆ anonymous enum

Enumerator
DT_CLOSING_COL_KIND 
DT_CLOSING_COL_DESCRIPTION 
DT_CLOSING_COLS 

Definition at line 55 of file closing.c.

◆ dt_closing_mode_t

Enumerator
DT_CLOSING_CONFIRM 
DT_CLOSING_WAIT 

Definition at line 49 of file closing.c.

Function Documentation

◆ _closing_answer()

static void _closing_answer ( dt_closing_t *  closing,
const gboolean  quit 
)
static

◆ _closing_append_name()

static void _closing_append_name ( const gchar *  message,
void *  data 
)
static

Definition at line 278 of file closing.c.

References dt_free, L, name, and names.

Referenced by _closing_refresh().

◆ _closing_back_clicked()

static void _closing_back_clicked ( GtkButton *button   __attribute__(unused),
gpointer  user_data 
)
static

Definition at line 102 of file closing.c.

References _closing_answer(), and FALSE.

Referenced by _closing_window_new().

◆ _closing_collect_job()

static void _closing_collect_job ( const char *  description,
const dt_job_queue_t  queue,
const gboolean  reserved,
void *  data 
)
static

Definition at line 312 of file closing.c.

References description(), DT_CLOSING_KIND_DARKROOM, dt_closing_job_t::kind, and L.

Referenced by _closing_details_update().

◆ _closing_confirm()

◆ _closing_confirm_delete()

static gboolean _closing_confirm_delete ( GtkWidget *widget   __attribute__(unused),
GdkEvent *event   __attribute__(unused),
gpointer  user_data 
)
static

Definition at line 108 of file closing.c.

References _closing_answer(), FALSE, and TRUE.

Referenced by _closing_window_new().

◆ _closing_confirm_key()

static gboolean _closing_confirm_key ( GtkWidget *widget   __attribute__(unused),
const GdkEventKey *  event,
gpointer  user_data 
)
static

Definition at line 115 of file closing.c.

References _closing_answer(), FALSE, L, and TRUE.

Referenced by _closing_window_new().

◆ _closing_confirm_poll()

static gboolean _closing_confirm_poll ( gpointer  user_data)
static

Definition at line 447 of file closing.c.

References _closing_answer(), _closing_nothing_pending(), _closing_refresh(), L, and TRUE.

Referenced by _closing_confirm().

◆ _closing_count_job()

static void _closing_count_job ( const char *description   __attribute__(unused),
const dt_job_queue_t queue   __attribute__(unused),
const gboolean  reserved,
void *  data 
)
static

Definition at line 380 of file closing.c.

Referenced by _closing_running_jobs().

◆ _closing_details_update()

◆ _closing_job_clear()

static void _closing_job_clear ( gpointer  data)
static

Definition at line 306 of file closing.c.

References dt_closing_job_t::description, and dt_free.

Referenced by _closing_details_update().

◆ _closing_kind_name()

static const char * _closing_kind_name ( const int  kind)
static

◆ _closing_nothing_pending()

static gboolean _closing_nothing_pending ( void  )
static

◆ _closing_poll()

static gboolean _closing_poll ( gpointer  user_data)
static

◆ _closing_quit_clicked()

static void _closing_quit_clicked ( GtkButton *button   __attribute__(unused),
gpointer  user_data 
)
static

Definition at line 97 of file closing.c.

References _closing_answer(), and TRUE.

Referenced by _closing_window_new().

◆ _closing_refresh()

◆ _closing_refuse_delete()

static gboolean _closing_refuse_delete ( GtkWidget *widget   __attribute__(unused),
GdkEvent *event   __attribute__(unused),
gpointer user_data   __attribute__(unused) 
)
static

Definition at line 84 of file closing.c.

References TRUE.

Referenced by _closing_window_new().

◆ _closing_running_jobs()

static int32_t _closing_running_jobs ( void  )
static

◆ _closing_window_new()

◆ dt_gui_closing_quit()

void dt_gui_closing_quit ( void  )

Quit, as the user asked from the window, the menu or the dock.

While jobs are running or queued – an export, a preload, a thumbnail being rendered: what the closing window would wait for or drop – a modal window first names them and asks whether to quit all the same or go back. Nothing is cancelled either way: a quit finishes the running jobs and drops the queued ones. With no job, the quit starts at once. GUI thread only.

Definition at line 487 of file closing.c.

References _closing_confirm(), and dt_control_quit().

Referenced by append_file(), and dt_gui_quit_callback().

◆ dt_gui_closing_wait()

void dt_gui_closing_wait ( void  )

Keep the GUI thread in its main loop until every control worker has returned.

Quitting hides the main window at once, but the jobs running at that moment – an export, the thumbnails being rendered, a pipeline – are finished, not abandoned. When that takes more than a moment, a small window says so, names the jobs that have a name, and goes away with the last of them.

This is the handler dt_control_shutdown() waits in: see dt_control_set_shutdown_wait_handler(). GUI thread only. Returns at once when nothing is running.

Definition at line 492 of file closing.c.

References _closing_poll(), DT_CLOSING_POLL_INTERVAL, DT_CLOSING_WAIT, dt_control_workers_alive(), DT_DEBUG_CONTROL, dt_free, dt_print(), FALSE, IS_NULL_PTR, L, dt_closing_t::listed, dt_closing_t::loop, dt_closing_t::mode, dt_closing_t::start, and dt_closing_t::window.

Referenced by dt_gui_gtk_init().