diff options
author | Monsta <[email protected]> | 2015-01-12 16:04:13 +0300 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2015-01-13 11:55:00 +0100 |
commit | 53ec021ce6e0ee923bd86e11b4f516b2a19bc2e8 (patch) | |
tree | bc422498f805a6ae0b5495157a7482616ec16259 | |
parent | d327a96cfb61acd0ce606c4bf80349454b66bd44 (diff) | |
download | caja-53ec021ce6e0ee923bd86e11b4f516b2a19bc2e8.tar.bz2 caja-53ec021ce6e0ee923bd86e11b4f516b2a19bc2e8.tar.xz |
drop support for GLib < 2.36
Closes https://github.com/mate-desktop/caja/pull/372
55 files changed, 46 insertions, 362 deletions
diff --git a/configure.ac b/configure.ac index 8a16babe..70ab80ff 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.54) dnl =========================================================================== -m4_define(glib_minver, 2.28.0) +m4_define(glib_minver, 2.36.0) m4_define(gio_minver, 2.26.0) m4_define(mate_desktop_minver, 1.9.0) m4_define(pango_minver, 1.1.2) diff --git a/eel/eel-glib-extensions.c b/eel/eel-glib-extensions.c index 96eeb354..68ed9e86 100644 --- a/eel/eel-glib-extensions.c +++ b/eel/eel-glib-extensions.c @@ -38,8 +38,6 @@ #include <time.h> #include <locale.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - /* Legal conversion specifiers, as specified in the C standard. */ #define C_STANDARD_STRFTIME_CHARACTERS "aAbBcdHIjmMpSUwWxXyYZ" #define C_STANDARD_NUMERIC_STRFTIME_CHARACTERS "dHIjmMSUwWyY" diff --git a/eel/eel-string.c b/eel/eel-string.c index 3a8f2581..5d74c317 100644 --- a/eel/eel-string.c +++ b/eel/eel-string.c @@ -988,11 +988,7 @@ retry_atomic_decrement: { G_LOCK (unique_ref_strs); /* Need to recheck after taking lock to avoid races with _get_unique() */ -#if !GLIB_CHECK_VERSION (2, 30, 0) - if (g_atomic_int_exchange_and_add (count, -1) == 0x80000001) -#else if (g_atomic_int_add (count, -1) == 0x80000001) -#endif { g_hash_table_remove (unique_ref_strs, (char *)str); g_free ((char *)count); diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c index 5c7bfec8..eaaea4c6 100644 --- a/libcaja-private/caja-autorun.c +++ b/libcaja-private/caja-autorun.c @@ -43,8 +43,6 @@ #include "caja-desktop-icon-file.h" #include "caja-file-utilities.h" -#include <src/glibcompat.h> /* for g_list_free_full */ - enum { AUTORUN_ASK, diff --git a/libcaja-private/caja-clipboard.c b/libcaja-private/caja-clipboard.c index ab0b7987..87d390be 100644 --- a/libcaja-private/caja-clipboard.c +++ b/libcaja-private/caja-clipboard.c @@ -35,8 +35,6 @@ #include <gtk/gtk.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - typedef struct _TargetCallbackData TargetCallbackData; typedef void (* SelectAllCallback) (gpointer target); diff --git a/libcaja-private/caja-customization-data.c b/libcaja-private/caja-customization-data.c index a1019301..c88871a9 100644 --- a/libcaja-private/caja-customization-data.c +++ b/libcaja-private/caja-customization-data.c @@ -23,7 +23,7 @@ */ /* caja-customization-data.c - functions to collect and load customization - names and imges */ + names and images */ #include <config.h> #include "caja-customization-data.h" @@ -43,8 +43,6 @@ #include <stdlib.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - typedef enum { READ_PUBLIC_CUSTOMIZATIONS, diff --git a/libcaja-private/caja-debug-log.c b/libcaja-private/caja-debug-log.c index 446df48e..19462d34 100644 --- a/libcaja-private/caja-debug-log.c +++ b/libcaja-private/caja-debug-log.c @@ -30,8 +30,6 @@ #include "caja-debug-log.h" #include "caja-file.h" -#include <src/glibcompat.h> /* for g_list_free_full */ - #define DEFAULT_RING_BUFFER_NUM_LINES 1000 #define KEY_FILE_GROUP "debug log" @@ -40,11 +38,7 @@ #define MAX_URI_COUNT 20 -#if GLIB_CHECK_VERSION(2, 31, 0) static GMutex log_mutex; -#else -static GStaticMutex log_mutex = G_STATIC_MUTEX_INIT; -#endif static GHashTable *domains_hash; static char **ring_buffer; @@ -58,21 +52,13 @@ static GSList *milestones_tail; static void lock (void) { - #if GLIB_CHECK_VERSION(2, 31, 0) g_mutex_lock (&log_mutex); - #else - g_static_mutex_lock (&log_mutex); - #endif } static void unlock (void) { - #if GLIB_CHECK_VERSION(2, 31, 0) g_mutex_unlock (&log_mutex); - #else - g_static_mutex_unlock (&log_mutex); - #endif } void diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c index d5d97cf0..a795c161 100644 --- a/libcaja-private/caja-directory-async.c +++ b/libcaja-private/caja-directory-async.c @@ -39,8 +39,6 @@ #include <stdio.h> #include <stdlib.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - /* turn this on to see messages about each load_directory call: */ #if 0 #define DEBUG_LOAD_DIRECTORY diff --git a/libcaja-private/caja-directory.c b/libcaja-private/caja-directory.c index a7c5d5a5..ba8d7d97 100644 --- a/libcaja-private/caja-directory.c +++ b/libcaja-private/caja-directory.c @@ -40,8 +40,6 @@ #include <gtk/gtk.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - enum { FILES_ADDED, diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c index 792b3e79..9cfbcbc5 100644 --- a/libcaja-private/caja-dnd.c +++ b/libcaja-private/caja-dnd.c @@ -44,8 +44,6 @@ #include <stdio.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - /* a set of defines stolen from the eel-icon-dnd.c file. * These are in microseconds. */ diff --git a/libcaja-private/caja-emblem-utils.c b/libcaja-private/caja-emblem-utils.c index 951887aa..2f4aa054 100644 --- a/libcaja-private/caja-emblem-utils.c +++ b/libcaja-private/caja-emblem-utils.c @@ -43,8 +43,6 @@ #include "caja-file.h" #include "caja-emblem-utils.h" -#include <src/glibcompat.h> /* for g_list_free_full */ - #define EMBLEM_NAME_TRASH "emblem-trash" #define EMBLEM_NAME_SYMLINK "emblem-symbolic-link" #define EMBLEM_NAME_NOREAD "emblem-noread" diff --git a/libcaja-private/caja-file-changes-queue.c b/libcaja-private/caja-file-changes-queue.c index 127de7ed..8b60d63a 100644 --- a/libcaja-private/caja-file-changes-queue.c +++ b/libcaja-private/caja-file-changes-queue.c @@ -25,8 +25,6 @@ #include "caja-directory-notify.h" -#include <src/glibcompat.h> /* for g_list_free_full */ - #ifdef G_THREADS_ENABLED #define MUTEX_LOCK(a) if ((a) != NULL) g_mutex_lock (a) #define MUTEX_UNLOCK(a) if ((a) != NULL) g_mutex_unlock (a) @@ -60,11 +58,7 @@ typedef struct GList *head; GList *tail; #ifdef G_THREADS_ENABLED -# if GLIB_CHECK_VERSION(2, 32, 0) GMutex mutex; -# else - GMutex *mutex; -# endif #endif } CajaFileChangesQueue; @@ -76,11 +70,7 @@ caja_file_changes_queue_new (void) result = g_new0 (CajaFileChangesQueue, 1); #ifdef G_THREADS_ENABLED -# if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_init (&result->mutex); -# else - result->mutex = g_mutex_new (); -# endif #endif return result; } @@ -135,11 +125,7 @@ caja_file_changes_queue_free (CajaFileChangesQueue *queue) g_list_free (queue->head); #ifdef G_THREADS_ENABLED -# if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_clear (&queue->mutex); -# else - g_mutex_free (queue->mutex); -# endif #endif g_free (queue); } @@ -151,21 +137,13 @@ caja_file_changes_queue_add_common (CajaFileChangesQueue *queue, CajaFileChange *new_item) { /* enqueue the new queue item while locking down the list */ -#if GLIB_CHECK_VERSION(2, 32, 0) MUTEX_LOCK (&queue->mutex); -#else - MUTEX_LOCK (queue->mutex); -#endif queue->head = g_list_prepend (queue->head, new_item); if (queue->tail == NULL) queue->tail = queue->head; -#if GLIB_CHECK_VERSION(2, 32, 0) MUTEX_UNLOCK (&queue->mutex); -#else - MUTEX_UNLOCK (queue->mutex); -#endif } void @@ -267,11 +245,7 @@ caja_file_changes_queue_get_change (CajaFileChangesQueue *queue) g_assert (queue != NULL); /* dequeue the tail item while locking down the list */ -#if GLIB_CHECK_VERSION (2, 32, 0) MUTEX_LOCK (&queue->mutex); -#else - MUTEX_LOCK (queue->mutex); -#endif if (queue->tail == NULL) { @@ -287,11 +261,7 @@ caja_file_changes_queue_get_change (CajaFileChangesQueue *queue) queue->tail = new_tail; } -#if GLIB_CHECK_VERSION (2, 32, 0) MUTEX_UNLOCK (&queue->mutex); -#else - MUTEX_UNLOCK (queue->mutex); -#endif return result; } diff --git a/libcaja-private/caja-file-dnd.c b/libcaja-private/caja-file-dnd.c index 5e1beec5..061019e9 100644 --- a/libcaja-private/caja-file-dnd.c +++ b/libcaja-private/caja-file-dnd.c @@ -32,8 +32,6 @@ #include "caja-file-utilities.h" #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - static gboolean caja_drag_can_accept_files (CajaFile *drop_target_item) { diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index e410e41f..e310de1f 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -68,8 +68,6 @@ #include "caja-file-conflict-dialog.h" #include "caja-undostack-manager.h" -#include <src/glibcompat.h> /* for g_list_free_full */ - /* TODO: TESTING!!! */ typedef struct { @@ -851,14 +849,10 @@ custom_size_to_string (char *format, va_list va) size = va_arg (va, goffset); - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - return g_format_size_full (size, G_FORMAT_SIZE_IEC_UNITS); - else - return g_format_size(size); - #else - return g_format_size_for_display(size); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) + return g_format_size_full (size, G_FORMAT_SIZE_IEC_UNITS); + else + return g_format_size(size); } static void diff --git a/libcaja-private/caja-file-utilities.c b/libcaja-private/caja-file-utilities.c index dd8b449c..51083122 100644 --- a/libcaja-private/caja-file-utilities.c +++ b/libcaja-private/caja-file-utilities.c @@ -43,8 +43,6 @@ #include <unistd.h> #include <stdlib.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - #define CAJA_USER_DIRECTORY_NAME ".config/caja" #define DEFAULT_CAJA_DIRECTORY_MODE (0755) diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index d41c2b45..2e3ad466 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -72,8 +72,6 @@ #include <unistd.h> #include <sys/stat.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - #ifdef HAVE_SELINUX #include <selinux/selinux.h> #endif @@ -5958,14 +5956,10 @@ caja_file_get_size_as_string (CajaFile *file) return NULL; } - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS); - else - return g_format_size (file->details->size); - #else // Since 2.16 - return g_format_size_for_display(file->details->size); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) + return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS); + else + return g_format_size (file->details->size); } /** @@ -5985,8 +5979,8 @@ caja_file_get_size_as_string_with_real_size (CajaFile *file) { guint item_count; gboolean count_unreadable; - char * formated; - char * formated_plus_real; + char * formatted; + char * formatted_plus_real; char * real_size; if (file == NULL) { @@ -6006,21 +6000,17 @@ caja_file_get_size_as_string_with_real_size (CajaFile *file) return NULL; } - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - formated = g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS); - else - formated = g_format_size(file->details->size); - #else - formated = g_format_size_for_display(file->details->size); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) + formatted = g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS); + else + formatted = g_format_size(file->details->size); /* Do this in a separate stage so that we don't have to put G_GUINT64_FORMAT in the translated string */ real_size = g_strdup_printf (_("%"G_GUINT64_FORMAT), (guint64) file->details->size); - formated_plus_real = g_strdup_printf (_("%s (%s bytes)"), formated, real_size); + formatted_plus_real = g_strdup_printf (_("%s (%s bytes)"), formatted, real_size); g_free (real_size); - g_free (formated); - return formated_plus_real; + g_free (formatted); + return formatted_plus_real; } @@ -6081,14 +6071,10 @@ caja_file_get_deep_count_as_string_internal (CajaFile *file, */ if (report_size) { - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS); - else - return g_format_size(total_size); - #else - return g_format_size_for_display(total_size); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) + return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS); + else + return g_format_size(total_size); } return format_item_count_for_display (report_directory_count @@ -6899,14 +6885,10 @@ caja_file_get_volume_free_space (CajaFile *file) if (directory->details->free_space != (guint64) -1) { - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - res = g_format_size_full (directory->details->free_space, G_FORMAT_SIZE_IEC_UNITS); - else - res = g_format_size(directory->details->free_space); - #else - res = g_format_size_for_display(directory->details->free_space); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) + res = g_format_size_full (directory->details->free_space, G_FORMAT_SIZE_IEC_UNITS); + else + res = g_format_size(directory->details->free_space); } return res; diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c index 58ff44fa..fe44b9b2 100644 --- a/libcaja-private/caja-icon-canvas-item.c +++ b/libcaja-private/caja-icon-canvas-item.c @@ -50,8 +50,6 @@ #include <stdio.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - #define EMBLEM_SPACING 2 /* gap between bottom of icon and start of text box */ diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index 50cc76f2..5db10601 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -52,8 +52,6 @@ #include <stdio.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - #if !GTK_CHECK_VERSION(3, 0, 0) #define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment #define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment diff --git a/libcaja-private/caja-merged-directory.c b/libcaja-private/caja-merged-directory.c index 7c0aaa73..2c8d825d 100644 --- a/libcaja-private/caja-merged-directory.c +++ b/libcaja-private/caja-merged-directory.c @@ -33,8 +33,6 @@ #include <eel/eel-gtk-macros.h> #include <gtk/gtk.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - struct CajaMergedDirectoryDetails { GList *directories; diff --git a/libcaja-private/caja-mime-actions.c b/libcaja-private/caja-mime-actions.c index bbcc6f4d..2a303f72 100644 --- a/libcaja-private/caja-mime-actions.c +++ b/libcaja-private/caja-mime-actions.c @@ -44,8 +44,6 @@ #include "caja-debug-log.h" #include "caja-open-with-dialog.h" -#include <src/glibcompat.h> /* for g_list_free_full */ - typedef enum { ACTIVATION_ACTION_LAUNCH_DESKTOP_FILE, diff --git a/libcaja-private/caja-mime-application-chooser.c b/libcaja-private/caja-mime-application-chooser.c index 21c56c1a..c989bad1 100644 --- a/libcaja-private/caja-mime-application-chooser.c +++ b/libcaja-private/caja-mime-application-chooser.c @@ -39,8 +39,6 @@ #include <gtk/gtk.h> #include <gio/gio.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - struct _CajaMimeApplicationChooserDetails { char *uri; diff --git a/libcaja-private/caja-open-with-dialog.c b/libcaja-private/caja-open-with-dialog.c index 0d7a4537..0d0e6e28 100644 --- a/libcaja-private/caja-open-with-dialog.c +++ b/libcaja-private/caja-open-with-dialog.c @@ -36,8 +36,6 @@ #include <gtk/gtk.h> #include <gio/gio.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - #define sure_string(s) ((const char *)((s)!=NULL?(s):"")) #define DESKTOP_ENTRY_GROUP "Desktop Entry" diff --git a/libcaja-private/caja-program-choosing.c b/libcaja-private/caja-program-choosing.c index 8958119a..8ac87f0b 100644 --- a/libcaja-private/caja-program-choosing.c +++ b/libcaja-private/caja-program-choosing.c @@ -42,8 +42,6 @@ #include <gdk/gdk.h> #include <gdk/gdkx.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - /** * application_cannot_open_location * diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c index 4b38d830..e0359a04 100644 --- a/libcaja-private/caja-query.c +++ b/libcaja-private/caja-query.c @@ -30,8 +30,6 @@ #include <glib/gi18n.h> #include <libcaja-private/caja-file-utilities.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - struct CajaQueryDetails { char *text; diff --git a/libcaja-private/caja-search-engine-beagle.c b/libcaja-private/caja-search-engine-beagle.c index 1b63bb28..14bbb605 100644 --- a/libcaja-private/caja-search-engine-beagle.c +++ b/libcaja-private/caja-search-engine-beagle.c @@ -27,8 +27,6 @@ #include <eel/eel-gtk-macros.h> #include <gmodule.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - typedef struct _BeagleHit BeagleHit; typedef struct _BeagleQuery BeagleQuery; typedef struct _BeagleClient BeagleClient; diff --git a/libcaja-private/caja-search-engine-simple.c b/libcaja-private/caja-search-engine-simple.c index dc30dbe8..8a768e50 100644 --- a/libcaja-private/caja-search-engine-simple.c +++ b/libcaja-private/caja-search-engine-simple.c @@ -30,8 +30,6 @@ #include <eel/eel-gtk-macros.h> #include <gio/gio.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - #define BATCH_SIZE 500 typedef struct diff --git a/libcaja-private/caja-search-engine-tracker.c b/libcaja-private/caja-search-engine-tracker.c index edf725c8..5f97a70e 100644 --- a/libcaja-private/caja-search-engine-tracker.c +++ b/libcaja-private/caja-search-engine-tracker.c @@ -27,8 +27,6 @@ #include <gmodule.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - typedef struct _TrackerClient TrackerClient; typedef enum diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c index 16f977f3..1d988cda 100644 --- a/libcaja-private/caja-undostack-manager.c +++ b/libcaja-private/caja-undostack-manager.c @@ -34,8 +34,6 @@ #include <locale.h> #include <gdk/gdk.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - /* ***************************************************************** Private fields ***************************************************************** */ @@ -100,11 +98,7 @@ struct _CajaUndoStackManagerPrivate GQueue *stack; guint undo_levels; guint index; -#if GLIB_CHECK_VERSION(2, 32, 0) GMutex mutex; /* Used to protect access to stack (because of async file ops) */ -#else - GMutex *mutex; /* Used to protect access to stack (because of async file ops) */ -#endif gboolean dispose_has_run; gboolean undo_redo_flag; gboolean confirm_delete; @@ -273,11 +267,7 @@ caja_undostack_manager_init (CajaUndoStackManager * self) /* Initialize private fields */ priv->stack = g_queue_new (); -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_init (&priv->mutex); -#else - priv->mutex = g_mutex_new (); -#endif priv->index = 0; priv->dispose_has_run = FALSE; priv->undo_redo_flag = FALSE; @@ -293,22 +283,13 @@ caja_undostack_manager_dispose (GObject * object) if (priv->dispose_has_run) return; -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_lock (&priv->mutex); -#else - g_mutex_lock (priv->mutex); -#endif /* Free each undoable action in the stack and the stack itself */ undostack_dispose_all (priv->stack); g_queue_free (priv->stack); -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_unlock (&priv->mutex); g_mutex_clear (&priv->mutex); -#else - g_mutex_unlock (priv->mutex); - g_mutex_free (priv->mutex); -#endif priv->dispose_has_run = TRUE; @@ -339,17 +320,9 @@ caja_undostack_manager_set_property (GObject * object, guint prop_id, new_undo_levels = g_value_get_uint (value); if (new_undo_levels > 0 && (priv->undo_levels != new_undo_levels)) { priv->undo_levels = new_undo_levels; -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_lock (&priv->mutex); -#else - g_mutex_lock (priv->mutex); -#endif stack_fix_size (priv); -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_unlock (&priv->mutex); -#else - g_mutex_unlock (priv->mutex); -#endif do_menu_update (manager); } break; @@ -436,12 +409,7 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, char *puri; CajaUndoStackManagerPrivate *priv = manager->priv; -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_lock (&priv->mutex); -#else - g_mutex_lock (priv->mutex); -#endif - CajaUndoStackActionData *action = stack_scroll_left (priv); @@ -450,12 +418,7 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager, action->locked = TRUE; } -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_unlock (&priv->mutex); -#else - g_mutex_unlock (priv->mutex); -#endif - do_menu_update (manager); @@ -585,11 +548,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, char *new_name; CajaUndoStackManagerPrivate *priv = manager->priv; -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_lock (&priv->mutex); -#else - g_mutex_lock (priv->mutex); -#endif CajaUndoStackActionData *action = stack_scroll_right (priv); @@ -597,11 +556,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager, action->locked = TRUE; } -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_unlock (&priv->mutex); -#else - g_mutex_unlock (priv->mutex); -#endif do_menu_update (manager); @@ -757,22 +712,13 @@ caja_undostack_manager_add_action (CajaUndoStackManager * manager, action->manager = manager; -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_lock (&priv->mutex); -#else - g_mutex_lock (priv->mutex); -#endif stack_push_action (priv, action); -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_unlock (&priv->mutex); -#else - g_mutex_unlock (priv->mutex); -#endif do_menu_update (manager); - } static GList * @@ -825,11 +771,7 @@ caja_undostack_manager_trash_has_emptied (CajaUndoStackManager * /* Clear actions from the oldest to the newest move to trash */ -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_lock (&priv->mutex); -#else - g_mutex_lock (priv->mutex); -#endif clear_redo_actions (priv); CajaUndoStackActionData *action = NULL; @@ -855,11 +797,7 @@ caja_undostack_manager_trash_has_emptied (CajaUndoStackManager * } g_queue_free (tmp_stack); -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_unlock (&priv->mutex); -#else - g_mutex_unlock (priv->mutex); -#endif do_menu_update (manager); } @@ -1922,11 +1860,7 @@ do_menu_update (CajaUndoStackManager * manager) CajaUndoStackManagerPrivate *priv = manager->priv; CajaUndoStackMenuData *data = g_slice_new0 (CajaUndoStackMenuData); -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_lock (&priv->mutex); -#else - g_mutex_lock (priv->mutex); -#endif action = get_next_undo_action (priv); data->undo_label = get_undo_label (action); @@ -1937,11 +1871,7 @@ do_menu_update (CajaUndoStackManager * manager) data->redo_label = get_redo_label (action); data->redo_description = get_redo_description (action); -#if GLIB_CHECK_VERSION(2, 32, 0) g_mutex_unlock (&priv->mutex); -#else - g_mutex_unlock (priv->mutex); -#endif /* Update menus */ g_signal_emit_by_name (manager, "request-menu-update", data); diff --git a/src/Makefile.am b/src/Makefile.am index 189c1f5f..37bf1f54 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -162,7 +162,6 @@ caja_SOURCES = \ caja-zoom-action.h \ caja-zoom-control.c \ caja-zoom-control.h \ - glibcompat.h \ $(NULL) nodist_caja_SOURCES = \ diff --git a/src/caja-application.c b/src/caja-application.c index b7199725..02c1c3dc 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -78,8 +78,6 @@ #define MATE_DESKTOP_USE_UNSTABLE_API #include <libmate-desktop/mate-bg.h> -#include "glibcompat.h" /* for g_list_free_full */ - enum { COMMAND_0, /* unused: 0 is an invalid command */ diff --git a/src/caja-bookmark-list.c b/src/caja-bookmark-list.c index 1e7d5c1d..c0976396 100644 --- a/src/caja-bookmark-list.c +++ b/src/caja-bookmark-list.c @@ -35,8 +35,6 @@ #include <gio/gio.h> #include <string.h> -#include "glibcompat.h" /* for g_list_free_full */ - #define MAX_BOOKMARK_LENGTH 80 #define LOAD_JOB 1 #define SAVE_JOB 2 diff --git a/src/caja-convert-metadata.c b/src/caja-convert-metadata.c index d3968abe..2047ace0 100644 --- a/src/caja-convert-metadata.c +++ b/src/caja-convert-metadata.c @@ -338,10 +338,6 @@ main (int argc, char *argv[]) GError *error = NULL; int i; -#if !GLIB_CHECK_VERSION (2, 36, 0) - g_type_init (); -#endif - context = g_option_context_new ("<caja metadata files> - convert caja metadata"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) diff --git a/src/caja-emblem-sidebar.c b/src/caja-emblem-sidebar.c index b1e6ec58..fe254515 100644 --- a/src/caja-emblem-sidebar.c +++ b/src/caja-emblem-sidebar.c @@ -47,8 +47,6 @@ #include <libcaja-private/caja-module.h> #include <libcaja-private/caja-signaller.h> -#include "glibcompat.h" /* for g_list_free_full */ - struct CajaEmblemSidebarDetails { CajaWindowInfo *window; diff --git a/src/caja-history-sidebar.c b/src/caja-history-sidebar.c index 72993d73..c064156f 100644 --- a/src/caja-history-sidebar.c +++ b/src/caja-history-sidebar.c @@ -40,8 +40,6 @@ #include "caja-history-sidebar.h" -#include "glibcompat.h" /* for g_list_free_full */ - #define CAJA_HISTORY_SIDEBAR_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_HISTORY_SIDEBAR, CajaHistorySidebarClass)) #define CAJA_IS_HISTORY_SIDEBAR(obj) \ diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index 6049da98..19e2b01a 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -49,8 +49,6 @@ #include <libcaja-private/caja-sidebar-provider.h> #include <libcaja-private/caja-module.h> -#include "glibcompat.h" /* for g_list_free_full */ - struct CajaInformationPanelDetails { GtkVBox *container; diff --git a/src/caja-main.c b/src/caja-main.c index 7eee311a..1de9fa29 100644 --- a/src/caja-main.c +++ b/src/caja-main.c @@ -389,10 +389,6 @@ main (int argc, char *argv[]) mallopt (M_MMAP_THRESHOLD, 128 *1024); #endif -#if !GLIB_CHECK_VERSION (2, 32, 0) - g_thread_init (NULL); -#endif - #if !GLIB_CHECK_VERSION (2, 42, 0) /* This will be done by gtk+ later, but for now, force it to MATE */ g_desktop_app_info_set_desktop_env ("MATE"); diff --git a/src/caja-navigation-window-slot.c b/src/caja-navigation-window-slot.c index 6c4cfbc6..4b3cb461 100644 --- a/src/caja-navigation-window-slot.c +++ b/src/caja-navigation-window-slot.c @@ -31,8 +31,6 @@ #include <libcaja-private/caja-file.h> #include <eel/eel-gtk-macros.h> -#include "glibcompat.h" /* for g_list_free_full */ - static void caja_navigation_window_slot_init (CajaNavigationWindowSlot *slot); static void caja_navigation_window_slot_class_init (CajaNavigationWindowSlotClass *class); diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c index 1d634db5..0531a992 100644 --- a/src/caja-pathbar.c +++ b/src/caja-pathbar.c @@ -35,8 +35,6 @@ #include "caja-window-private.h" #include "caja-window-slot.h" -#include "glibcompat.h" /* for g_list_free_full */ - #if !GTK_CHECK_VERSION(3,0,0) #define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) #endif diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index 6c7a0e57..6fbc2659 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -53,8 +53,6 @@ #include "caja-places-sidebar.h" #include "caja-window.h" -#include "glibcompat.h" /* for g_list_free_full and g_clear_object */ - #define EJECT_BUTTON_XPAD 6 #define ICON_CELL_XPAD 6 diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index bb9e4058..d1d75f8d 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -55,8 +55,6 @@ #include <libcaja-private/caja-signaller.h> #include <atk/atkrelationset.h> -#include "glibcompat.h" /* for g_list_free_full */ - /* property types */ typedef enum diff --git a/src/caja-query-editor.c b/src/caja-query-editor.c index 324149f5..45201831 100644 --- a/src/caja-query-editor.c +++ b/src/caja-query-editor.c @@ -34,8 +34,6 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include "glibcompat.h" /* for g_list_free_full */ - typedef enum { CAJA_QUERY_EDITOR_ROW_LOCATION, diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c index 45525f33..4c655f64 100644 --- a/src/caja-spatial-window.c +++ b/src/caja-spatial-window.c @@ -62,8 +62,6 @@ #include <libcaja-private/caja-search-engine.h> #include <libcaja-private/caja-signaller.h> -#include "glibcompat.h" /* for g_list_free_full */ - #if !GTK_CHECK_VERSION(3,0,0) #define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) #endif diff --git a/src/caja-trash-bar.c b/src/caja-trash-bar.c index 47cac9df..186c8527 100644 --- a/src/caja-trash-bar.c +++ b/src/caja-trash-bar.c @@ -33,8 +33,6 @@ #include <libcaja-private/caja-file.h> #include <libcaja-private/caja-trash-monitor.h> -#include "glibcompat.h" /* for g_list_free_full */ - #define CAJA_TRASH_BAR_GET_PRIVATE(o)\ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CAJA_TYPE_TRASH_BAR, CajaTrashBarPrivate)) diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c index 09d1ac94..e34f7542 100644 --- a/src/caja-window-manage-views.c +++ b/src/caja-window-manage-views.c @@ -76,8 +76,6 @@ */ #include "caja-desktop-window.h" -#include "glibcompat.h" /* for g_list_free_full */ - /* This number controls a maximum character count for a URL that is * displayed as part of a dialog. It's fairly arbitrary -- big enough * to allow most "normal" URIs to display in full, but small enough to diff --git a/src/caja-window-slot.c b/src/caja-window-slot.c index 0fe2375b..128b52f7 100644 --- a/src/caja-window-slot.c +++ b/src/caja-window-slot.c @@ -33,8 +33,6 @@ #include <eel/eel-gtk-macros.h> #include <eel/eel-string.h> -#include "glibcompat.h" /* for g_list_free_full */ - static void caja_window_slot_init (CajaWindowSlot *slot); static void caja_window_slot_class_init (CajaWindowSlotClass *class); static void caja_window_slot_dispose (GObject *object); diff --git a/src/caja-window.c b/src/caja-window.c index 365c3696..1c0a01c3 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -65,8 +65,6 @@ #include <math.h> #include <sys/time.h> -#include "glibcompat.h" /* for g_list_free_full */ - #define MAX_HISTORY_ITEMS 50 #define EXTRA_VIEW_WIDGETS_BACKGROUND "#a7c6e1" diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 7efa3494..ebf80eb3 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -86,8 +86,6 @@ #define MATE_DESKTOP_USE_UNSTABLE_API #include <libmate-desktop/mate-desktop-utils.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - /* Minimum starting update inverval */ #define UPDATE_INTERVAL_MIN 100 /* Maximum update interval */ @@ -2329,14 +2327,10 @@ fm_directory_view_display_selection_info (FMDirectoryView *view) if (non_folder_size_known) { char *size_string; - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - size_string = g_format_size_full (non_folder_size, G_FORMAT_SIZE_IEC_UNITS); - else - size_string = g_format_size(non_folder_size); - #else - size_string = g_format_size_for_display(non_folder_size); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) + size_string = g_format_size_full (non_folder_size, G_FORMAT_SIZE_IEC_UNITS); + else + size_string = g_format_size(non_folder_size); /* This is marked for translation in case a localiser * needs to use something other than parentheses. The diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c index 1be811f4..6a1692f4 100644 --- a/src/file-manager/fm-list-model.c +++ b/src/file-manager/fm-list-model.c @@ -35,8 +35,6 @@ #include <libcaja-private/caja-dnd.h> #include <glib.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - enum { SUBDIRECTORY_UNLOADED, diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index c92e0c12..626c3836 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -61,8 +61,6 @@ #include <libcaja-private/caja-clipboard.h> #include <libcaja-private/caja-cell-renderer-text-ellipsized.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - struct FMListViewDetails { GtkTreeView *tree_view; diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index c6b59efc..ba305015 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -68,8 +68,6 @@ #include <sys/mount.h> #endif -#include <src/glibcompat.h> /* for g_list_free_full */ - #define USED_FILL_R (0.988235294 * 65535) #define USED_FILL_G (0.91372549 * 65535) #define USED_FILL_B (0.309803922 * 65535) @@ -2321,14 +2319,10 @@ directory_contents_value_field_update (FMPropertiesWindow *window) } else { char *size_str; - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - size_str = g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS); - else - size_str = g_format_size(total_size); - #else - size_str = g_format_size_for_display(total_size); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) + size_str = g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS); + else + size_str = g_format_size(total_size); text = g_strdup_printf (ngettext("%'d item, with size %s", "%'d items, totalling %s", @@ -3147,22 +3141,16 @@ create_pie_widget (FMPropertiesWindow *window) GFile *location; GFileInfo *info; - #if GLIB_CHECK_VERSION(2, 30, 0) - if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) { - capacity = g_format_size_full(window->details->volume_capacity, G_FORMAT_SIZE_IEC_UNITS); - free = g_format_size_full(window->details->volume_free, G_FORMAT_SIZE_IEC_UNITS); - used = g_format_size_full(window->details->volume_capacity - window->details->volume_free, G_FORMAT_SIZE_IEC_UNITS); - } - else { - capacity = g_format_size(window->details->volume_capacity); - free = g_format_size(window->details->volume_free); - used = g_format_size(window->details->volume_capacity - window->details->volume_free); - } - #else - capacity = g_format_size_for_display(window->details->volume_capacity); - free = g_format_size_for_display(window->details->volume_free); - used = g_format_size_for_display(window->details->volume_capacity - window->details->volume_free); - #endif + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) { + capacity = g_format_size_full(window->details->volume_capacity, G_FORMAT_SIZE_IEC_UNITS); + free = g_format_size_full(window->details->volume_free, G_FORMAT_SIZE_IEC_UNITS); + used = g_format_size_full(window->details->volume_capacity - window->details->volume_free, G_FORMAT_SIZE_IEC_UNITS); + } + else { + capacity = g_format_size(window->details->volume_capacity); + free = g_format_size(window->details->volume_free); + used = g_format_size(window->details->volume_capacity - window->details->volume_free); + } file = get_original_file (window); diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c index 604c660e..504dd89a 100644 --- a/src/file-manager/fm-tree-model.c +++ b/src/file-manager/fm-tree-model.c @@ -37,8 +37,6 @@ #include <gtk/gtk.h> #include <string.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - enum { ROW_LOADED, diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c index ab2f1593..f86a0634 100644 --- a/src/file-manager/fm-tree-view.c +++ b/src/file-manager/fm-tree-view.c @@ -55,8 +55,6 @@ #include <libcaja-private/caja-window-info.h> #include <libcaja-private/caja-window-slot-info.h> -#include <src/glibcompat.h> /* for g_list_free_full */ - typedef struct { GObject parent; diff --git a/src/glibcompat.h b/src/glibcompat.h deleted file mode 100644 index 4c71b2b5..00000000 --- a/src/glibcompat.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * glibcompat.h - GLib version-dependent definitions - * - * Copyright (C) 2012 MATE Desktop Project - * - * Caja is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * Caja is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Authors: Jasmine Hassan <[email protected]> - * - */ - -#ifndef GLIB_COMPAT_H -#define GLIB_COMPAT_H - -#include <glib.h> -#include <glib-object.h> - -#if !GLIB_CHECK_VERSION (2, 27, 2) -static inline void -g_list_free_full (GList *list, GDestroyNotify free_func) -{ - g_list_foreach (list, (GFunc) free_func, NULL); - g_list_free (list); -} -#endif - -#if !GLIB_CHECK_VERSION(2,28,0) -static inline void -g_clear_object_inline(volatile GObject **object_ptr) -{ - gpointer * const ptr = (gpointer)object_ptr; - gpointer old; - - do { - old = g_atomic_pointer_get(ptr); - } while G_UNLIKELY(!g_atomic_pointer_compare_and_exchange(ptr, old, NULL)); - - if (old) - g_object_unref(old); -} -#undef g_clear_object -#define g_clear_object(obj) g_clear_object_inline((volatile GObject **)(obj)) -#endif - -#endif /* GLIB_COMPAT_H */ diff --git a/test/test-caja-search-engine.c b/test/test-caja-search-engine.c index 6695f916..8a6f6937 100644 --- a/test/test-caja-search-engine.c +++ b/test/test-caja-search-engine.c @@ -34,10 +34,6 @@ main (int argc, char* argv[]) CajaSearchEngine *engine; CajaQuery *query; -#if !GLIB_CHECK_VERSION (2, 32, 0) - g_thread_init (NULL); -#endif - gtk_init (&argc, &argv); engine = caja_search_engine_new (); diff --git a/test/test-copy.c b/test/test-copy.c index 81407812..b87f3232 100644 --- a/test/test-copy.c +++ b/test/test-copy.c @@ -44,11 +44,7 @@ main (int argc, char* argv[]) int i; GList *infos; CajaProgressInfo *progress_info; - -#if !GLIB_CHECK_VERSION (2, 32, 0) - g_thread_init (NULL); -#endif - + test_init (&argc, &argv); if (argc < 3) { |