int main(int argc, char *argv[]) { GError *error = NULL; GOptionContext *context; bindtextdomain(GETTEXT_PACKAGE, SPICE_GTK_LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); /* parse opts */ context = g_option_context_new(_(" - write screen shots in ppm format")); g_option_context_add_main_entries(context, app_entries, NULL); g_option_context_add_group(context, spice_cmdline_get_option_group()); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_print (_("option parsing failed: %s\n"), error->message); exit (1); } g_type_init(); mainloop = g_main_loop_new(NULL, false); session = spice_session_new(); g_signal_connect(session, "channel-new", G_CALLBACK(channel_new), NULL); spice_cmdline_session_setup(session); if (!spice_session_connect(session)) { fprintf(stderr, _("spice_session_connect failed\n")); exit(1); } g_main_loop_run(mainloop); return 0; }
int main(int argc, char *argv[]) { GError *error = NULL; GOptionContext *context; signal(SIGINT, signal_handler); /* parse opts */ context = g_option_context_new(NULL); g_option_context_set_summary(context, "A Spice client used for testing and measurements."); g_option_context_set_description(context, "Report bugs to " PACKAGE_BUGREPORT "."); g_option_context_set_main_group(context, spice_cmdline_get_option_group()); g_option_context_add_main_entries(context, app_entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_print("option parsing failed: %s\n", error->message); exit(1); } if (version) { g_print("spicy-stats " PACKAGE_VERSION "\n"); exit(0); } mainloop = g_main_loop_new(NULL, false); session = spice_session_new(); g_signal_connect(session, "channel-new", G_CALLBACK(channel_new), NULL); spice_cmdline_session_setup(session); if (!spice_session_connect(session)) { fprintf(stderr, "spice_session_connect failed\n"); exit(1); } g_main_loop_run(mainloop); { GList *iter, *list = spice_session_get_channels(session); gulong total_read_bytes; gint channel_type; printf("total bytes read:\n"); for (iter = list ; iter ; iter = iter->next) { g_object_get(iter->data, "total-read-bytes", &total_read_bytes, "channel-type", &channel_type, NULL); printf("%s: %lu\n", spice_channel_type_to_string(channel_type), total_read_bytes); } g_list_free(list); } return 0; }
int main(int argc, char *argv[]) { parse_cmd(argc, argv); gtk_init(&argc, &argv); main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); spice_session = spice_session_new(); g_object_set(spice_session, "host", host, NULL); g_object_set(spice_session, "port", port, NULL); g_signal_connect(spice_session, "channel-new", G_CALLBACK(channel_new), NULL); if (!spice_session_connect(spice_session)) { fprintf(stderr, "spice_session_connect failed\n"); exit(1); } gtk_main(); return 0; }
void connection_connect(spice_connection *conn) { conn->disconnecting = false; spice_session_connect(conn->session); }