diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/local.mk | 1 | ||||
-rw-r--r-- | src/utils/profile-icon.c | 46 | ||||
-rw-r--r-- | src/utils/profile-icon.h | 25 |
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); |