int main (int argc, char *argv[]) { SnraClient *client = NULL; int ret = 1; const gchar *server = NULL; gst_init (&argc, &argv); if (argc > 1) { /* Connect directly to the requested server, no avahi */ server = argv[1]; } avahi_set_allocator (avahi_glib_allocator ()); g_timeout_add (250, sigint_check, NULL); sigint_setup (); client = snra_client_new (server); if (client == NULL) goto fail; ml = g_main_loop_new (NULL, FALSE); g_main_loop_run (ml); ret = 0; fail: if (client) g_object_unref (client); if (ml) g_main_loop_unref (ml); return ret; }
int main (int argc, char *argv[]) { SnraClient *client = NULL; int ret = 1; const gchar *server = NULL; GOptionContext *ctx; GError *error = NULL; GtkWidget *window, *eventbox, *button; ctx = g_option_context_new ("Aurena fullscreen client"); g_option_context_add_group (ctx, gtk_get_option_group(TRUE)); g_option_context_add_group (ctx, gst_init_get_option_group()); if (!g_option_context_parse (ctx, &argc, &argv, &error)) { g_print ("Arguments error: %s", error->message); return 1; } g_option_context_free (ctx); if (argc > 1) { /* Connect directly to the requested server, no avahi */ server = argv[1]; } avahi_set_allocator (avahi_glib_allocator ()); client = snra_client_new (server, SNRA_CLIENT_PLAYER); if (client == NULL) goto fail; g_object_set (gtk_settings_get_default (), "gtk-application-prefer-dark-theme", TRUE, NULL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_double_buffered (window, FALSE); gtk_widget_set_redraw_on_allocate (window, FALSE); gtk_widget_set_app_paintable (window, TRUE); g_signal_connect_after (window, "delete-event", G_CALLBACK (quit_clicked), NULL); eventbox = gtk_event_box_new (); g_object_set (eventbox, "halign", GTK_ALIGN_END, "valign", GTK_ALIGN_START, "expand", FALSE, NULL); gtk_widget_set_double_buffered (eventbox, TRUE); gtk_widget_set_redraw_on_allocate (eventbox, TRUE); gtk_widget_set_app_paintable (eventbox, FALSE); gtk_container_add (GTK_CONTAINER (window), eventbox); button = gtk_button_new_from_stock (GTK_STOCK_QUIT); gtk_container_add (GTK_CONTAINER (eventbox), button); g_signal_connect (button, "clicked", G_CALLBACK (quit_clicked), NULL); gtk_window_fullscreen (GTK_WINDOW (window)); gtk_widget_show_all (window); g_signal_connect (client, "player-created", G_CALLBACK(player_created), window); gtk_widget_realize (button); gdk_window_ensure_native (gtk_widget_get_window (eventbox)); ml = g_main_loop_new (NULL, FALSE); g_main_loop_run (ml); ret = 0; fail: if (client) g_object_unref (client); if (ml) g_main_loop_unref (ml); return ret; }