/* gui.c generated by valac, the Vala compiler * generated from gui.vala, do not modify */ #include #include #include #include #include #include #include #include #include #include #include #define TYPE_MAIN_WINDOW (main_window_get_type ()) #define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow)) #define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass)) #define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW)) #define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW)) #define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass)) typedef struct _MainWindow MainWindow; typedef struct _MainWindowClass MainWindowClass; typedef struct _MainWindowPrivate MainWindowPrivate; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) struct _MainWindow { GtkWindow parent_instance; MainWindowPrivate * priv; }; struct _MainWindowClass { GtkWindowClass parent_class; }; struct _MainWindowPrivate { GtkTreeView* tv; GtkProgressBar* pb; GtkAboutDialog* aboutdialog1; }; static struct squeue_t* main_window_q; static struct squeue_t* main_window_q = NULL; static struct squeue_t* main_window_p; static struct squeue_t* main_window_p = NULL; static MainWindow* main_window_viewer; static MainWindow* main_window_viewer = NULL; static gpointer main_window_parent_class = NULL; GType main_window_get_type (void); #define MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MAIN_WINDOW, MainWindowPrivate)) enum { MAIN_WINDOW_DUMMY_PROPERTY }; static void main_window_doCloseApplication (MainWindow* self); static void main_window_OnReset (MainWindow* self); gboolean main_window_showYesNo (MainWindow* self, const char* s); void main_window_showMessage (MainWindow* self, const char* s, GtkMessageType mt); static void main_window_OnFileFlashEvent (MainWindow* self); void main_window_add_file (MainWindow* self, const char* type, const char* size, const char* file); static void main_window_OnFileOpenEvent (MainWindow* self); void main_window_showError (MainWindow* self, const char* s); gboolean main_window_loadFile (MainWindow* self, const char* filename); static void main_window_OnMenuHelpAboutActivatedEvent (MainWindow* self); void main_window_list_clear (MainWindow* self); static void main_window_OnFileNewEvent (MainWindow* self); static void main_window_OnQuitEvent (MainWindow* self); void main_window_list_del (MainWindow* self); void main_window_setup_treeview (GtkTreeView* view); gboolean main_window_readFunc (void); void main_window_msg (MainWindow* self, const char* str); static void main_window_OnGetInformation (MainWindow* self); static void main_window_OnStop (MainWindow* self); static void main_window_OnConnect (MainWindow* self); static gboolean main_window_chk_queues (MainWindow* self); MainWindow* main_window_new (void); MainWindow* main_window_construct (GType object_type); static gboolean _lambda0_ (MainWindow* x, GdkEvent* y); static gboolean __lambda0__gtk_widget_delete_event (MainWindow* _sender, GdkEvent* event, gpointer self); static gint main_window_main (char** args, int args_length1); static void _main_window_OnFileNewEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnFileOpenEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnQuitEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnConnect_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnStop_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnGetInformation_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnReset_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnMenuHelpAboutActivatedEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self); static void _main_window_OnConnect_gtk_button_clicked (GtkButton* _sender, gpointer self); static void _main_window_OnStop_gtk_button_clicked (GtkButton* _sender, gpointer self); static void _main_window_OnGetInformation_gtk_button_clicked (GtkButton* _sender, gpointer self); static void _main_window_OnFileOpenEvent_gtk_button_clicked (GtkButton* _sender, gpointer self); static void _main_window_list_del_gtk_button_clicked (GtkButton* _sender, gpointer self); static void _main_window_OnFileFlashEvent_gtk_button_clicked (GtkButton* _sender, gpointer self); static gboolean _gtk_widget_hide_on_delete_gtk_widget_delete_event (GtkAboutDialog* _sender, GdkEvent* event, gpointer self); static GObject * main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void main_window_finalize (GObject* obj); static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); static gint _vala_array_length (gpointer array); static void main_window_doCloseApplication (MainWindow* self) { g_return_if_fail (self != NULL); gtk_main_quit (); } static void main_window_OnReset (MainWindow* self) { g_return_if_fail (self != NULL); squeue_push (main_window_q, "reset:device", 1); } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } static void main_window_OnFileFlashEvent (MainWindow* self) { GtkListStore* ls; const char* str; GtkTreeIter iter = {0}; gint n; g_return_if_fail (self != NULL); ls = _g_object_ref0 (GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tv))); str = NULL; n = gtk_tree_model_iter_n_children ((GtkTreeModel*) ls, NULL); if (n > 0) { if (main_window_showYesNo (self, "Do you want to flash these files?")) { gtk_tree_model_get_iter_first ((GtkTreeModel*) ls, &iter); { gboolean _tmp0_; _tmp0_ = TRUE; while (TRUE) { if (!_tmp0_) { if (!gtk_tree_model_iter_next ((GtkTreeModel*) ls, &iter)) { break; } } _tmp0_ = FALSE; gtk_tree_model_get ((GtkTreeModel*) ls, &iter, 2, &str, -1, -1); squeue_push2 (main_window_q, "flash", str, 1); } } } } else { main_window_showMessage (self, "No files selected", GTK_MESSAGE_ERROR); } _g_object_unref0 (ls); } static void main_window_OnFileOpenEvent (MainWindow* self) { GtkFileChooserDialog* fc; gint resp; g_return_if_fail (self != NULL); fc = g_object_ref_sink ((GtkFileChooserDialog*) gtk_file_chooser_dialog_new ("Select file to open", (GtkWindow*) self, GTK_FILE_CHOOSER_ACTION_OPEN, "gtk-cancel", GTK_RESPONSE_CANCEL, "gtk-open", GTK_RESPONSE_ACCEPT, NULL)); resp = gtk_dialog_run ((GtkDialog*) fc); gtk_widget_hide ((GtkWidget*) fc); if (resp == GTK_RESPONSE_ACCEPT) { char* file; const char* type; char* size; file = gtk_file_chooser_get_filename ((GtkFileChooser*) fc); type = fpid_file (file); size = g_strdup_printf ("%ld", fpid_size (file)); if (type == NULL) { main_window_showMessage (self, "Invalid file type", GTK_MESSAGE_ERROR); } else { main_window_add_file (self, type, size, file); } _g_free0 (file); _g_free0 (size); } gtk_object_destroy ((GtkObject*) fc); _g_object_unref0 (fc); } gboolean main_window_loadFile (MainWindow* self, const char* filename) { gboolean result; GError * _inner_error_; gint err; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE); _inner_error_ = NULL; err = 0; { char* contents; gsize length = 0UL; char* _tmp2_; gboolean _tmp1_; char* _tmp0_ = NULL; contents = NULL; _tmp1_ = g_file_get_contents (filename, &_tmp0_, &length, &_inner_error_); contents = (_tmp2_ = _tmp0_, _g_free0 (contents), _tmp2_); _tmp1_; if (_inner_error_ != NULL) { _g_free0 (contents); goto __catch0_g_error; goto __finally0; } _g_free0 (contents); } goto __finally0; __catch0_g_error: { GError * e; e = _inner_error_; _inner_error_ = NULL; { char* _tmp3_; main_window_showError (self, _tmp3_ = g_strconcat ("Unexpected error while loading the file, please contact the author with the following information:\n\n", e->message, NULL)); _g_free0 (_tmp3_); err++; _g_error_free0 (e); } } __finally0: if (_inner_error_ != NULL) { 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); g_clear_error (&_inner_error_); return FALSE; } result = err == 0; return result; } gboolean main_window_showYesNo (MainWindow* self, const char* s) { gboolean result; GtkMessageDialog* md; gint ret; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (s != NULL, FALSE); md = g_object_ref_sink ((GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, s)); ret = gtk_dialog_run ((GtkDialog*) md); gtk_object_destroy ((GtkObject*) md); result = ret == GTK_RESPONSE_YES; _g_object_unref0 (md); return result; } void main_window_showMessage (MainWindow* self, const char* s, GtkMessageType mt) { GtkMessageDialog* md; g_return_if_fail (self != NULL); g_return_if_fail (s != NULL); md = g_object_ref_sink ((GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_DESTROY_WITH_PARENT, mt, GTK_BUTTONS_CLOSE, s)); gtk_dialog_run ((GtkDialog*) md); gtk_object_destroy ((GtkObject*) md); _g_object_unref0 (md); } static void main_window_OnMenuHelpAboutActivatedEvent (MainWindow* self) { g_return_if_fail (self != NULL); gtk_window_set_transient_for ((GtkWindow*) self->priv->aboutdialog1, (GtkWindow*) self); gtk_dialog_run ((GtkDialog*) self->priv->aboutdialog1); } void main_window_showError (MainWindow* self, const char* s) { GtkMessageDialog* md; g_return_if_fail (self != NULL); g_return_if_fail (s != NULL); md = g_object_ref_sink ((GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, s)); gtk_dialog_run ((GtkDialog*) md); gtk_object_destroy ((GtkObject*) md); _g_object_unref0 (md); } static void main_window_OnFileNewEvent (MainWindow* self) { g_return_if_fail (self != NULL); main_window_list_clear (self); } static void main_window_OnQuitEvent (MainWindow* self) { g_return_if_fail (self != NULL); main_window_doCloseApplication (self); } void main_window_list_clear (MainWindow* self) { g_return_if_fail (self != NULL); gtk_list_store_clear (GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tv))); } void main_window_list_del (MainWindow* self) { GtkTreeIter iter = {0}; GtkTreeModel* model; GtkTreeSelection* sel; g_return_if_fail (self != NULL); model = NULL; sel = _g_object_ref0 (gtk_tree_view_get_selection (self->priv->tv)); if (gtk_tree_selection_count_selected_rows (sel) == 1) { GtkTreeModel* _tmp2_; gboolean _tmp1_; GtkTreeModel* _tmp0_ = NULL; _tmp1_ = gtk_tree_selection_get_selected (sel, &_tmp0_, &iter); model = (_tmp2_ = _g_object_ref0 (_tmp0_), _g_object_unref0 (model), _tmp2_); _tmp1_; gtk_list_store_remove (GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tv)), &iter); } _g_object_unref0 (model); _g_object_unref0 (sel); } void main_window_add_file (MainWindow* self, const char* type, const char* size, const char* file) { GtkListStore* listmodel; GtkTreeIter iter = {0}; g_return_if_fail (self != NULL); g_return_if_fail (type != NULL); g_return_if_fail (size != NULL); g_return_if_fail (file != NULL); listmodel = _g_object_ref0 (GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tv))); gtk_list_store_append (listmodel, &iter); gtk_list_store_set (listmodel, &iter, 0, type, 1, size, 2, file, -1, -1); _g_object_unref0 (listmodel); } void main_window_setup_treeview (GtkTreeView* view) { GtkListStore* listmodel; GtkCellRendererText* _tmp0_; GtkCellRendererText* _tmp1_; GtkCellRendererText* cell; g_return_if_fail (view != NULL); listmodel = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, NULL); gtk_tree_view_set_model (view, (GtkTreeModel*) listmodel); gtk_tree_view_insert_column_with_attributes (view, -1, "Type", (GtkCellRenderer*) (_tmp0_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ())), "text", 0, NULL, NULL); _g_object_unref0 (_tmp0_); gtk_tree_view_insert_column_with_attributes (view, -1, "Size", (GtkCellRenderer*) (_tmp1_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ())), "text", 1, NULL, NULL); _g_object_unref0 (_tmp1_); cell = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ()); g_object_set ((GObject*) cell, "foreground_set", TRUE, NULL, NULL); gtk_tree_view_insert_column_with_attributes (view, -1, "Name", (GtkCellRenderer*) cell, "text", 2, "foreground", 3, NULL, NULL); _g_object_unref0 (listmodel); _g_object_unref0 (cell); } gboolean main_window_readFunc (void) { gboolean result; const char* msg; gboolean _tmp0_ = FALSE; msg = squeue_get (main_window_p, 0); if (msg != NULL) { _tmp0_ = g_utf8_get_char (g_utf8_offset_to_pointer (msg, 0)) != '\0'; } else { _tmp0_ = FALSE; } if (_tmp0_) { char** _tmp2_; gint foo_size; gint foo_length1; char** _tmp1_; char** foo; fprintf (stdout, "[<] msg received: %s\n", msg); foo = (_tmp2_ = _tmp1_ = g_strsplit (msg, ":", 2), foo_length1 = _vala_array_length (_tmp1_), foo_size = foo_length1, _tmp2_); if (foo[1] != NULL) { GQuark _tmp5_; const char* _tmp4_; static GQuark _tmp5__label0 = 0; static GQuark _tmp5__label1 = 0; static GQuark _tmp5__label2 = 0; _tmp4_ = foo[0]; _tmp5_ = (NULL == _tmp4_) ? 0 : g_quark_from_string (_tmp4_); if (_tmp5_ == ((0 != _tmp5__label0) ? _tmp5__label0 : (_tmp5__label0 = g_quark_from_static_string ("bar")))) do { char* _tmp3_; gtk_progress_bar_set_fraction (main_window_viewer->priv->pb, (double) (atoi (foo[1]) / 100)); gtk_progress_bar_set_text (main_window_viewer->priv->pb, _tmp3_ = g_strconcat (foo[1], "%", NULL)); _g_free0 (_tmp3_); break; } while (0); else if (_tmp5_ == ((0 != _tmp5__label1) ? _tmp5__label1 : (_tmp5__label1 = g_quark_from_static_string ("error")))) do { main_window_showMessage (main_window_viewer, foo[1], GTK_MESSAGE_ERROR); break; } while (0); else if (_tmp5_ == ((0 != _tmp5__label2) ? _tmp5__label2 : (_tmp5__label2 = g_quark_from_static_string ("info")))) do { main_window_showMessage (main_window_viewer, foo[1], GTK_MESSAGE_INFO); break; } while (0); else do { fprintf (stderr, "[E] Unknown message type\n"); break; } while (0); } squeue_pop (main_window_p); foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL); } result = TRUE; return result; } static void main_window_OnGetInformation (MainWindow* self) { g_return_if_fail (self != NULL); main_window_msg (self, "info:device"); } static void main_window_OnConnect (MainWindow* self) { g_return_if_fail (self != NULL); main_window_OnStop (self); system ("sudo 0xFFFF -Q &"); squeue_close (main_window_p); squeue_close (main_window_q); main_window_p = main_window_q = NULL; } static void main_window_OnStop (MainWindow* self) { g_return_if_fail (self != NULL); system ("sudo pkill 0xFFFF"); } static gboolean main_window_chk_queues (MainWindow* self) { gboolean result; gboolean _tmp0_ = FALSE; g_return_val_if_fail (self != NULL, FALSE); if (main_window_p == NULL) { main_window_p = squeue_open ("/tmp/0xFFFF.1", (gint) Q_OPEN); } if (main_window_q == NULL) { main_window_q = squeue_open ("/tmp/0xFFFF.2", (gint) Q_OPEN); } if (main_window_p == NULL) { _tmp0_ = TRUE; } else { _tmp0_ = main_window_q == NULL; } if (_tmp0_) { main_window_showMessage (self, "Cannot connect to queues", GTK_MESSAGE_ERROR); result = FALSE; return result; } result = TRUE; return result; } void main_window_msg (MainWindow* self, const char* str) { g_return_if_fail (self != NULL); g_return_if_fail (str != NULL); if (!main_window_chk_queues (self)) { return; } if (squeue_push (main_window_q, str, 0) < 1) { fprintf (stderr, "Oops on push\n"); squeue_free (main_window_q); main_window_q = NULL; squeue_free (main_window_p); main_window_p = NULL; } } static gboolean _lambda0_ (MainWindow* x, GdkEvent* y) { gboolean result; g_return_val_if_fail (x != NULL, FALSE); g_return_val_if_fail (y != NULL, FALSE); gtk_main_quit (); } static gboolean __lambda0__gtk_widget_delete_event (MainWindow* _sender, GdkEvent* event, gpointer self) { return _lambda0_ (_sender, event); } static gint main_window_main (char** args, int args_length1) { gint result; MainWindow* _tmp0_; gtk_init (&args_length1, &args); main_window_viewer = (_tmp0_ = g_object_ref_sink (main_window_new ()), _g_object_unref0 (main_window_viewer), _tmp0_); if (args_length1 > 1) { main_window_loadFile (main_window_viewer, args[1]); } gtk_window_resize ((GtkWindow*) main_window_viewer, 600, 400); gtk_window_set_position ((GtkWindow*) main_window_viewer, GTK_WIN_POS_CENTER); g_signal_connect ((GtkWidget*) main_window_viewer, "delete-event", (GCallback) __lambda0__gtk_widget_delete_event, NULL); main_window_setup_treeview (main_window_viewer->priv->tv); gtk_widget_show_all ((GtkWidget*) main_window_viewer); g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, (GSourceFunc) main_window_readFunc, NULL, NULL); gtk_main (); result = 0; return result; } int main (int argc, char ** argv) { g_type_init (); return main_window_main (argv, argc); } MainWindow* main_window_construct (GType object_type) { MainWindow * self; self = g_object_newv (object_type, 0, NULL); return self; } MainWindow* main_window_new (void) { return main_window_construct (TYPE_MAIN_WINDOW); } static void _main_window_OnFileNewEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnFileNewEvent (self); } static void _main_window_OnFileOpenEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnFileOpenEvent (self); } static void _main_window_OnQuitEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnQuitEvent (self); } static void _main_window_OnConnect_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnConnect (self); } static void _main_window_OnStop_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnStop (self); } static void _main_window_OnGetInformation_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnGetInformation (self); } static void _main_window_OnReset_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnReset (self); } static void _main_window_OnMenuHelpAboutActivatedEvent_gtk_menu_item_activate (GtkImageMenuItem* _sender, gpointer self) { main_window_OnMenuHelpAboutActivatedEvent (self); } static void _main_window_OnConnect_gtk_button_clicked (GtkButton* _sender, gpointer self) { main_window_OnConnect (self); } static void _main_window_OnStop_gtk_button_clicked (GtkButton* _sender, gpointer self) { main_window_OnStop (self); } static void _main_window_OnGetInformation_gtk_button_clicked (GtkButton* _sender, gpointer self) { main_window_OnGetInformation (self); } static void _main_window_OnFileOpenEvent_gtk_button_clicked (GtkButton* _sender, gpointer self) { main_window_OnFileOpenEvent (self); } static void _main_window_list_del_gtk_button_clicked (GtkButton* _sender, gpointer self) { main_window_list_del (self); } static void _main_window_OnFileFlashEvent_gtk_button_clicked (GtkButton* _sender, gpointer self) { main_window_OnFileFlashEvent (self); } static gboolean _gtk_widget_hide_on_delete_gtk_widget_delete_event (GtkAboutDialog* _sender, GdkEvent* event, gpointer self) { return gtk_widget_hide_on_delete (self); } static GObject * main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; MainWindow * self; parent_class = G_OBJECT_CLASS (main_window_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = MAIN_WINDOW (obj); { GtkVBox* _vbox0; GtkMenuBar* _menubar0; GtkMenuItem* _menuitem0; GtkMenu* _menu0; GtkImageMenuItem* _imagemenuitem0; GtkImageMenuItem* _imagemenuitem1; GtkSeparatorMenuItem* _separatormenuitem0; GtkImageMenuItem* _imagemenuitem2; GtkMenuItem* _menuitem1; GtkMenu* _menu1; GtkImageMenuItem* _imagemenuitem3; GtkImageMenuItem* _imagemenuitem4; GtkImageMenuItem* _imagemenuitem5; GtkImageMenuItem* _imagemenuitem6; GtkMenuItem* _menuitem2; GtkMenu* _menu2; GtkImageMenuItem* _imagemenuitem7; GtkHBox* _hbox0; GtkVBox* _vbox1; GtkScrolledWindow* _scrolledwindow0; GtkVBox* _vbox2; GtkButton* _button0; GtkButton* _button1; GtkButton* _button2; GtkLabel* _label0; GtkButton* _button3; GtkButton* _button4; GtkLabel* _label1; GtkButton* _button5; GtkVBox* _tmp0_; GtkMenuBar* _tmp1_; GtkMenu* _tmp2_; GtkImageMenuItem* _tmp3_; GtkImageMenuItem* _tmp4_; GtkSeparatorMenuItem* _tmp5_; GtkImageMenuItem* _tmp6_; GtkMenuItem* _tmp7_; GtkMenu* _tmp8_; GtkImageMenuItem* _tmp9_; GtkImageMenuItem* _tmp10_; GtkImageMenuItem* _tmp11_; GtkImageMenuItem* _tmp12_; GtkMenuItem* _tmp13_; GtkMenu* _tmp14_; GtkImageMenuItem* _tmp15_; GtkMenuItem* _tmp16_; GtkHBox* _tmp17_; GtkVBox* _tmp18_; GtkScrolledWindow* _tmp19_; GtkTreeView* _tmp20_; GtkVBox* _tmp21_; GtkButton* _tmp22_; GtkButton* _tmp23_; GtkButton* _tmp24_; GtkLabel* _tmp25_; GtkButton* _tmp26_; GtkButton* _tmp27_; GtkLabel* _tmp28_; GtkButton* _tmp29_; GtkProgressBar* _tmp30_; GtkAboutDialog* _tmp31_; gint _tmp33__length1; char** _tmp33_; char** _tmp32_ = NULL; _vbox0 = NULL; _menubar0 = NULL; _menuitem0 = NULL; _menu0 = NULL; _imagemenuitem0 = NULL; _imagemenuitem1 = NULL; _separatormenuitem0 = NULL; _imagemenuitem2 = NULL; _menuitem1 = NULL; _menu1 = NULL; _imagemenuitem3 = NULL; _imagemenuitem4 = NULL; _imagemenuitem5 = NULL; _imagemenuitem6 = NULL; _menuitem2 = NULL; _menu2 = NULL; _imagemenuitem7 = NULL; _hbox0 = NULL; _vbox1 = NULL; _scrolledwindow0 = NULL; _vbox2 = NULL; _button0 = NULL; _button1 = NULL; _button2 = NULL; _label0 = NULL; _button3 = NULL; _button4 = NULL; _label1 = NULL; _button5 = NULL; _vbox0 = (_tmp0_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 0)), _g_object_unref0 (_vbox0), _tmp0_); _menubar0 = (_tmp1_ = g_object_ref_sink ((GtkMenuBar*) gtk_menu_bar_new ()), _g_object_unref0 (_menubar0), _tmp1_); _menu0 = (_tmp2_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (_menu0), _tmp2_); _imagemenuitem0 = (_tmp3_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock ("gtk-new", NULL)), _g_object_unref0 (_imagemenuitem0), _tmp3_); _imagemenuitem1 = (_tmp4_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock ("gtk-open", NULL)), _g_object_unref0 (_imagemenuitem1), _tmp4_); _separatormenuitem0 = (_tmp5_ = g_object_ref_sink ((GtkSeparatorMenuItem*) gtk_separator_menu_item_new ()), _g_object_unref0 (_separatormenuitem0), _tmp5_); _imagemenuitem2 = (_tmp6_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock ("gtk-quit", NULL)), _g_object_unref0 (_imagemenuitem2), _tmp6_); _menuitem0 = (_tmp7_ = g_object_ref_sink ((GtkMenuItem*) gtk_menu_item_new_with_mnemonic ("_File")), _g_object_unref0 (_menuitem0), _tmp7_); _menu1 = (_tmp8_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (_menu1), _tmp8_); _imagemenuitem3 = (_tmp9_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock ("gtk-connect", NULL)), _g_object_unref0 (_imagemenuitem3), _tmp9_); _imagemenuitem4 = (_tmp10_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock ("gtk-stop", NULL)), _g_object_unref0 (_imagemenuitem4), _tmp10_); _imagemenuitem5 = (_tmp11_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock ("gtk-info", NULL)), _g_object_unref0 (_imagemenuitem5), _tmp11_); _imagemenuitem6 = (_tmp12_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_with_label ("Reset")), _g_object_unref0 (_imagemenuitem6), _tmp12_); _menuitem1 = (_tmp13_ = g_object_ref_sink ((GtkMenuItem*) gtk_menu_item_new_with_mnemonic ("_Target")), _g_object_unref0 (_menuitem1), _tmp13_); _menu2 = (_tmp14_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (_menu2), _tmp14_); _imagemenuitem7 = (_tmp15_ = g_object_ref_sink ((GtkImageMenuItem*) gtk_image_menu_item_new_from_stock ("gtk-about", NULL)), _g_object_unref0 (_imagemenuitem7), _tmp15_); _menuitem2 = (_tmp16_ = g_object_ref_sink ((GtkMenuItem*) gtk_menu_item_new_with_mnemonic ("_Help")), _g_object_unref0 (_menuitem2), _tmp16_); _hbox0 = (_tmp17_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 0)), _g_object_unref0 (_hbox0), _tmp17_); _vbox1 = (_tmp18_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 3)), _g_object_unref0 (_vbox1), _tmp18_); _scrolledwindow0 = (_tmp19_ = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL)), _g_object_unref0 (_scrolledwindow0), _tmp19_); self->priv->tv = (_tmp20_ = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()), _g_object_unref0 (self->priv->tv), _tmp20_); _vbox2 = (_tmp21_ = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 3)), _g_object_unref0 (_vbox2), _tmp21_); _button0 = (_tmp22_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_label ("gtk-connect")), _g_object_unref0 (_button0), _tmp22_); _button1 = (_tmp23_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_label ("gtk-stop")), _g_object_unref0 (_button1), _tmp23_); _button2 = (_tmp24_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_label ("gtk-info")), _g_object_unref0 (_button2), _tmp24_); _label0 = (_tmp25_ = g_object_ref_sink ((GtkLabel*) gtk_label_new ("")), _g_object_unref0 (_label0), _tmp25_); _button3 = (_tmp26_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_label ("gtk-add")), _g_object_unref0 (_button3), _tmp26_); _button4 = (_tmp27_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_label ("gtk-remove")), _g_object_unref0 (_button4), _tmp27_); _label1 = (_tmp28_ = g_object_ref_sink ((GtkLabel*) gtk_label_new ("")), _g_object_unref0 (_label1), _tmp28_); _button5 = (_tmp29_ = g_object_ref_sink ((GtkButton*) gtk_button_new_with_label ("gtk-media-record")), _g_object_unref0 (_button5), _tmp29_); self->priv->pb = (_tmp30_ = g_object_ref_sink ((GtkProgressBar*) gtk_progress_bar_new ()), _g_object_unref0 (self->priv->pb), _tmp30_); self->priv->aboutdialog1 = (_tmp31_ = g_object_ref_sink ((GtkAboutDialog*) gtk_about_dialog_new ()), _g_object_unref0 (self->priv->aboutdialog1), _tmp31_); g_object_set ((GtkWindow*) self, "type", GTK_WINDOW_TOPLEVEL, NULL); gtk_window_set_title ((GtkWindow*) self, "0xFFFF GUI"); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem0, "activate", (GCallback) _main_window_OnFileNewEvent_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu0, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem0)); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem1, "activate", (GCallback) _main_window_OnFileOpenEvent_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu0, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem1)); gtk_menu_shell_append ((GtkMenuShell*) _menu0, (GtkWidget*) ((GtkMenuItem*) _separatormenuitem0)); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem2, "activate", (GCallback) _main_window_OnQuitEvent_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu0, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem2)); gtk_menu_item_set_submenu (_menuitem0, _menu0); gtk_menu_shell_append ((GtkMenuShell*) _menubar0, (GtkWidget*) _menuitem0); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem3, "activate", (GCallback) _main_window_OnConnect_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu1, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem3)); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem4, "activate", (GCallback) _main_window_OnStop_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu1, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem4)); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem5, "activate", (GCallback) _main_window_OnGetInformation_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu1, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem5)); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem6, "activate", (GCallback) _main_window_OnReset_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu1, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem6)); gtk_menu_item_set_submenu (_menuitem1, _menu1); gtk_menu_shell_append ((GtkMenuShell*) _menubar0, (GtkWidget*) _menuitem1); g_signal_connect_object ((GtkMenuItem*) _imagemenuitem7, "activate", (GCallback) _main_window_OnMenuHelpAboutActivatedEvent_gtk_menu_item_activate, self, 0); gtk_menu_shell_append ((GtkMenuShell*) _menu2, (GtkWidget*) ((GtkMenuItem*) _imagemenuitem7)); gtk_menu_item_set_submenu (_menuitem2, _menu2); gtk_menu_shell_append ((GtkMenuShell*) _menubar0, (GtkWidget*) _menuitem2); gtk_box_pack_start ((GtkBox*) _vbox0, (GtkWidget*) _menubar0, FALSE, TRUE, (guint) 0); gtk_container_set_border_width ((GtkContainer*) _hbox0, (guint) 5); gtk_container_set_border_width ((GtkContainer*) _vbox1, (guint) 3); g_object_set ((GtkWidget*) _scrolledwindow0, "can-focus", TRUE, NULL); g_object_set (_scrolledwindow0, "hscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL); g_object_set (_scrolledwindow0, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL); gtk_container_add ((GtkContainer*) _scrolledwindow0, (GtkWidget*) self->priv->tv); gtk_container_add ((GtkContainer*) _vbox1, (GtkWidget*) _scrolledwindow0); gtk_container_add ((GtkContainer*) _hbox0, (GtkWidget*) _vbox1); gtk_container_set_border_width ((GtkContainer*) _vbox2, (guint) 3); gtk_button_set_use_stock (_button0, TRUE); g_signal_connect_object (_button0, "clicked", (GCallback) _main_window_OnConnect_gtk_button_clicked, self, 0); gtk_box_pack_start ((GtkBox*) _vbox2, (GtkWidget*) _button0, FALSE, TRUE, (guint) 0); gtk_button_set_use_stock (_button1, TRUE); g_signal_connect_object (_button1, "clicked", (GCallback) _main_window_OnStop_gtk_button_clicked, self, 0); gtk_box_pack_start ((GtkBox*) _vbox2, (GtkWidget*) _button1, FALSE, TRUE, (guint) 0); gtk_button_set_use_stock (_button2, TRUE); g_signal_connect_object (_button2, "clicked", (GCallback) _main_window_OnGetInformation_gtk_button_clicked, self, 0); gtk_box_pack_start ((GtkBox*) _vbox2, (GtkWidget*) _button2, FALSE, TRUE, (guint) 0); gtk_container_add ((GtkContainer*) _vbox2, (GtkWidget*) _label0); gtk_button_set_use_stock (_button3, TRUE); g_signal_connect_object (_button3, "clicked", (GCallback) _main_window_OnFileOpenEvent_gtk_button_clicked, self, 0); gtk_box_pack_start ((GtkBox*) _vbox2, (GtkWidget*) _button3, FALSE, TRUE, (guint) 0); gtk_button_set_use_stock (_button4, TRUE); g_signal_connect_object (_button4, "clicked", (GCallback) _main_window_list_del_gtk_button_clicked, self, 0); gtk_box_pack_start ((GtkBox*) _vbox2, (GtkWidget*) _button4, FALSE, TRUE, (guint) 0); gtk_container_add ((GtkContainer*) _vbox2, (GtkWidget*) _label1); gtk_button_set_use_stock (_button5, TRUE); g_signal_connect_object (_button5, "clicked", (GCallback) _main_window_OnFileFlashEvent_gtk_button_clicked, self, 0); gtk_box_pack_start ((GtkBox*) _vbox2, (GtkWidget*) _button5, FALSE, TRUE, (guint) 0); gtk_box_pack_start ((GtkBox*) _hbox0, (GtkWidget*) _vbox2, FALSE, TRUE, (guint) 0); gtk_container_add ((GtkContainer*) _vbox0, (GtkWidget*) _hbox0); gtk_box_pack_start ((GtkBox*) _vbox0, (GtkWidget*) self->priv->pb, FALSE, TRUE, (guint) 0); gtk_container_add ((GtkContainer*) self, (GtkWidget*) _vbox0); g_signal_connect_object ((GtkWidget*) self->priv->aboutdialog1, "delete-event", (GCallback) _gtk_widget_hide_on_delete_gtk_widget_delete_event, (GtkWidget*) self->priv->aboutdialog1, 0); gtk_container_set_border_width ((GtkContainer*) self->priv->aboutdialog1, (guint) 5); gtk_window_set_title ((GtkWindow*) self->priv->aboutdialog1, "About 0xFFFF gui"); gtk_window_set_resizable ((GtkWindow*) self->priv->aboutdialog1, FALSE); gtk_window_set_modal ((GtkWindow*) self->priv->aboutdialog1, TRUE); g_object_set ((GtkWindow*) self->priv->aboutdialog1, "window-position", GTK_WIN_POS_CENTER_ON_PARENT, NULL); gtk_dialog_set_has_separator ((GtkDialog*) self->priv->aboutdialog1, FALSE); gtk_about_dialog_set_program_name (self->priv->aboutdialog1, "0xFFFF"); gtk_about_dialog_set_version (self->priv->aboutdialog1, "0.5"); gtk_about_dialog_set_copyright (self->priv->aboutdialog1, "Copyright (c) 2007-2009 pancake"); gtk_about_dialog_set_comments (self->priv->aboutdialog1, "The Free Nokia Internet Tablet flasher"); gtk_about_dialog_set_website (self->priv->aboutdialog1, "http://www.nopcode.org/0xFFFF/"); gtk_about_dialog_set_authors (self->priv->aboutdialog1, (_tmp33_ = (_tmp32_ = g_new0 (char*, 2 + 1), _tmp32_[0] = g_strdup ("pancake (pancake@youterm.com)"), _tmp32_[1] = NULL, _tmp32_), _tmp33__length1 = 2, _tmp33_)); _tmp33_ = (_vala_array_free (_tmp33_, _tmp33__length1, (GDestroyNotify) g_free), NULL); _g_object_unref0 (_vbox0); _g_object_unref0 (_menubar0); _g_object_unref0 (_menuitem0); _g_object_unref0 (_menu0); _g_object_unref0 (_imagemenuitem0); _g_object_unref0 (_imagemenuitem1); _g_object_unref0 (_separatormenuitem0); _g_object_unref0 (_imagemenuitem2); _g_object_unref0 (_menuitem1); _g_object_unref0 (_menu1); _g_object_unref0 (_imagemenuitem3); _g_object_unref0 (_imagemenuitem4); _g_object_unref0 (_imagemenuitem5); _g_object_unref0 (_imagemenuitem6); _g_object_unref0 (_menuitem2); _g_object_unref0 (_menu2); _g_object_unref0 (_imagemenuitem7); _g_object_unref0 (_hbox0); _g_object_unref0 (_vbox1); _g_object_unref0 (_scrolledwindow0); _g_object_unref0 (_vbox2); _g_object_unref0 (_button0); _g_object_unref0 (_button1); _g_object_unref0 (_button2); _g_object_unref0 (_label0); _g_object_unref0 (_button3); _g_object_unref0 (_button4); _g_object_unref0 (_label1); _g_object_unref0 (_button5); } return obj; } static void main_window_class_init (MainWindowClass * klass) { main_window_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (MainWindowPrivate)); G_OBJECT_CLASS (klass)->constructor = main_window_constructor; G_OBJECT_CLASS (klass)->finalize = main_window_finalize; } static void main_window_instance_init (MainWindow * self) { self->priv = MAIN_WINDOW_GET_PRIVATE (self); } static void main_window_finalize (GObject* obj) { MainWindow * self; self = MAIN_WINDOW (obj); _g_object_unref0 (self->priv->tv); _g_object_unref0 (self->priv->pb); _g_object_unref0 (self->priv->aboutdialog1); G_OBJECT_CLASS (main_window_parent_class)->finalize (obj); } GType main_window_get_type (void) { static GType main_window_type_id = 0; if (main_window_type_id == 0) { static const GTypeInfo g_define_type_info = { sizeof (MainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindow), 0, (GInstanceInitFunc) main_window_instance_init, NULL }; main_window_type_id = g_type_register_static (GTK_TYPE_WINDOW, "MainWindow", &g_define_type_info, 0); } return main_window_type_id; } static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { if ((array != NULL) && (destroy_func != NULL)) { int i; for (i = 0; i < array_length; i = i + 1) { if (((gpointer*) array)[i] != NULL) { destroy_func (((gpointer*) array)[i]); } } } } static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { _vala_array_destroy (array, array_length, destroy_func); g_free (array); } static gint _vala_array_length (gpointer array) { int length; length = 0; if (array) { while (((gpointer*) array)[length]) { length++; } } return length; }