summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-03 12:38:09 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-03 12:38:09 (EDT)
commit9bc91995f647eccec8e6758723e1f700877fc3f7 (patch)
tree3b96a1853724be71e598585228f94295754b9cdc
parente3a5279794fd990b372b03c0e482659f20e2a9f2 (diff)
downloadmarquee-9bc91995f647eccec8e6758723e1f700877fc3f7.zip
marquee-9bc91995f647eccec8e6758723e1f700877fc3f7.tar.gz
marquee-9bc91995f647eccec8e6758723e1f700877fc3f7.tar.bz2
src/utils/profile-icon.[ch]: New files
-rw-r--r--src/utils/local.mk1
-rw-r--r--src/utils/profile-icon.c46
-rw-r--r--src/utils/profile-icon.h25
3 files changed, 72 insertions, 0 deletions
diff --git a/src/utils/local.mk b/src/utils/local.mk
index 02c0970..5b7028e 100644
--- a/src/utils/local.mk
+++ b/src/utils/local.mk
@@ -1,5 +1,6 @@
marquee_SOURCES += \
%reldir%/html.c \
+ %reldir%/profile-icon.c \
%reldir%/resources.c \
%reldir%/string.c \
%reldir%/svg.c
diff --git a/src/utils/profile-icon.c b/src/utils/profile-icon.c
new file mode 100644
index 0000000..20451fa
--- /dev/null
+++ b/src/utils/profile-icon.c
@@ -0,0 +1,46 @@
+/*
+ * Profile icon
+ *
+ * Copyright (C) 2017 Patrick McDermott
+ *
+ * This file is part of Marquee.
+ *
+ * Marquee 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.
+ *
+ * Marquee 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 Marquee. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "profile-icon.h"
+
+#include <glib.h>
+
+#include "svg.h"
+
+static const gchar *profile_svg =
+ "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" "
+ "viewBox=\"0, 0, 16, 16\">\n"
+ "<rect x=\"1\" y=\"9\" width=\"14\" height=\"7\" "
+ "rx=\"2\" ry=\"2\" fill=\"@COLOR@\" />\n"
+ "<ellipse cx=\"8\" cy=\"11\" rx=\"7\" ry=\"4\" "
+ "fill=\"@COLOR@\" />\n"
+ "<circle cx=\"8\" cy=\"4\" r=\"4\" fill=\"@COLOR@\" />\n"
+ "</svg>\n";
+
+gchar *
+mq_profile_icon_new(const gchar *color)
+{
+ if (!mq_svg_is_color_valid(color)) {
+ color = "#ff0000";
+ }
+
+ return mq_svg_set_color(profile_svg, color);
+}
diff --git a/src/utils/profile-icon.h b/src/utils/profile-icon.h
new file mode 100644
index 0000000..806a0b9
--- /dev/null
+++ b/src/utils/profile-icon.h
@@ -0,0 +1,25 @@
+/*
+ * Profile icon
+ *
+ * Copyright (C) 2017 Patrick McDermott
+ *
+ * This file is part of Marquee.
+ *
+ * Marquee 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.
+ *
+ * Marquee 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 Marquee. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib.h>
+
+gchar *
+mq_profile_icon_new(const gchar *color);