1 /* theme.c generated by valac 0.48.6, the Vala compiler
2 * generated from theme.vala, do not modify */
3
4 /*
5 * Notes - panel plugin for Xfce Desktop Environment
6 * Copyright (c) 2006-2013 Mike Massonnet <mmassonnet@xfce.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23 #include <glib-object.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <glib.h>
27 #include <gdk/gdk.h>
28
29 #define XNP_TYPE_THEME (xnp_theme_get_type ())
30 #define XNP_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XNP_TYPE_THEME, XnpTheme))
31 #define XNP_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XNP_TYPE_THEME, XnpThemeClass))
32 #define XNP_IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XNP_TYPE_THEME))
33 #define XNP_IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XNP_TYPE_THEME))
34 #define XNP_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XNP_TYPE_THEME, XnpThemeClass))
35
36 typedef struct _XnpTheme XnpTheme;
37 typedef struct _XnpThemeClass XnpThemeClass;
38 typedef struct _XnpThemePrivate XnpThemePrivate;
39 enum {
40 XNP_THEME_0_PROPERTY,
41 XNP_THEME_NUM_PROPERTIES
42 };
43 static GParamSpec* xnp_theme_properties[XNP_THEME_NUM_PROPERTIES];
44
45 struct _XnpTheme {
46 GObject parent_instance;
47 XnpThemePrivate * priv;
48 };
49
50 struct _XnpThemeClass {
51 GObjectClass parent_class;
52 };
53
54 static gpointer xnp_theme_parent_class = NULL;
55
56 GType xnp_theme_get_type (void) G_GNUC_CONST;
57 G_DEFINE_AUTOPTR_CLEANUP_FUNC (XnpTheme, g_object_unref)
58 void xnp_theme_set_background_color (const gchar* color);
59 void xnp_theme_gtkcss_update_css (GdkColor* color);
60 void xnp_theme_gtkcss_update_style_context (void);
61 XnpTheme* xnp_theme_new (void);
62 XnpTheme* xnp_theme_construct (GType object_type);
63 static GType xnp_theme_get_type_once (void);
64
65 void
xnp_theme_set_background_color(const gchar * color)66 xnp_theme_set_background_color (const gchar* color)
67 {
68 GdkColor gdkcolor = {0};
69 GdkColor _tmp0_ = {0};
70 gboolean _tmp1_;
71 GdkColor _tmp2_;
72 g_return_if_fail (color != NULL);
73 _tmp1_ = gdk_color_parse (color, &_tmp0_);
74 gdkcolor = _tmp0_;
75 if (!_tmp1_) {
76 g_warning ("theme.vala:27: Cannot parse background color %s", color);
77 return;
78 }
79 _tmp2_ = gdkcolor;
80 xnp_theme_gtkcss_update_css (&_tmp2_);
81 xnp_theme_gtkcss_update_style_context ();
82 }
83
84 XnpTheme*
xnp_theme_construct(GType object_type)85 xnp_theme_construct (GType object_type)
86 {
87 XnpTheme * self = NULL;
88 self = (XnpTheme*) g_object_new (object_type, NULL);
89 return self;
90 }
91
92 XnpTheme*
xnp_theme_new(void)93 xnp_theme_new (void)
94 {
95 return xnp_theme_construct (XNP_TYPE_THEME);
96 }
97
98 static void
xnp_theme_class_init(XnpThemeClass * klass,gpointer klass_data)99 xnp_theme_class_init (XnpThemeClass * klass,
100 gpointer klass_data)
101 {
102 xnp_theme_parent_class = g_type_class_peek_parent (klass);
103 }
104
105 static void
xnp_theme_instance_init(XnpTheme * self,gpointer klass)106 xnp_theme_instance_init (XnpTheme * self,
107 gpointer klass)
108 {
109 }
110
111 static GType
xnp_theme_get_type_once(void)112 xnp_theme_get_type_once (void)
113 {
114 static const GTypeInfo g_define_type_info = { sizeof (XnpThemeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xnp_theme_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XnpTheme), 0, (GInstanceInitFunc) xnp_theme_instance_init, NULL };
115 GType xnp_theme_type_id;
116 xnp_theme_type_id = g_type_register_static (G_TYPE_OBJECT, "XnpTheme", &g_define_type_info, 0);
117 return xnp_theme_type_id;
118 }
119
120 GType
xnp_theme_get_type(void)121 xnp_theme_get_type (void)
122 {
123 static volatile gsize xnp_theme_type_id__volatile = 0;
124 if (g_once_init_enter (&xnp_theme_type_id__volatile)) {
125 GType xnp_theme_type_id;
126 xnp_theme_type_id = xnp_theme_get_type_once ();
127 g_once_init_leave (&xnp_theme_type_id__volatile, xnp_theme_type_id);
128 }
129 return xnp_theme_type_id__volatile;
130 }
131
132