Skip to content
This repository has been archived by the owner on Apr 4, 2021. It is now read-only.

Commit

Permalink
since Transmission supports older versions of glib, add a portability…
Browse files Browse the repository at this point in the history
… wrapper for G_DEFINE_QUARK

git-svn-id: svn://svn.transmissionbt.com/Transmission/trunk@14142 f4695dd4-2c0a-0410-b89c-da849a56a58e
  • Loading branch information
jordan committed Jul 24, 2013
1 parent 6f83b10 commit dc00801
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gtk/tr-icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion gtk/tr-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion gtk/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions gtk/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc00801

Please sign in to comment.