since Transmission supports older versions of glib, add a portability wrapper for G_DEFINE_QUARK
This commit is contained in:
parent
20ee16b8cb
commit
cc1b1cd430
|
@ -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"
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
17
gtk/util.h
17
gtk/util.h
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue