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/alert.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 void _closing_answer (dt_closing_t *closing, const gboolean quit)
static void _closing_quit_clicked (dt_gui_alert_t *alert __attribute__((unused)), void *data)
static void _closing_back_clicked (dt_gui_alert_t *alert __attribute__((unused)), void *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 42 of file closing.c.

Referenced by _closing_collect_job(), and _closing_details_update().

◆ DT_CLOSING_NOTICE_DELAY

#define DT_CLOSING_NOTICE_DELAY   (G_USEC_PER_SEC)

Definition at line 37 of file closing.c.

Referenced by _closing_poll().

◆ DT_CLOSING_POLL_INTERVAL

#define DT_CLOSING_POLL_INTERVAL   100

Definition at line 39 of file closing.c.

Referenced by _closing_confirm(), and dt_gui_closing_wait().

Typedef Documentation

◆ dt_closing_job_t

typedef struct dt_closing_job_t dt_closing_job_t

◆ dt_closing_mode_t

◆ dt_closing_t

typedef struct dt_closing_t dt_closing_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DT_CLOSING_COL_KIND 
DT_CLOSING_COL_DESCRIPTION 
DT_CLOSING_COLS 

Definition at line 52 of file closing.c.

◆ dt_closing_mode_t

Enumerator
DT_CLOSING_CONFIRM 
DT_CLOSING_WAIT 

Definition at line 46 of file closing.c.

Function Documentation

◆ _closing_answer()

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

◆ _closing_append_name()

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

Definition at line 175 of file closing.c.

References data, dt_free, name, and names.

Referenced by _closing_refresh().

◆ _closing_back_clicked()

void _closing_back_clicked ( dt_gui_alert_t *alert __attribute__(unused),
void * data )
static

Definition at line 93 of file closing.c.

References _closing_answer(), data, and FALSE.

Referenced by _closing_window_new().

◆ _closing_collect_job()

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

Definition at line 209 of file closing.c.

References data, description(), and DT_CLOSING_KIND_DARKROOM.

Referenced by _closing_details_update().

◆ _closing_confirm()

◆ _closing_confirm_poll()

gboolean _closing_confirm_poll ( gpointer user_data)
static

Definition at line 344 of file closing.c.

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

Referenced by _closing_confirm().

◆ _closing_count_job()

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 277 of file closing.c.

References data, and description().

Referenced by _closing_running_jobs().

◆ _closing_details_update()

◆ _closing_job_clear()

void _closing_job_clear ( gpointer data)
static

Definition at line 203 of file closing.c.

References data, dt_closing_job_t::description, and dt_free.

Referenced by _closing_details_update().

◆ _closing_kind_name()

const char * _closing_kind_name ( const int kind)
static

◆ _closing_nothing_pending()

gboolean _closing_nothing_pending ( void )
static

◆ _closing_poll()

gboolean _closing_poll ( gpointer user_data)
static

◆ _closing_quit_clicked()

void _closing_quit_clicked ( dt_gui_alert_t *alert __attribute__(unused),
void * data )
static

Definition at line 87 of file closing.c.

References _closing_answer(), data, and TRUE.

Referenced by _closing_window_new().

◆ _closing_refresh()

◆ _closing_running_jobs()

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 384 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 389 of file closing.c.

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

Referenced by dt_gui_gtk_init().