struct navit * navit_new(const char *ui, const char *graphics, struct coord *center, enum projection pro, int zoom) { struct navit *this_=g_new0(struct navit, 1); FILE *f; main_add_navit(this_); this_->vehicle_cbl=callback_list_new(); f=popen("pidof /usr/bin/ipaq-sleep","r"); if (f) { fscanf(f,"%d",&this_->pid); dbg(1,"ipaq_sleep pid=%d\n", this_->pid); pclose(f); } this_->bookmarks_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); this_->cursor_flag=1; this_->tracking_flag=1; this_->trans=transform_new(); transform_set_projection(this_->trans, pro); transform_setup(this_->trans, center, zoom, 0); this_->displaylist=graphics_displaylist_new(); this_->gui=gui_new(this_, ui, 792, 547); if (! this_->gui) { g_warning("failed to create gui '%s'", ui); navit_destroy(this_); return NULL; } if (gui_has_main_loop(this_->gui)) { if (! main_loop_gui) { main_loop_gui=this_->gui; } else { g_warning("gui with main loop already active, ignoring this instance"); navit_destroy(this_); return NULL; } } this_->menubar=gui_menubar_new(this_->gui); this_->toolbar=gui_toolbar_new(this_->gui); this_->statusbar=gui_statusbar_new(this_->gui); this_->gra=graphics_new(graphics); if (! this_->gra) { g_warning("failed to create graphics '%s'", graphics); navit_destroy(this_); return NULL; } graphics_register_resize_callback(this_->gra, navit_resize, this_); graphics_register_button_callback(this_->gra, navit_button, this_); if (gui_set_graphics(this_->gui, this_->gra)) { g_warning("failed to connect graphics '%s' to gui '%s'\n", graphics, ui); navit_destroy(this_); return NULL; } graphics_init(this_->gra); return this_; }
static gboolean create_plugin_control (Control *ctrl) { gui *plugin = gui_new(); gtk_container_add (GTK_CONTAINER(ctrl->base), plugin->ebox); ctrl->data = (gpointer)plugin; ctrl->with_popup = FALSE; return(TRUE); }
struct navit * navit_new(const char *ui, const char *graphics, struct coord *center, enum projection pro, int zoom) { struct navit *this_=g_new0(struct navit, 1); this_->cursor_flag=1; this_->trans=transform_new(); transform_set_projection(this_->trans, pro); transform_setup(this_->trans, center, zoom, 0); /* this_->flags=g_new0(struct map_flags, 1); */ this_->displaylist=graphics_displaylist_new(); this_->gui=gui_new(this_, ui, 792, 547); if (! this_->gui) { g_warning("failed to create gui '%s'", ui); navit_destroy(this_); return NULL; } if (gui_has_main_loop(this_->gui)) { if (! main_loop_gui) { main_loop_gui=this_->gui; } else { g_warning("gui with main loop already active, ignoring this instance"); navit_destroy(this_); return NULL; } } this_->menubar=gui_menubar_new(this_->gui); this_->toolbar=gui_toolbar_new(this_->gui); this_->statusbar=gui_statusbar_new(this_->gui); this_->gra=graphics_new(graphics); if (! this_->gra) { g_warning("failed to create graphics '%s'", graphics); navit_destroy(this_); return NULL; } graphics_register_resize_callback(this_->gra, navit_resize, this_); graphics_register_button_callback(this_->gra, navit_button, this_); if (gui_set_graphics(this_->gui, this_->gra)) { g_warning("failed to connect graphics '%s' to gui '%s'\n", graphics, ui); navit_destroy(this_); return NULL; } graphics_init(this_->gra); return this_; }
GraceApp *gapp_new(void) { GraceApp *gapp; gapp = xmalloc(sizeof(GraceApp)); if (!gapp) { return NULL; } memset(gapp, 0, sizeof(GraceApp)); if (grace_init() != RETURN_SUCCESS) { gapp_free(gapp); return NULL; } gapp->grace = grace_new(bi_home()); if (!gapp->grace) { gapp_free(gapp); return NULL; } graal_set_eval_proc(grace_get_graal(gapp->grace), eval_proc); grace_set_udata(gapp->grace, gapp); gapp->rt = runtime_new(gapp); if (!gapp->rt) { gapp_free(gapp); return NULL; } gapp->gui = gui_new(gapp); if (!gapp->gui) { gapp_free(gapp); return NULL; } gapp->pc = container_new(grace_get_qfactory(gapp->grace), AMEM_MODEL_SIMPLE); if (!gapp->pc) { gapp_free(gapp); return NULL; } return gapp; }
void gui_mode(int argc, char *argv[]) { osso_context_t *osso_context; char *versionstring; AppData *appdata = g_new(AppData, 1); appdata->runmode = GUI; gtk_init(&argc, &argv); /* register OSSO service */ osso_context = osso_initialize(NAME, VERSION, TRUE, NULL); if (! osso_context) fprintf(stderr, "Could not initialize OSSO."); appdata->playlist = playlist_new(); appdata->decoder = decoder_new(); appdata->stream = NULL; appdata->gui = gui_new(appdata->playlist); versionstring = g_strconcat(FULLNAME, " ", VERSION, NULL); gui_set_title(appdata->gui, "", versionstring, ""); g_free(versionstring); /* setup callbacks */ playlist_set_play_cb(appdata->playlist, play_cb, (void *) appdata); /* setup GUI callbacks */ gui_set_open_cb(appdata->gui, open_cb, (void *) appdata); gui_set_volume_cb(appdata->gui, volume_cb, (void *) appdata); gui_set_seek_cb(appdata->gui, seek_cb, (void *) appdata); gui_set_control_cb(appdata->gui, control_cb, (void *) appdata); g_timeout_add(500, (GSourceFunc) status_cb, appdata); gui_run(); }