mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 07:26:01 +01:00
Implement noop file monitor
This commit is contained in:
parent
e0324e537b
commit
928aab913b
5 changed files with 92 additions and 1 deletions
|
@ -131,6 +131,7 @@ sources = files(
|
||||||
'zathura/document.c',
|
'zathura/document.c',
|
||||||
'zathura/file-monitor.c',
|
'zathura/file-monitor.c',
|
||||||
'zathura/file-monitor-glib.c',
|
'zathura/file-monitor-glib.c',
|
||||||
|
'zathura/file-monitor-noop.c',
|
||||||
'zathura/file-monitor-signal.c',
|
'zathura/file-monitor-signal.c',
|
||||||
'zathura/jumplist.c',
|
'zathura/jumplist.c',
|
||||||
'zathura/links.c',
|
'zathura/links.c',
|
||||||
|
|
50
zathura/file-monitor-noop.c
Normal file
50
zathura/file-monitor-noop.c
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/* See LICENSE file for license and copyright information */
|
||||||
|
|
||||||
|
#include "file-monitor-noop.h"
|
||||||
|
|
||||||
|
#include <girara/utils.h>
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
#include <glib-unix.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct zathura_noopfilemonitor_s
|
||||||
|
{
|
||||||
|
ZathuraFileMonitor parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(ZathuraNoopFileMonitor, zathura_noopfilemonitor,
|
||||||
|
ZATHURA_TYPE_FILEMONITOR)
|
||||||
|
|
||||||
|
static void
|
||||||
|
start(ZathuraFileMonitor* GIRARA_UNUSED(file_monitor))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
stop(ZathuraFileMonitor* GIRARA_UNUSED(file_monitor))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
zathura_noopfilemonitor_finalize(GObject* object)
|
||||||
|
{
|
||||||
|
stop(ZATHURA_FILEMONITOR(object));
|
||||||
|
|
||||||
|
G_OBJECT_CLASS(zathura_noopfilemonitor_parent_class)->finalize(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
zathura_noopfilemonitor_class_init(ZathuraNoopFileMonitorClass* class)
|
||||||
|
{
|
||||||
|
ZathuraFileMonitorClass* filemonitor_class = ZATHURA_FILEMONITOR_CLASS(class);
|
||||||
|
filemonitor_class->start = start;
|
||||||
|
filemonitor_class->stop = stop;
|
||||||
|
|
||||||
|
GObjectClass* object_class = G_OBJECT_CLASS(class);
|
||||||
|
object_class->finalize = zathura_noopfilemonitor_finalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
zathura_noopfilemonitor_init(ZathuraNoopFileMonitor* GIRARA_UNUSED(noopfilemonitor))
|
||||||
|
{
|
||||||
|
}
|
33
zathura/file-monitor-noop.h
Normal file
33
zathura/file-monitor-noop.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* See LICENSE file for license and copyright information */
|
||||||
|
|
||||||
|
#ifndef FILEMONITOR_NOOP_H
|
||||||
|
#define FILEMONITOR_NOOP_H
|
||||||
|
|
||||||
|
#include "file-monitor.h"
|
||||||
|
|
||||||
|
#define ZATHURA_TYPE_NOOPFILEMONITOR (zathura_noopfilemonitor_get_type())
|
||||||
|
#define ZATHURA_NOOPFILEMONITOR(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST((obj), ZATHURA_TYPE_NOOPFILEMONITOR, \
|
||||||
|
ZathuraNoopFileMonitor))
|
||||||
|
#define ZATHURA_NOOPFILEMONITOR_CLASS(obj) \
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST((obj), ZATHURA_TYPE_NOOPFILEMONITOR, \
|
||||||
|
ZathuraNoopFileMonitorClass))
|
||||||
|
#define ZATHURA_IS_NOOPFILEMONITOR(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj), ZATHURA_TYPE_NOOPFILEMONITOR))
|
||||||
|
#define ZATHURA_IS_NOOPFILEMONITOR_CLASS(obj) \
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE((obj), ZATHURA_TYPE_NOOPFILEMONITOR))
|
||||||
|
#define ZATHURA_NOOPFILEMONITOR_GET_CLASS(obj) \
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS((obj), ZATHURA_TYPE_NOOPFILEMONITOR, \
|
||||||
|
ZathuraNoopFileMonitorClass))
|
||||||
|
|
||||||
|
typedef struct zathura_noopfilemonitor_s ZathuraNoopFileMonitor;
|
||||||
|
typedef struct zathura_noopfilemonitor_class_s ZathuraNoopFileMonitorClass;
|
||||||
|
|
||||||
|
struct zathura_noopfilemonitor_class_s
|
||||||
|
{
|
||||||
|
ZathuraFileMonitorClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType zathura_noopfilemonitor_get_type(void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
#endif
|
|
@ -5,6 +5,7 @@
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
#include "file-monitor-signal.h"
|
#include "file-monitor-signal.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "file-monitor-noop.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
#include <girara/utils.h>
|
#include <girara/utils.h>
|
||||||
|
@ -141,6 +142,11 @@ zathura_filemonitor_new(const char* file_path,
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case ZATHURA_FILEMONITOR_NOOP:
|
||||||
|
girara_debug("using noop file monitor");
|
||||||
|
ret = g_object_new(ZATHURA_TYPE_NOOPFILEMONITOR, "file-path", file_path,
|
||||||
|
NULL);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
girara_debug("invalid filemonitor type: %d", filemonitor_type);
|
girara_debug("invalid filemonitor type: %d", filemonitor_type);
|
||||||
g_return_val_if_fail(false, NULL);
|
g_return_val_if_fail(false, NULL);
|
||||||
|
|
|
@ -55,7 +55,8 @@ GType zathura_filemonitor_get_type(void) G_GNUC_CONST;
|
||||||
*/
|
*/
|
||||||
typedef enum zathura_filemonitor_type_e {
|
typedef enum zathura_filemonitor_type_e {
|
||||||
ZATHURA_FILEMONITOR_GLIB, /**< Use filemonitor from GLib */
|
ZATHURA_FILEMONITOR_GLIB, /**< Use filemonitor from GLib */
|
||||||
ZATHURA_FILEMONITOR_SIGNAL /**< Reload when receiving SIGHUP */
|
ZATHURA_FILEMONITOR_SIGNAL, /**< Reload when receiving SIGHUP */
|
||||||
|
ZATHURA_FILEMONITOR_NOOP /**< Monitor that does nothing */
|
||||||
} zathura_filemonitor_type_t;
|
} zathura_filemonitor_type_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue