autoreconf
[moonshot-ui.git] / src / moonshot-utils.c
1 /* moonshot-utils.c generated by valac 0.10.4, the Vala compiler
2  * generated from moonshot-utils.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <gtk/gtk.h>
10 #include <gdk-pixbuf/gdk-pixdata.h>
11 #include <stdio.h>
12
13 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
14 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
15
16
17
18 GdkPixbuf* find_icon_sized (const char* name, GtkIconSize icon_size);
19 GdkPixbuf* find_icon (const char* name, gint size);
20
21
22
23 #line 5 "moonshot-utils.vala"
24 GdkPixbuf* find_icon_sized (const char* name, GtkIconSize icon_size) {
25 #line 26 "moonshot-utils.c"
26         GdkPixbuf* result = NULL;
27         gint width = 0;
28         gint height = 0;
29 #line 5 "moonshot-utils.vala"
30         g_return_val_if_fail (name != NULL, NULL);
31 #line 8 "moonshot-utils.vala"
32         gtk_icon_size_lookup (icon_size, &width, &height);
33 #line 34 "moonshot-utils.c"
34         result = find_icon (name, width);
35 #line 9 "moonshot-utils.vala"
36         return result;
37 #line 38 "moonshot-utils.c"
38 }
39
40
41 static gpointer _g_object_ref0 (gpointer self) {
42         return self ? g_object_ref (self) : NULL;
43 }
44
45
46 #line 17 "moonshot-utils.vala"
47 GdkPixbuf* find_icon (const char* name, gint size) {
48 #line 49 "moonshot-utils.c"
49         GdkPixbuf* result = NULL;
50         GError * _inner_error_ = NULL;
51 #line 17 "moonshot-utils.vala"
52         g_return_val_if_fail (name != NULL, NULL);
53 #line 54 "moonshot-utils.c"
54         {
55                 GtkIconTheme* icon_theme;
56                 GdkPixbuf* _tmp0_;
57 #line 33 "moonshot-utils.vala"
58                 icon_theme = _g_object_ref0 (gtk_icon_theme_get_default ());
59 #line 34 "moonshot-utils.vala"
60                 _tmp0_ = gtk_icon_theme_load_icon (icon_theme, name, size, GTK_ICON_LOOKUP_FORCE_SIZE, &_inner_error_);
61 #line 62 "moonshot-utils.c"
62                 if (_inner_error_ != NULL) {
63                         _g_object_unref0 (icon_theme);
64                         goto __catch7_g_error;
65                 }
66                 result = _tmp0_;
67                 _g_object_unref0 (icon_theme);
68 #line 34 "moonshot-utils.vala"
69                 return result;
70 #line 71 "moonshot-utils.c"
71         }
72         goto __finally7;
73         __catch7_g_error:
74         {
75                 GError * e;
76                 e = _inner_error_;
77                 _inner_error_ = NULL;
78                 {
79 #line 39 "moonshot-utils.vala"
80                         fprintf (stdout, "Error loading icon '%s': %s\n", name, e->message);
81 #line 82 "moonshot-utils.c"
82                         result = NULL;
83                         _g_error_free0 (e);
84 #line 40 "moonshot-utils.vala"
85                         return result;
86 #line 87 "moonshot-utils.c"
87                 }
88         }
89         __finally7:
90         {
91                 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
92                 g_clear_error (&_inner_error_);
93                 return NULL;
94         }
95 }
96
97
98
99