[gnome-flashback] desktop: add gf_build_attributes_list



commit 3ac9fcf5d12a1b002528e3c269a47fc73960581c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Nov 1 15:44:20 2019 +0200

    desktop: add gf_build_attributes_list

 gnome-flashback/libdesktop/Makefile.am |  2 ++
 gnome-flashback/libdesktop/gf-utils.c  | 38 ++++++++++++++++++++++++++++++++++
 gnome-flashback/libdesktop/gf-utils.h  | 30 +++++++++++++++++++++++++++
 3 files changed, 70 insertions(+)
---
diff --git a/gnome-flashback/libdesktop/Makefile.am b/gnome-flashback/libdesktop/Makefile.am
index 46f5d01..50da485 100644
--- a/gnome-flashback/libdesktop/Makefile.am
+++ b/gnome-flashback/libdesktop/Makefile.am
@@ -29,6 +29,8 @@ libdesktop_la_SOURCES = \
        gf-icon.h \
        gf-monitor-view.c \
        gf-monitor-view.h \
+       gf-utils.c \
+       gf-utils.h \
        $(BUILT_SOURCES) \
        $(NULL)
 
diff --git a/gnome-flashback/libdesktop/gf-utils.c b/gnome-flashback/libdesktop/gf-utils.c
new file mode 100644
index 0000000..4f0530f
--- /dev/null
+++ b/gnome-flashback/libdesktop/gf-utils.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "gf-utils.h"
+
+char *
+gf_build_attributes_list (const char *first,
+                          ...)
+{
+  GString *attributes;
+  va_list args;
+  const char *attribute;
+
+  attributes = g_string_new (first);
+  va_start (args, first);
+
+  while ((attribute = va_arg (args, const char *)) != NULL)
+    g_string_append_printf (attributes, ",%s", attribute);
+
+  va_end (args);
+
+  return g_string_free (attributes, FALSE);
+}
diff --git a/gnome-flashback/libdesktop/gf-utils.h b/gnome-flashback/libdesktop/gf-utils.h
new file mode 100644
index 0000000..5bb934b
--- /dev/null
+++ b/gnome-flashback/libdesktop/gf-utils.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GF_UTILS_H
+#define GF_UTILS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+char *gf_build_attributes_list (const char *first,
+                                ...);
+
+G_END_DECLS
+
+#endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]