Changeset 14115


Ignore:
Timestamp:
Jul 9, 2013, 10:44:24 PM (9 years ago)
Author:
jordan
Message:

use G_DEFINE_QUARK instead of rolling our own quark getters

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-icon.c

    r14107 r14115  
    2222#include "util.h"
    2323
    24 static GQuark
    25 get_core_quark (void)
    26 {
    27   static GQuark quark = 0;
    28 
    29   if (!quark)
    30     quark = g_quark_from_static_string ("tr-core");
    31 
    32   return quark;
    33 }
     24static G_DEFINE_QUARK (tr-core, core)
    3425
    3526#define ICON_NAME "transmission"
     
    7263  const char * idle = _("Idle");
    7364  GtkStatusIcon * icon = GTK_STATUS_ICON (vicon);
    74   tr_session * session = gtr_core_session (g_object_get_qdata (G_OBJECT (icon), get_core_quark ()));
     65  tr_session * session = gtr_core_session (g_object_get_qdata (G_OBJECT (icon), core_quark ()));
    7566
    7667  /* up */
     
    155146  app_indicator_set_menu (indicator, GTK_MENU (w));
    156147  app_indicator_set_title (indicator, g_get_application_name ());
    157   g_object_set_qdata (G_OBJECT (indicator), get_core_quark (), core);
     148  g_object_set_qdata (G_OBJECT (indicator), core_quark (), core);
    158149  return indicator;
    159150#else
     
    162153  g_signal_connect (icon, "activate", G_CALLBACK (activated), NULL);
    163154  g_signal_connect (icon, "popup-menu", G_CALLBACK (popup), NULL);
    164   g_object_set_qdata (G_OBJECT (icon), get_core_quark (), core);
     155  g_object_set_qdata (G_OBJECT (icon), core_quark (), core);
    165156  return icon;
    166157#endif
  • trunk/gtk/tr-window.c

    r14018 r14115  
    6767PrivateData;
    6868
    69 static GQuark
    70 get_private_data_key (void)
    71 {
    72   static GQuark q = 0;
    73 
    74   if (!q)
    75     q = g_quark_from_static_string ("private-data");
    76 
    77   return q;
    78 }
     69static G_DEFINE_QUARK (private-data, private_data)
    7970
    8071static PrivateData*
    8172get_private_data (GtkWindow * w)
    8273{
    83   return g_object_get_qdata (G_OBJECT (w), get_private_data_key ());
     74  return g_object_get_qdata (G_OBJECT (w), private_data_quark ());
    8475}
    8576
     
    621612  /* make the window */
    622613  self = gtk_application_window_new (app);
    623   g_object_set_qdata_full (G_OBJECT (self), get_private_data_key (), p, privateFree);
     614  g_object_set_qdata_full (G_OBJECT (self), private_data_quark (), p, privateFree);
    624615  win = GTK_WINDOW (self);
    625616  gtk_window_set_title (win, g_get_application_name ());
  • trunk/gtk/util.c

    r14077 r14115  
    665665}
    666666
    667 static GQuark
    668 freespace_label_data_quark (void)
    669 {
    670   static GQuark q = 0;
    671 
    672   if (G_UNLIKELY(!q))
    673     q = g_quark_from_static_string ("data");
    674 
    675   return q;
    676 }
     667static G_DEFINE_QUARK (freespace-label-data, freespace_label_data)
    677668
    678669static void
Note: See TracChangeset for help on using the changeset viewer.