Commit b85e8c38 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add debug output

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent b93ebeb3
......@@ -3,6 +3,7 @@
#include "file-monitor-glib.h"
#include "macros.h"
#include <girara/utils.h>
#include <gio/gio.h>
struct zathura_glibfilemonitor_s
......@@ -16,15 +17,20 @@ G_DEFINE_TYPE(ZathuraGLibFileMonitor, zathura_glibfilemonitor,
ZATHURA_TYPE_FILEMONITOR)
static void
file_changed(GFileMonitor* UNUSED(monitor), GFile* UNUSED(file),
file_changed(GFileMonitor* UNUSED(monitor), GFile* file,
GFile* UNUSED(other_file), GFileMonitorEvent event,
ZathuraGLibFileMonitor* file_monitor)
{
switch (event) {
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
case G_FILE_MONITOR_EVENT_CREATED:
case G_FILE_MONITOR_EVENT_CREATED: {
char* uri = g_file_get_uri(file);
girara_debug("received file-monitor event for %s", uri);
g_free(uri);
g_signal_emit_by_name(file_monitor, "reload-file");
break;
}
default:
return;
}
......
......@@ -2,6 +2,7 @@
#include "file-monitor-signal.h"
#include <girara/utils.h>
#ifdef G_OS_UNIX
#include <glib-unix.h>
#endif
......@@ -24,6 +25,7 @@ signal_handler(gpointer data)
ZathuraSignalFileMonitor* signalfilemonitor = data;
girara_debug("SIGHUP received");
g_signal_emit_by_name(signalfilemonitor, "reload-file");
return TRUE;
......
......@@ -127,11 +127,13 @@ zathura_filemonitor_new(const char* file_path,
GObject* ret = NULL;
switch (filemonitor_type) {
case ZATHURA_FILEMONITOR_GLIB:
girara_debug("using glib file monitor");
ret = g_object_new(ZATHURA_TYPE_GLIBFILEMONITOR, "file-path", file_path,
NULL);
break;
#ifdef G_OS_UNIX
case ZATHURA_FILEMONITOR_SIGNAL:
girara_debug("using SIGHUB file monitor");
ret = g_object_new(ZATHURA_TYPE_SIGNALFILEMONITOR, "file-path", file_path,
NULL);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment