ad430e70ab8f2a7f5b8fe9635ca57f6380f776d8
[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 GdkPixbuf* find_icon_sized (const char* name, GtkIconSize icon_size) {
24         GdkPixbuf* result = NULL;
25         gint width = 0;
26         gint height = 0;
27         g_return_val_if_fail (name != NULL, NULL);
28         gtk_icon_size_lookup (icon_size, &width, &height);
29         result = find_icon (name, width);
30         return result;
31 }
32
33
34 static gpointer _g_object_ref0 (gpointer self) {
35         return self ? g_object_ref (self) : NULL;
36 }
37
38
39 GdkPixbuf* find_icon (const char* name, gint size) {
40         GdkPixbuf* result = NULL;
41         GError * _inner_error_ = NULL;
42         g_return_val_if_fail (name != NULL, NULL);
43         {
44                 GtkIconTheme* icon_theme;
45                 GdkPixbuf* _tmp0_;
46                 g_print ("Linux\n");
47                 icon_theme = _g_object_ref0 (gtk_icon_theme_get_default ());
48                 _tmp0_ = gtk_icon_theme_load_icon (icon_theme, name, size, GTK_ICON_LOOKUP_FORCE_SIZE, &_inner_error_);
49                 if (_inner_error_ != NULL) {
50                         _g_object_unref0 (icon_theme);
51                         goto __catch5_g_error;
52                 }
53                 result = _tmp0_;
54                 _g_object_unref0 (icon_theme);
55                 return result;
56         }
57         goto __finally5;
58         __catch5_g_error:
59         {
60                 GError * e;
61                 e = _inner_error_;
62                 _inner_error_ = NULL;
63                 {
64                         fprintf (stdout, "Error loading icon '%s': %s\n", name, e->message);
65                         result = NULL;
66                         _g_error_free0 (e);
67                         return result;
68                 }
69         }
70         __finally5:
71         {
72                 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);
73                 g_clear_error (&_inner_error_);
74                 return NULL;
75         }
76 }
77
78
79
80