since Transmission supports older versions of glib, add a portability wrapper for G_DEFINE_QUARK

This commit is contained in:
Jordan Lee 2013-07-24 00:13:31 +00:00
parent 20ee16b8cb
commit cc1b1cd430
4 changed files with 20 additions and 3 deletions

View File

@ -21,7 +21,7 @@
#include "tr-icon.h"
#include "util.h"
static G_DEFINE_QUARK (tr_core, core)
static TR_DEFINE_QUARK (tr_core, core)
#define ICON_NAME "transmission"

View File

@ -66,7 +66,7 @@ typedef struct
}
PrivateData;
static G_DEFINE_QUARK (private_data, private_data)
static TR_DEFINE_QUARK (private_data, private_data)
static PrivateData*
get_private_data (GtkWindow * w)

View File

@ -664,7 +664,7 @@ freespace_label_data_free (gpointer gdata)
g_free (data);
}
static G_DEFINE_QUARK (freespace_label_data, freespace_label_data)
static TR_DEFINE_QUARK (freespace_label_data, freespace_label_data)
static void
on_freespace_label_core_destroyed (gpointer gdata, GObject * dead_core G_GNUC_UNUSED)

View File

@ -37,6 +37,23 @@ extern const char * speed_M_str;
extern const char * speed_G_str;
extern const char * speed_T_str;
#if GLIB_CHECK_VERSION(2,33,12)
#define TR_DEFINE_QUARK G_DEFINE_QUARK
#else
#define TR_DEFINE_QUARK(QN, q_n) \
GQuark \
q_n##_quark (void) \
{ \
static GQuark q; \
\
if G_UNLIKELY (q == 0) \
q = g_quark_from_static_string (#QN); \
\
return q; \
}
#endif
/* macro to shut up "unused parameter" warnings */
#ifndef UNUSED
#define UNUSED G_GNUC_UNUSED