soulthreads / xwinmosaic

X11 window switcher with fancy look.
BSD 2-Clause "Simplified" License
47 stars 8 forks source link

Fails to build with glib < 2.32 #6

Closed TSultanov closed 12 years ago

TSultanov commented 12 years ago

XWinMosaic uses g_key_file_unref(), but this API is only available starting glib 2.32, so I think it would be nice to add glib >= 2.32 in dependences. (Or simply drop this call if glib version is less than 2.32)

TSultanov commented 12 years ago
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 58dc9ca..60385eb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,8 @@
 find_package (PkgConfig)
-pkg_check_modules (DEPS REQUIRED gtk+-2.0 x11)
+pkg_check_modules (DEPS REQUIRED gtk+-2.0 x11 glib-2.0)
+if(PACKAGE_glib-2.0_VERSION VERSION_LESS 2.30)
+  add_definitions(-DOLDGLIB)
+endif(PACKAGE_glib-2.0_VERSION VERSION_LESS 2.30)
 set (CFLAGS ${DEPS_CFLAGS}
            ${DEPS_CFLAGS_OTHER})
 set (LIB_PATHS ${DEPS_LIBRARY_DIRS})
diff --git a/src/main.c b/src/main.c
index c2f8968..2cc5af5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -671,8 +671,9 @@ static void read_config ()
     if (g_key_file_has_key (config, group, "screenshot_offset_y", &error))
       options.screenshot_offset_y = g_key_file_get_integer (config, group, "screenshot_offset_y", &error);
   }
-
+#ifndef OLDGLIB
   g_key_file_unref (config);
+#endif
 }

 static void write_default_config ()
soulthreads commented 12 years ago

Fixed in commit 78175dc0fe749ab6b66336fc7f8dc37d7c388a15