Back to index

indicator-appmenu  12.10.0
hud-gtk.c
Go to the documentation of this file.
00001 /* hud-gtk.c generated by valac 0.16.1, the Vala compiler
00002  * generated from hud-gtk.vala, do not modify */
00003 
00004 
00005 #include <glib.h>
00006 #include <glib-object.h>
00007 #include <gtk/gtk.h>
00008 #include <gio/gio.h>
00009 #include <stdlib.h>
00010 #include <string.h>
00011 
00012 
00013 #define HUD_GTK_TYPE_CELL_RENDERER_VARIANT (hud_gtk_cell_renderer_variant_get_type ())
00014 #define HUD_GTK_CELL_RENDERER_VARIANT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HUD_GTK_TYPE_CELL_RENDERER_VARIANT, HudGtkCellRendererVariant))
00015 #define HUD_GTK_CELL_RENDERER_VARIANT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HUD_GTK_TYPE_CELL_RENDERER_VARIANT, HudGtkCellRendererVariantClass))
00016 #define HUD_GTK_IS_CELL_RENDERER_VARIANT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HUD_GTK_TYPE_CELL_RENDERER_VARIANT))
00017 #define HUD_GTK_IS_CELL_RENDERER_VARIANT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HUD_GTK_TYPE_CELL_RENDERER_VARIANT))
00018 #define HUD_GTK_CELL_RENDERER_VARIANT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HUD_GTK_TYPE_CELL_RENDERER_VARIANT, HudGtkCellRendererVariantClass))
00019 
00020 typedef struct _HudGtkCellRendererVariant HudGtkCellRendererVariant;
00021 typedef struct _HudGtkCellRendererVariantClass HudGtkCellRendererVariantClass;
00022 typedef struct _HudGtkCellRendererVariantPrivate HudGtkCellRendererVariantPrivate;
00023 #define _g_free0(var) (var = (g_free (var), NULL))
00024 
00025 #define HUD_GTK_TYPE_WINDOW (hud_gtk_window_get_type ())
00026 #define HUD_GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HUD_GTK_TYPE_WINDOW, HudGtkWindow))
00027 #define HUD_GTK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HUD_GTK_TYPE_WINDOW, HudGtkWindowClass))
00028 #define HUD_GTK_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HUD_GTK_TYPE_WINDOW))
00029 #define HUD_GTK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HUD_GTK_TYPE_WINDOW))
00030 #define HUD_GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HUD_GTK_TYPE_WINDOW, HudGtkWindowClass))
00031 
00032 typedef struct _HudGtkWindow HudGtkWindow;
00033 typedef struct _HudGtkWindowClass HudGtkWindowClass;
00034 typedef struct _HudGtkWindowPrivate HudGtkWindowPrivate;
00035 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00036 #define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
00037 #define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
00038 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
00039 #define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
00040 
00041 #define HUD_GTK_TYPE_APPLICATION (hud_gtk_application_get_type ())
00042 #define HUD_GTK_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HUD_GTK_TYPE_APPLICATION, HudGtkApplication))
00043 #define HUD_GTK_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HUD_GTK_TYPE_APPLICATION, HudGtkApplicationClass))
00044 #define HUD_GTK_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HUD_GTK_TYPE_APPLICATION))
00045 #define HUD_GTK_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HUD_GTK_TYPE_APPLICATION))
00046 #define HUD_GTK_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HUD_GTK_TYPE_APPLICATION, HudGtkApplicationClass))
00047 
00048 typedef struct _HudGtkApplication HudGtkApplication;
00049 typedef struct _HudGtkApplicationClass HudGtkApplicationClass;
00050 typedef struct _HudGtkApplicationPrivate HudGtkApplicationPrivate;
00051 
00052 struct _HudGtkCellRendererVariant {
00053        GtkCellRendererText parent_instance;
00054        HudGtkCellRendererVariantPrivate * priv;
00055 };
00056 
00057 struct _HudGtkCellRendererVariantClass {
00058        GtkCellRendererTextClass parent_class;
00059 };
00060 
00061 struct _HudGtkWindow {
00062        GtkApplicationWindow parent_instance;
00063        HudGtkWindowPrivate * priv;
00064 };
00065 
00066 struct _HudGtkWindowClass {
00067        GtkApplicationWindowClass parent_class;
00068 };
00069 
00070 struct _HudGtkWindowPrivate {
00071        GDBusConnection* session;
00072        GtkListStore* model;
00073        GVariant* query_key;
00074 };
00075 
00076 struct _HudGtkApplication {
00077        GtkApplication parent_instance;
00078        HudGtkApplicationPrivate * priv;
00079 };
00080 
00081 struct _HudGtkApplicationClass {
00082        GtkApplicationClass parent_class;
00083 };
00084 
00085 
00086 static gpointer hud_gtk_cell_renderer_variant_parent_class = NULL;
00087 static gpointer hud_gtk_window_parent_class = NULL;
00088 static gpointer hud_gtk_application_parent_class = NULL;
00089 
00090 GType hud_gtk_cell_renderer_variant_get_type (void) G_GNUC_CONST;
00091 enum  {
00092        HUD_GTK_CELL_RENDERER_VARIANT_DUMMY_PROPERTY,
00093        HUD_GTK_CELL_RENDERER_VARIANT_VALUE
00094 };
00095 HudGtkCellRendererVariant* hud_gtk_cell_renderer_variant_new (void);
00096 HudGtkCellRendererVariant* hud_gtk_cell_renderer_variant_construct (GType object_type);
00097 void hud_gtk_cell_renderer_variant_set_value (HudGtkCellRendererVariant* self, GVariant* value);
00098 static void _vala_hud_gtk_cell_renderer_variant_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
00099 GType hud_gtk_window_get_type (void) G_GNUC_CONST;
00100 #define HUD_GTK_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), HUD_GTK_TYPE_WINDOW, HudGtkWindowPrivate))
00101 enum  {
00102        HUD_GTK_WINDOW_DUMMY_PROPERTY
00103 };
00104 static void hud_gtk_window_populate_model (HudGtkWindow* self, GVariant* update);
00105 static void hud_gtk_window_updated_query (HudGtkWindow* self, GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters);
00106 static void hud_gtk_window_entry_text_changed (HudGtkWindow* self, GObject* object, GParamSpec* pspec);
00107 static void hud_gtk_window_view_activated (HudGtkWindow* self, GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn* column);
00108 HudGtkWindow* hud_gtk_window_new (GtkApplication* application);
00109 HudGtkWindow* hud_gtk_window_construct (GType object_type, GtkApplication* application);
00110 static void _hud_gtk_window_updated_query_gd_bus_signal_callback (GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters, gpointer self);
00111 static void _hud_gtk_window_entry_text_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
00112 static void _hud_gtk_window_view_activated_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self);
00113 static void hud_gtk_window_finalize (GObject* obj);
00114 GType hud_gtk_application_get_type (void) G_GNUC_CONST;
00115 enum  {
00116        HUD_GTK_APPLICATION_DUMMY_PROPERTY
00117 };
00118 static void hud_gtk_application_real_activate (GApplication* base);
00119 HudGtkApplication* hud_gtk_application_new (void);
00120 HudGtkApplication* hud_gtk_application_construct (GType object_type);
00121 gint _vala_main (gchar** args, int args_length1);
00122 
00123 
00124 HudGtkCellRendererVariant* hud_gtk_cell_renderer_variant_construct (GType object_type) {
00125        HudGtkCellRendererVariant * self = NULL;
00126        self = (HudGtkCellRendererVariant*) g_object_new (object_type, NULL);
00127        return self;
00128 }
00129 
00130 
00131 HudGtkCellRendererVariant* hud_gtk_cell_renderer_variant_new (void) {
00132        return hud_gtk_cell_renderer_variant_construct (HUD_GTK_TYPE_CELL_RENDERER_VARIANT);
00133 }
00134 
00135 
00136 void hud_gtk_cell_renderer_variant_set_value (HudGtkCellRendererVariant* self, GVariant* value) {
00137        GVariant* _tmp0_;
00138        g_return_if_fail (self != NULL);
00139        _tmp0_ = value;
00140        if (_tmp0_ != NULL) {
00141               GVariant* _tmp1_;
00142               gchar* _tmp2_ = NULL;
00143               gchar* _tmp3_;
00144               _tmp1_ = value;
00145               _tmp2_ = g_variant_print (_tmp1_, FALSE);
00146               _tmp3_ = _tmp2_;
00147               g_object_set ((GtkCellRendererText*) self, "text", _tmp3_, NULL);
00148               _g_free0 (_tmp3_);
00149        } else {
00150               g_object_set ((GtkCellRendererText*) self, "text", "(null)", NULL);
00151        }
00152        g_object_notify ((GObject *) self, "value");
00153 }
00154 
00155 
00156 static void hud_gtk_cell_renderer_variant_class_init (HudGtkCellRendererVariantClass * klass) {
00157        hud_gtk_cell_renderer_variant_parent_class = g_type_class_peek_parent (klass);
00158        G_OBJECT_CLASS (klass)->set_property = _vala_hud_gtk_cell_renderer_variant_set_property;
00159        g_object_class_install_property (G_OBJECT_CLASS (klass), HUD_GTK_CELL_RENDERER_VARIANT_VALUE, g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE_ANY, NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE));
00160 }
00161 
00162 
00163 static void hud_gtk_cell_renderer_variant_instance_init (HudGtkCellRendererVariant * self) {
00164 }
00165 
00166 
00167 GType hud_gtk_cell_renderer_variant_get_type (void) {
00168        static volatile gsize hud_gtk_cell_renderer_variant_type_id__volatile = 0;
00169        if (g_once_init_enter (&hud_gtk_cell_renderer_variant_type_id__volatile)) {
00170               static const GTypeInfo g_define_type_info = { sizeof (HudGtkCellRendererVariantClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hud_gtk_cell_renderer_variant_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HudGtkCellRendererVariant), 0, (GInstanceInitFunc) hud_gtk_cell_renderer_variant_instance_init, NULL };
00171               GType hud_gtk_cell_renderer_variant_type_id;
00172               hud_gtk_cell_renderer_variant_type_id = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT, "HudGtkCellRendererVariant", &g_define_type_info, 0);
00173               g_once_init_leave (&hud_gtk_cell_renderer_variant_type_id__volatile, hud_gtk_cell_renderer_variant_type_id);
00174        }
00175        return hud_gtk_cell_renderer_variant_type_id__volatile;
00176 }
00177 
00178 
00179 static void _vala_hud_gtk_cell_renderer_variant_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
00180        HudGtkCellRendererVariant * self;
00181        self = HUD_GTK_CELL_RENDERER_VARIANT (object);
00182        switch (property_id) {
00183               case HUD_GTK_CELL_RENDERER_VARIANT_VALUE:
00184               hud_gtk_cell_renderer_variant_set_value (self, g_value_get_variant (value));
00185               break;
00186               default:
00187               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
00188               break;
00189        }
00190 }
00191 
00192 
00193 static void hud_gtk_window_populate_model (HudGtkWindow* self, GVariant* update) {
00194        GVariant* _tmp29_;
00195        GVariant* _tmp30_ = NULL;
00196        g_return_if_fail (self != NULL);
00197        g_return_if_fail (update != NULL);
00198        {
00199               GVariant* _tmp0_;
00200               GVariant* _tmp1_ = NULL;
00201               GVariant* _tmp2_;
00202               GVariantIter* _tmp3_ = NULL;
00203               GVariantIter* _tmp4_;
00204               GVariantIter* _result_it;
00205               GVariant* _result_ = NULL;
00206               _tmp0_ = update;
00207               _tmp1_ = g_variant_get_child_value (_tmp0_, (gsize) 1);
00208               _tmp2_ = _tmp1_;
00209               _tmp3_ = g_variant_iter_new (_tmp2_);
00210               _tmp4_ = _tmp3_;
00211               _g_variant_unref0 (_tmp2_);
00212               _result_it = _tmp4_;
00213               while (TRUE) {
00214                      GVariantIter* _tmp5_;
00215                      GVariant* _tmp6_ = NULL;
00216                      GVariant* _tmp7_;
00217                      GtkTreeIter iter = {0};
00218                      GtkListStore* _tmp8_;
00219                      GtkTreeIter _tmp9_ = {0};
00220                      GtkListStore* _tmp22_;
00221                      GtkTreeIter _tmp23_;
00222                      GVariant* _tmp24_;
00223                      GVariant* _tmp25_ = NULL;
00224                      GVariant* _tmp26_;
00225                      GVariant* _tmp27_ = NULL;
00226                      GVariant* _tmp28_;
00227                      _tmp5_ = _result_it;
00228                      _tmp6_ = g_variant_iter_next_value (_tmp5_);
00229                      _g_variant_unref0 (_result_);
00230                      _result_ = _tmp6_;
00231                      _tmp7_ = _result_;
00232                      if (!(_tmp7_ != NULL)) {
00233                             break;
00234                      }
00235                      _tmp8_ = self->priv->model;
00236                      gtk_list_store_append (_tmp8_, &_tmp9_);
00237                      iter = _tmp9_;
00238                      {
00239                             gint i;
00240                             i = 0;
00241                             {
00242                                    gboolean _tmp10_;
00243                                    _tmp10_ = TRUE;
00244                                    while (TRUE) {
00245                                           gboolean _tmp11_;
00246                                           gint _tmp13_;
00247                                           GtkListStore* _tmp14_;
00248                                           GtkTreeIter _tmp15_;
00249                                           gint _tmp16_;
00250                                           GVariant* _tmp17_;
00251                                           gint _tmp18_;
00252                                           GVariant* _tmp19_ = NULL;
00253                                           GVariant* _tmp20_;
00254                                           const gchar* _tmp21_ = NULL;
00255                                           _tmp11_ = _tmp10_;
00256                                           if (!_tmp11_) {
00257                                                  gint _tmp12_;
00258                                                  _tmp12_ = i;
00259                                                  i = _tmp12_ + 1;
00260                                           }
00261                                           _tmp10_ = FALSE;
00262                                           _tmp13_ = i;
00263                                           if (!(_tmp13_ < 5)) {
00264                                                  break;
00265                                           }
00266                                           _tmp14_ = self->priv->model;
00267                                           _tmp15_ = iter;
00268                                           _tmp16_ = i;
00269                                           _tmp17_ = _result_;
00270                                           _tmp18_ = i;
00271                                           _tmp19_ = g_variant_get_child_value (_tmp17_, (gsize) _tmp18_);
00272                                           _tmp20_ = _tmp19_;
00273                                           _tmp21_ = g_variant_get_string (_tmp20_, NULL);
00274                                           gtk_list_store_set (_tmp14_, &_tmp15_, _tmp16_, _tmp21_, -1);
00275                                           _g_variant_unref0 (_tmp20_);
00276                                    }
00277                             }
00278                      }
00279                      _tmp22_ = self->priv->model;
00280                      _tmp23_ = iter;
00281                      _tmp24_ = _result_;
00282                      _tmp25_ = g_variant_get_child_value (_tmp24_, (gsize) 5);
00283                      _tmp26_ = _tmp25_;
00284                      _tmp27_ = g_variant_get_variant (_tmp26_);
00285                      _tmp28_ = _tmp27_;
00286                      gtk_list_store_set (_tmp22_, &_tmp23_, 5, _tmp28_, -1);
00287                      _g_variant_unref0 (_tmp28_);
00288                      _g_variant_unref0 (_tmp26_);
00289               }
00290               _g_variant_unref0 (_result_);
00291               _g_variant_iter_free0 (_result_it);
00292        }
00293        _tmp29_ = update;
00294        _tmp30_ = g_variant_get_child_value (_tmp29_, (gsize) 2);
00295        _g_variant_unref0 (self->priv->query_key);
00296        self->priv->query_key = _tmp30_;
00297 }
00298 
00299 
00300 static void hud_gtk_window_updated_query (HudGtkWindow* self, GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters) {
00301        gboolean _tmp0_ = FALSE;
00302        GVariant* _tmp1_;
00303        gboolean _tmp7_;
00304        g_return_if_fail (self != NULL);
00305        g_return_if_fail (connection != NULL);
00306        g_return_if_fail (sender_name != NULL);
00307        g_return_if_fail (object_path != NULL);
00308        g_return_if_fail (interface_name != NULL);
00309        g_return_if_fail (signal_name != NULL);
00310        g_return_if_fail (parameters != NULL);
00311        _tmp1_ = self->priv->query_key;
00312        if (_tmp1_ != NULL) {
00313               GVariant* _tmp2_;
00314               GVariant* _tmp3_ = NULL;
00315               GVariant* _tmp4_;
00316               GVariant* _tmp5_;
00317               gboolean _tmp6_ = FALSE;
00318               _tmp2_ = parameters;
00319               _tmp3_ = g_variant_get_child_value (_tmp2_, (gsize) 2);
00320               _tmp4_ = _tmp3_;
00321               _tmp5_ = self->priv->query_key;
00322               _tmp6_ = g_variant_equal (_tmp4_, _tmp5_);
00323               _tmp0_ = _tmp6_;
00324               _g_variant_unref0 (_tmp4_);
00325        } else {
00326               _tmp0_ = FALSE;
00327        }
00328        _tmp7_ = _tmp0_;
00329        if (_tmp7_) {
00330               GtkListStore* _tmp8_;
00331               GVariant* _tmp9_;
00332               _tmp8_ = self->priv->model;
00333               gtk_list_store_clear (_tmp8_);
00334               _tmp9_ = parameters;
00335               hud_gtk_window_populate_model (self, _tmp9_);
00336        }
00337 }
00338 
00339 
00340 static gpointer _g_object_ref0 (gpointer self) {
00341        return self ? g_object_ref (self) : NULL;
00342 }
00343 
00344 
00345 static void hud_gtk_window_entry_text_changed (HudGtkWindow* self, GObject* object, GParamSpec* pspec) {
00346        GObject* _tmp0_;
00347        GtkEntry* _tmp1_;
00348        GtkEntry* entry;
00349        GVariant* _tmp2_;
00350        GtkListStore* _tmp11_;
00351        GtkEntry* _tmp12_;
00352        const gchar* _tmp13_;
00353        const gchar* _tmp14_;
00354        GError * _inner_error_ = NULL;
00355        g_return_if_fail (self != NULL);
00356        g_return_if_fail (object != NULL);
00357        g_return_if_fail (pspec != NULL);
00358        _tmp0_ = object;
00359        _tmp1_ = _g_object_ref0 (GTK_IS_ENTRY (_tmp0_) ? ((GtkEntry*) _tmp0_) : NULL);
00360        entry = _tmp1_;
00361        _tmp2_ = self->priv->query_key;
00362        if (_tmp2_ != NULL) {
00363               {
00364                      GDBusConnection* _tmp3_;
00365                      GVariant* _tmp4_;
00366                      GVariant* _tmp5_;
00367                      GVariant* _tmp6_;
00368                      GVariant* _tmp7_ = NULL;
00369                      GVariant* _tmp8_;
00370                      _tmp3_ = self->priv->session;
00371                      _tmp4_ = self->priv->query_key;
00372                      _tmp5_ = g_variant_new ("(v)", _tmp4_, NULL);
00373                      _tmp6_ = g_variant_ref_sink (_tmp5_);
00374                      _tmp7_ = g_dbus_connection_call_sync (_tmp3_, "com.canonical.hud", "/com/canonical/hud", "com.canonical.hud", "CloseQuery", _tmp6_, NULL, 0, -1, NULL, &_inner_error_);
00375                      _tmp8_ = _tmp7_;
00376                      _g_variant_unref0 (_tmp8_);
00377                      _g_variant_unref0 (_tmp6_);
00378                      if (_inner_error_ != NULL) {
00379                             goto __catch0_g_error;
00380                      }
00381               }
00382               goto __finally0;
00383               __catch0_g_error:
00384               {
00385                      GError* e = NULL;
00386                      GError* _tmp9_;
00387                      const gchar* _tmp10_;
00388                      e = _inner_error_;
00389                      _inner_error_ = NULL;
00390                      _tmp9_ = e;
00391                      _tmp10_ = _tmp9_->message;
00392                      g_warning ("hud-gtk.vala:49: %s", _tmp10_);
00393                      _g_error_free0 (e);
00394               }
00395               __finally0:
00396               if (_inner_error_ != NULL) {
00397                      _g_object_unref0 (entry);
00398                      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);
00399                      g_clear_error (&_inner_error_);
00400                      return;
00401               }
00402        }
00403        _g_variant_unref0 (self->priv->query_key);
00404        self->priv->query_key = NULL;
00405        _tmp11_ = self->priv->model;
00406        gtk_list_store_clear (_tmp11_);
00407        _tmp12_ = entry;
00408        _tmp13_ = gtk_entry_get_text (_tmp12_);
00409        _tmp14_ = _tmp13_;
00410        if (g_strcmp0 (_tmp14_, "") == 0) {
00411               _g_object_unref0 (entry);
00412               return;
00413        }
00414        {
00415               GDBusConnection* _tmp15_ = NULL;
00416               GDBusConnection* session;
00417               GDBusConnection* _tmp16_;
00418               GtkEntry* _tmp17_;
00419               const gchar* _tmp18_;
00420               const gchar* _tmp19_;
00421               GVariant* _tmp20_;
00422               GVariant* _tmp21_;
00423               GVariantType* _tmp22_;
00424               GVariantType* _tmp23_;
00425               GVariant* _tmp24_ = NULL;
00426               GVariant* _tmp25_;
00427               GVariant* reply;
00428               GVariant* _tmp26_;
00429               _tmp15_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error_);
00430               session = _tmp15_;
00431               if (_inner_error_ != NULL) {
00432                      goto __catch1_g_error;
00433               }
00434               _tmp16_ = session;
00435               _tmp17_ = entry;
00436               _tmp18_ = gtk_entry_get_text (_tmp17_);
00437               _tmp19_ = _tmp18_;
00438               _tmp20_ = g_variant_new ("(si)", _tmp19_, 15, NULL);
00439               _tmp21_ = g_variant_ref_sink (_tmp20_);
00440               _tmp22_ = g_variant_type_new ("(sa(sssssv)v)");
00441               _tmp23_ = _tmp22_;
00442               _tmp24_ = g_dbus_connection_call_sync (_tmp16_, "com.canonical.hud", "/com/canonical/hud", "com.canonical.hud", "StartQuery", _tmp21_, _tmp23_, 0, -1, NULL, &_inner_error_);
00443               _tmp25_ = _tmp24_;
00444               _g_variant_type_free0 (_tmp23_);
00445               _g_variant_unref0 (_tmp21_);
00446               reply = _tmp25_;
00447               if (_inner_error_ != NULL) {
00448                      _g_object_unref0 (session);
00449                      goto __catch1_g_error;
00450               }
00451               _tmp26_ = reply;
00452               hud_gtk_window_populate_model (self, _tmp26_);
00453               _g_variant_unref0 (reply);
00454               _g_object_unref0 (session);
00455        }
00456        goto __finally1;
00457        __catch1_g_error:
00458        {
00459               GError* e = NULL;
00460               GError* _tmp27_;
00461               const gchar* _tmp28_;
00462               e = _inner_error_;
00463               _inner_error_ = NULL;
00464               _tmp27_ = e;
00465               _tmp28_ = _tmp27_->message;
00466               g_warning ("hud-gtk.vala:67: %s", _tmp28_);
00467               _g_error_free0 (e);
00468        }
00469        __finally1:
00470        if (_inner_error_ != NULL) {
00471               _g_object_unref0 (entry);
00472               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);
00473               g_clear_error (&_inner_error_);
00474               return;
00475        }
00476        _g_object_unref0 (entry);
00477 }
00478 
00479 
00480 static void hud_gtk_window_view_activated (HudGtkWindow* self, GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn* column) {
00481        GtkTreeIter iter = {0};
00482        GVariant* key = NULL;
00483        GtkListStore* _tmp0_;
00484        GtkTreePath* _tmp1_;
00485        GtkTreeIter _tmp2_ = {0};
00486        GtkListStore* _tmp3_;
00487        GtkTreeIter _tmp4_;
00488        GError * _inner_error_ = NULL;
00489        g_return_if_fail (self != NULL);
00490        g_return_if_fail (view != NULL);
00491        g_return_if_fail (path != NULL);
00492        g_return_if_fail (column != NULL);
00493        _tmp0_ = self->priv->model;
00494        _tmp1_ = path;
00495        gtk_tree_model_get_iter ((GtkTreeModel*) _tmp0_, &_tmp2_, _tmp1_);
00496        iter = _tmp2_;
00497        _tmp3_ = self->priv->model;
00498        _tmp4_ = iter;
00499        gtk_tree_model_get ((GtkTreeModel*) _tmp3_, &_tmp4_, 5, &key, -1);
00500        {
00501               GDBusConnection* _tmp5_;
00502               GVariant* _tmp6_;
00503               GVariant* _tmp7_;
00504               GVariant* _tmp8_ = NULL;
00505               GVariant* _tmp9_;
00506               _tmp5_ = self->priv->session;
00507               _tmp6_ = g_variant_new ("(vu)", key, 0, NULL);
00508               _tmp7_ = g_variant_ref_sink (_tmp6_);
00509               _tmp8_ = g_dbus_connection_call_sync (_tmp5_, "com.canonical.hud", "/com/canonical/hud", "com.canonical.hud", "ExecuteQuery", _tmp7_, NULL, 0, -1, NULL, &_inner_error_);
00510               _tmp9_ = _tmp8_;
00511               _g_variant_unref0 (_tmp9_);
00512               _g_variant_unref0 (_tmp7_);
00513               if (_inner_error_ != NULL) {
00514                      goto __catch2_g_error;
00515               }
00516        }
00517        goto __finally2;
00518        __catch2_g_error:
00519        {
00520               GError* e = NULL;
00521               GError* _tmp10_;
00522               const gchar* _tmp11_;
00523               e = _inner_error_;
00524               _inner_error_ = NULL;
00525               _tmp10_ = e;
00526               _tmp11_ = _tmp10_->message;
00527               g_warning ("hud-gtk.vala:82: %s", _tmp11_);
00528               _g_error_free0 (e);
00529        }
00530        __finally2:
00531        if (_inner_error_ != NULL) {
00532               _g_variant_unref0 (key);
00533               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);
00534               g_clear_error (&_inner_error_);
00535               return;
00536        }
00537        _g_variant_unref0 (key);
00538 }
00539 
00540 
00541 static void _hud_gtk_window_updated_query_gd_bus_signal_callback (GDBusConnection* connection, const gchar* sender_name, const gchar* object_path, const gchar* interface_name, const gchar* signal_name, GVariant* parameters, gpointer self) {
00542        hud_gtk_window_updated_query (self, connection, sender_name, object_path, interface_name, signal_name, parameters);
00543 }
00544 
00545 
00546 static void _hud_gtk_window_entry_text_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
00547        hud_gtk_window_entry_text_changed (self, _sender, pspec);
00548 }
00549 
00550 
00551 static void _hud_gtk_window_view_activated_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self) {
00552        hud_gtk_window_view_activated (self, _sender, path, column);
00553 }
00554 
00555 
00556 HudGtkWindow* hud_gtk_window_construct (GType object_type, GtkApplication* application) {
00557        HudGtkWindow * self = NULL;
00558        GtkApplication* _tmp0_;
00559        GtkBuilder* _tmp1_;
00560        GtkBuilder* builder;
00561        GDBusConnection* _tmp8_;
00562        GtkBuilder* _tmp9_;
00563        GObject* _tmp10_ = NULL;
00564        GtkListStore* _tmp11_;
00565        GtkBuilder* _tmp12_;
00566        GObject* _tmp13_ = NULL;
00567        GtkBuilder* _tmp14_;
00568        GObject* _tmp15_ = NULL;
00569        GtkBuilder* _tmp16_;
00570        GObject* _tmp17_ = NULL;
00571        GError * _inner_error_ = NULL;
00572        g_return_val_if_fail (application != NULL, NULL);
00573        _tmp0_ = application;
00574        self = (HudGtkWindow*) g_object_new (object_type, "application", _tmp0_, "title", "Hud", NULL);
00575        gtk_window_set_default_size ((GtkWindow*) self, 500, 300);
00576        _tmp1_ = gtk_builder_new ();
00577        builder = _tmp1_;
00578        {
00579               HudGtkCellRendererVariant* _tmp2_;
00580               HudGtkCellRendererVariant* _tmp3_;
00581               GDBusConnection* _tmp4_ = NULL;
00582               GDBusConnection* _tmp5_;
00583               GtkBuilder* _tmp6_;
00584               _tmp2_ = hud_gtk_cell_renderer_variant_new ();
00585               _tmp3_ = g_object_ref_sink (_tmp2_);
00586               _g_object_unref0 (_tmp3_);
00587               _tmp4_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error_);
00588               _tmp5_ = _tmp4_;
00589               if (_inner_error_ != NULL) {
00590                      goto __catch3_g_error;
00591               }
00592               _g_object_unref0 (self->priv->session);
00593               self->priv->session = _tmp5_;
00594               _tmp6_ = builder;
00595               gtk_builder_add_from_file (_tmp6_, HUD_GTK_DATADIR "/hud-gtk.ui", &_inner_error_);
00596               if (_inner_error_ != NULL) {
00597                      goto __catch3_g_error;
00598               }
00599        }
00600        goto __finally3;
00601        __catch3_g_error:
00602        {
00603               GError* e = NULL;
00604               const gchar* _tmp7_;
00605               e = _inner_error_;
00606               _inner_error_ = NULL;
00607               _tmp7_ = e->message;
00608               g_error ("hud-gtk.vala:96: %s", _tmp7_);
00609               _g_error_free0 (e);
00610        }
00611        __finally3:
00612        if (_inner_error_ != NULL) {
00613               _g_object_unref0 (builder);
00614               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);
00615               g_clear_error (&_inner_error_);
00616               return NULL;
00617        }
00618        _tmp8_ = self->priv->session;
00619        g_dbus_connection_signal_subscribe (_tmp8_, "com.canonical.hud", "com.canonical.hud", "UpdatedQuery", "/com/canonical/hud", NULL, G_DBUS_SIGNAL_FLAGS_NONE, _hud_gtk_window_updated_query_gd_bus_signal_callback, g_object_ref (self), g_object_unref);
00620        _tmp9_ = builder;
00621        _tmp10_ = gtk_builder_get_object (_tmp9_, "liststore");
00622        _tmp11_ = _g_object_ref0 (GTK_IS_LIST_STORE (_tmp10_) ? ((GtkListStore*) _tmp10_) : NULL);
00623        _g_object_unref0 (self->priv->model);
00624        self->priv->model = _tmp11_;
00625        _tmp12_ = builder;
00626        _tmp13_ = gtk_builder_get_object (_tmp12_, "entry");
00627        g_signal_connect_object (_tmp13_, "notify::text", (GCallback) _hud_gtk_window_entry_text_changed_g_object_notify, self, 0);
00628        _tmp14_ = builder;
00629        _tmp15_ = gtk_builder_get_object (_tmp14_, "treeview");
00630        g_signal_connect_object (GTK_IS_TREE_VIEW (_tmp15_) ? ((GtkTreeView*) _tmp15_) : NULL, "row-activated", (GCallback) _hud_gtk_window_view_activated_gtk_tree_view_row_activated, self, 0);
00631        _tmp16_ = builder;
00632        _tmp17_ = gtk_builder_get_object (_tmp16_, "grid");
00633        gtk_container_add ((GtkContainer*) self, GTK_IS_WIDGET (_tmp17_) ? ((GtkWidget*) _tmp17_) : NULL);
00634        _g_object_unref0 (builder);
00635        return self;
00636 }
00637 
00638 
00639 HudGtkWindow* hud_gtk_window_new (GtkApplication* application) {
00640        return hud_gtk_window_construct (HUD_GTK_TYPE_WINDOW, application);
00641 }
00642 
00643 
00644 static void hud_gtk_window_class_init (HudGtkWindowClass * klass) {
00645        hud_gtk_window_parent_class = g_type_class_peek_parent (klass);
00646        g_type_class_add_private (klass, sizeof (HudGtkWindowPrivate));
00647        G_OBJECT_CLASS (klass)->finalize = hud_gtk_window_finalize;
00648 }
00649 
00650 
00651 static void hud_gtk_window_instance_init (HudGtkWindow * self) {
00652        self->priv = HUD_GTK_WINDOW_GET_PRIVATE (self);
00653 }
00654 
00655 
00656 static void hud_gtk_window_finalize (GObject* obj) {
00657        HudGtkWindow * self;
00658        self = HUD_GTK_WINDOW (obj);
00659        _g_object_unref0 (self->priv->session);
00660        _g_object_unref0 (self->priv->model);
00661        _g_variant_unref0 (self->priv->query_key);
00662        G_OBJECT_CLASS (hud_gtk_window_parent_class)->finalize (obj);
00663 }
00664 
00665 
00666 GType hud_gtk_window_get_type (void) {
00667        static volatile gsize hud_gtk_window_type_id__volatile = 0;
00668        if (g_once_init_enter (&hud_gtk_window_type_id__volatile)) {
00669               static const GTypeInfo g_define_type_info = { sizeof (HudGtkWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hud_gtk_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HudGtkWindow), 0, (GInstanceInitFunc) hud_gtk_window_instance_init, NULL };
00670               GType hud_gtk_window_type_id;
00671               hud_gtk_window_type_id = g_type_register_static (GTK_TYPE_APPLICATION_WINDOW, "HudGtkWindow", &g_define_type_info, 0);
00672               g_once_init_leave (&hud_gtk_window_type_id__volatile, hud_gtk_window_type_id);
00673        }
00674        return hud_gtk_window_type_id__volatile;
00675 }
00676 
00677 
00678 static void hud_gtk_application_real_activate (GApplication* base) {
00679        HudGtkApplication * self;
00680        HudGtkWindow* _tmp0_;
00681        HudGtkWindow* _tmp1_;
00682        self = (HudGtkApplication*) base;
00683        _tmp0_ = hud_gtk_window_new ((GtkApplication*) self);
00684        _tmp1_ = g_object_ref_sink (_tmp0_);
00685        gtk_widget_show_all ((GtkWidget*) _tmp1_);
00686        _g_object_unref0 (_tmp1_);
00687 }
00688 
00689 
00690 HudGtkApplication* hud_gtk_application_construct (GType object_type) {
00691        HudGtkApplication * self = NULL;
00692        self = (HudGtkApplication*) g_object_new (object_type, "application-id", "com.canonical.HudGtk", NULL);
00693        return self;
00694 }
00695 
00696 
00697 HudGtkApplication* hud_gtk_application_new (void) {
00698        return hud_gtk_application_construct (HUD_GTK_TYPE_APPLICATION);
00699 }
00700 
00701 
00702 static void hud_gtk_application_class_init (HudGtkApplicationClass * klass) {
00703        hud_gtk_application_parent_class = g_type_class_peek_parent (klass);
00704        G_APPLICATION_CLASS (klass)->activate = hud_gtk_application_real_activate;
00705 }
00706 
00707 
00708 static void hud_gtk_application_instance_init (HudGtkApplication * self) {
00709 }
00710 
00711 
00712 GType hud_gtk_application_get_type (void) {
00713        static volatile gsize hud_gtk_application_type_id__volatile = 0;
00714        if (g_once_init_enter (&hud_gtk_application_type_id__volatile)) {
00715               static const GTypeInfo g_define_type_info = { sizeof (HudGtkApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hud_gtk_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HudGtkApplication), 0, (GInstanceInitFunc) hud_gtk_application_instance_init, NULL };
00716               GType hud_gtk_application_type_id;
00717               hud_gtk_application_type_id = g_type_register_static (GTK_TYPE_APPLICATION, "HudGtkApplication", &g_define_type_info, 0);
00718               g_once_init_leave (&hud_gtk_application_type_id__volatile, hud_gtk_application_type_id);
00719        }
00720        return hud_gtk_application_type_id__volatile;
00721 }
00722 
00723 
00724 gint _vala_main (gchar** args, int args_length1) {
00725        gint result = 0;
00726        HudGtkApplication* _tmp0_;
00727        HudGtkApplication* _tmp1_;
00728        gchar** _tmp2_;
00729        gint _tmp2__length1;
00730        gint _tmp3_ = 0;
00731        gint _tmp4_;
00732        _tmp0_ = hud_gtk_application_new ();
00733        _tmp1_ = _tmp0_;
00734        _tmp2_ = args;
00735        _tmp2__length1 = args_length1;
00736        _tmp3_ = g_application_run ((GApplication*) _tmp1_, _tmp2__length1, _tmp2_);
00737        _tmp4_ = _tmp3_;
00738        _g_object_unref0 (_tmp1_);
00739        result = _tmp4_;
00740        return result;
00741 }
00742 
00743 
00744 int main (int argc, char ** argv) {
00745        g_type_init ();
00746        return _vala_main (argv, argc);
00747 }
00748 
00749 
00750