Simplify the USE_GIO_FILEMON preprocessor checks.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3934 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-07-08 22:20:41 +00:00
parent 7067b84a09
commit 83804ab746

View File

@ -48,10 +48,13 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
/* uncomment to use GIO based file monitoring, though it is not completely stable yet */ /* uncomment to use GIO based file monitoring, though it is not completely stable yet */
/* #define USE_GIO_FILEMON 1 */ /*#define USE_GIO_FILEMON 1*/
#if USE_GIO_FILEMON
#if defined(HAVE_GIO) && defined(USE_GIO_FILEMON) # ifdef HAVE_GIO
# include <gio/gio.h> # include <gio/gio.h>
# else
# undef USE_GIO_FILEMON
# endif
#endif #endif
#include "document.h" #include "document.h"
@ -423,7 +426,7 @@ static void queue_colourise(GeanyDocument *doc)
} }
#if defined(HAVE_GIO) && defined(USE_GIO_FILEMON) #if USE_GIO_FILEMON
static void monitor_file_changed_cb(G_GNUC_UNUSED GFileMonitor *monitor, G_GNUC_UNUSED GFile *file, static void monitor_file_changed_cb(G_GNUC_UNUSED GFileMonitor *monitor, G_GNUC_UNUSED GFile *file,
G_GNUC_UNUSED GFile *other_file, GFileMonitorEvent event, G_GNUC_UNUSED GFile *other_file, GFileMonitorEvent event,
GeanyDocument *doc) GeanyDocument *doc)
@ -483,7 +486,7 @@ static void monitor_file_setup(GeanyDocument *doc)
* doesn't work at all for remote files and legacy polling is too slow. */ * doesn't work at all for remote files and legacy polling is too slow. */
if (! doc->priv->is_remote) if (! doc->priv->is_remote)
{ {
#if defined(HAVE_GIO) && defined(USE_GIO_FILEMON) #if USE_GIO_FILEMON
gchar *locale_filename; gchar *locale_filename;
/* stop any previous monitoring */ /* stop any previous monitoring */
@ -719,7 +722,7 @@ GeanyDocument *document_new_file(const gchar *utf8_filename, GeanyFiletype *ft,
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0); sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
sci_goto_pos(doc->editor->sci, 0, TRUE); sci_goto_pos(doc->editor->sci, 0, TRUE);
#if defined(HAVE_GIO) && defined(USE_GIO_FILEMON) #if USE_GIO_FILEMON
monitor_file_setup(doc); monitor_file_setup(doc);
#else #else
doc->priv->mtime = time(NULL); doc->priv->mtime = time(NULL);
@ -1391,7 +1394,7 @@ gboolean document_reload_file(GeanyDocument *doc, const gchar *forced_enc)
static gboolean document_update_timestamp(GeanyDocument *doc, const gchar *locale_filename) static gboolean document_update_timestamp(GeanyDocument *doc, const gchar *locale_filename)
{ {
#if ! defined(HAVE_GIO) || ! defined(USE_GIO_FILEMON) #if ! USE_GIO_FILEMON
struct stat st; struct stat st;
g_return_val_if_fail(doc != NULL, FALSE); g_return_val_if_fail(doc != NULL, FALSE);
@ -2694,7 +2697,7 @@ const GdkColor *document_get_status_color(GeanyDocument *doc)
{ {
static GdkColor red = {0, 0xFFFF, 0, 0}; static GdkColor red = {0, 0xFFFF, 0, 0};
static GdkColor green = {0, 0, 0x7FFF, 0}; static GdkColor green = {0, 0, 0x7FFF, 0};
#if defined(HAVE_GIO) && defined(USE_GIO_FILEMON) #if USE_GIO_FILEMON
static GdkColor orange = {0, 0xFFFF, 0x7FFF, 0}; static GdkColor orange = {0, 0xFFFF, 0x7FFF, 0};
#endif #endif
GdkColor *color = NULL; GdkColor *color = NULL;
@ -2703,7 +2706,7 @@ const GdkColor *document_get_status_color(GeanyDocument *doc)
if (doc->changed) if (doc->changed)
color = &red; color = &red;
#if defined(HAVE_GIO) && defined(USE_GIO_FILEMON) #if USE_GIO_FILEMON
else if (doc->priv->file_disk_status == FILE_CHANGED) else if (doc->priv->file_disk_status == FILE_CHANGED)
color = &orange; color = &orange;
#endif #endif