about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/common.c7
-rw-r--r--src/common.h6
2 files changed, 12 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c
index be2dd2bf..e54cee6c 100644
--- a/src/common.c
+++ b/src/common.c
@@ -64,7 +64,6 @@ p_utf8_substring(const gchar *str, glong start_pos, glong end_pos)
     return out;
 }
 
-// backwards compatibility for GLib version < 2.28
 void
 p_slist_free_full(GSList *items, GDestroyNotify free_func)
 {
@@ -80,6 +79,12 @@ p_list_free_full(GList *items, GDestroyNotify free_func)
 }
 
 gboolean
+p_hash_table_add(GHashTable *hash_table, gpointer key)
+{
+    return g_hash_table_replace(hash_table, key, key);
+}
+
+gboolean
 create_dir(char *name)
 {
     struct stat sb;
diff --git a/src/common.h b/src/common.h
index 48d6c97e..1c402319 100644
--- a/src/common.h
+++ b/src/common.h
@@ -36,6 +36,10 @@
 #define g_utf8_substring(str, start_pos, end_pos)   p_utf8_substring(str, start_pos, end_pos)
 #endif
 
+#if !GLIB_CHECK_VERSION(2,32,0)
+#define g_hash_table_add(hash_table, key)           p_hash_table_add(hash_table, key)
+#endif
+
 #ifndef NOTIFY_CHECK_VERSION
 #define notify_notification_new(summary, body, icon) notify_notification_new(summary, body, icon, NULL)
 #endif
@@ -74,6 +78,8 @@ typedef enum {
 gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos);
 void p_slist_free_full(GSList *items, GDestroyNotify free_func);
 void p_list_free_full(GList *items, GDestroyNotify free_func);
+gboolean p_hash_table_add(GHashTable *hash_table, gpointer key);
+
 gboolean create_dir(char *name);
 gboolean mkdir_recursive(const char *dir);
 char * str_replace(const char *string, const char *substr,
id='n164' href='#n164'>164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295