163
163
Configuration* configuration_construct (GType object_type, const char* config_file_path);
164
164
char* configuration_get_value (Configuration* self, const char* group, const char* key);
165
165
void configuration_set_key_value (Configuration* self, const char* group, const char* key, const char* val);
166
gboolean configuration_get_boolean_value (Configuration* self, const char* group, const char* key);
166
167
GQuark config_error_quark (void);
167
168
void configuration_save_config (Configuration* self, GError** error);
168
169
static void main_controller_status_icon_menu (main_controller* self, guint button, guint time);
336
336
configuration_set_key_value (self->priv->config, "colors", "text", self->priv->color_text);
337
337
color_changed = TRUE;
339
text_mode = configuration_get_value (self->priv->config, "mode", "text");
340
if (text_mode != NULL) {
341
self->priv->text_mode = (gboolean) text_mode;
339
self->priv->text_mode = configuration_get_boolean_value (self->priv->config, "mode", "text");
340
if (self->priv->text_mode) {
343
342
configuration_set_key_value (self->priv->config, "mode", "text", "false");
849
840
frect_color = (_tmp3_ = g_strdup (self->priv->color_draining), _g_free0 (frect_color), _tmp3_);
852
svg_str = (_tmp4_ = g_strdup ("<?xml version=\"1.0\" standalone=\"no\"?>\n" \
853
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/G" \
854
"raphics/SVG/1.1/DTD/svg11.dtd\">\n" \
855
"<svg width=\"100px\" height=\"100px\" version=\"1.1\" xmlns=\"http://w" \
856
"ww.w3.org/2000/svg\">\n"), _g_free0 (svg_str), _tmp4_);
843
svg_str = (_tmp4_ = g_strdup ("<?xml version=\"1.0\" standalone=\"no\"?><!DOCTYPE svg PUBLIC \"-//W3C" \
844
"//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" \
845
"\">\n"), _g_free0 (svg_str), _tmp4_);
846
svg_str = (_tmp5_ = g_strconcat (svg_str, "<svg width=\"100px\" height=\"100px\" viewbox=\"0 0 200 200\" preserve" \
847
"AspectRatio=\"meet\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/sv" \
848
"g\">\n", NULL), _g_free0 (svg_str), _tmp5_);
857
849
if (self->priv->text_mode) {
860
svg_str = (_tmp6_ = g_strconcat (svg_str, _tmp5_ = g_strdup_printf (" <text x = \"0\" y = \"65\" fill = \"%s\" font-size = \"50\">%d%</text" \
861
">", frect_color, self->priv->bat_percent), NULL), _g_free0 (svg_str), _tmp6_);
852
svg_str = (_tmp7_ = g_strconcat (svg_str, _tmp6_ = g_strdup_printf (" <text style=\"text-align:center;\" x=\"0\" y=\"65\" fill=\"%s\" font-" \
853
"size = \"40\">%d%</text>", frect_color, self->priv->bat_percent), NULL), _g_free0 (svg_str), _tmp7_);
868
svg_str = (_tmp8_ = g_strconcat (svg_str, _tmp7_ = g_strdup_printf ("<rect x=\"%.0f\" y=\"0\" width=\"%.0fpx\" height=\"100px\" fill=\"%s\"" \
869
" stroke=\"%s\" stroke-width=\"%i\" />\n", brect_x, brect_width, self->priv->color_background, self->priv->color_border, border_width), NULL), _g_free0 (svg_str), _tmp8_);
860
svg_str = (_tmp9_ = g_strconcat (svg_str, _tmp8_ = g_strdup_printf ("<rect x=\"%.0f\" y=\"0\" width=\"%.0fpx\" height=\"100px\" fill=\"%s\"" \
861
" stroke=\"%s\" stroke-width=\"%i\" />\n", brect_x, brect_width, self->priv->color_background, self->priv->color_border, border_width), NULL), _g_free0 (svg_str), _tmp9_);
871
863
frect_height = (double) (self->priv->bat_percent - (border_width * 2));
872
864
frect_y = 100 - (frect_height + (border_width / 2));
873
svg_str = (_tmp10_ = g_strconcat (svg_str, _tmp9_ = g_strdup_printf ("<rect x=\"%.0f\" y=\"%0.1f\" width=\"48px\" height=\"%0.1fpx\" fill=\"" \
874
"%s\" stroke-width=\"0\" />\n", frect_x, frect_y, frect_height, frect_color), NULL), _g_free0 (svg_str), _tmp10_);
865
svg_str = (_tmp11_ = g_strconcat (svg_str, _tmp10_ = g_strdup_printf ("<rect x=\"%.0f\" y=\"%0.1f\" width=\"48px\" height=\"%0.1fpx\" fill=\"" \
866
"%s\" stroke-width=\"0\" />\n", frect_x, frect_y, frect_height, frect_color), NULL), _g_free0 (svg_str), _tmp11_);
877
svg_str = (_tmp11_ = g_strconcat (svg_str, "</svg>\n", NULL), _g_free0 (svg_str), _tmp11_);
878
svg_data = (_tmp13_ = g_new0 (guchar, _tmp12_ = string_get_length (svg_str)), svg_data_length1 = _tmp12_, _svg_data_size_ = svg_data_length1, _tmp13_);
869
svg_str = (_tmp12_ = g_strconcat (svg_str, "</svg>\n", NULL), _g_free0 (svg_str), _tmp12_);
870
svg_data = (_tmp14_ = g_new0 (guchar, _tmp13_ = string_get_length (svg_str)), svg_data_length1 = _tmp13_, _svg_data_size_ = svg_data_length1, _tmp14_);
890
882
if (!(i < string_get_length (svg_str))) {
898
GdkPixbufLoader* _tmp15_;
899
890
GdkPixbufLoader* _tmp16_;
902
_tmp15_ = gdk_pixbuf_loader_new_with_type ("svg", &_inner_error_);
891
GdkPixbufLoader* _tmp17_;
894
_tmp16_ = gdk_pixbuf_loader_new_with_type ("svg", &_inner_error_);
903
895
if (_inner_error_ != NULL) {
904
896
goto __catch5_g_error;
906
ploader = (_tmp16_ = _tmp15_, _g_object_unref0 (ploader), _tmp16_);
898
ploader = (_tmp17_ = _tmp16_, _g_object_unref0 (ploader), _tmp17_);
907
899
gdk_pixbuf_loader_write (ploader, svg_data, (gsize) string_get_length (svg_str), &_inner_error_);
908
900
if (_inner_error_ != NULL) {
909
901
goto __catch5_g_error;
912
904
if (_inner_error_ != NULL) {
913
905
goto __catch5_g_error;
915
pb = (_tmp17_ = _g_object_ref0 (gdk_pixbuf_loader_get_pixbuf (ploader)), _g_object_unref0 (pb), _tmp17_);
907
pb = (_tmp18_ = _g_object_ref0 (gdk_pixbuf_loader_get_pixbuf (ploader)), _g_object_unref0 (pb), _tmp18_);
916
908
gtk_status_icon_set_from_pixbuf (self->priv->si, pb);
917
main_controller_set_tooltip_text (self, _tmp18_ = g_strdup_printf ("%i%%", self->priv->bat_percent));
909
main_controller_set_tooltip_text (self, _tmp19_ = g_strdup_printf ("%i%%", self->priv->bat_percent));
921
913
__catch5_g_error: