/[cabestan]/main.c
ViewVC logotype

Annotation of /main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Sun Oct 4 20:55:30 2009 UTC (9 years, 9 months ago) by ben
File MIME type: text/plain
File size: 2028 byte(s)
better stepr/stepf, and play
1 ben 1 #include <libintl.h>
2     #include <locale.h>
3     #include <gtk/gtk.h>
4     #include <glib.h>
5     #include <jack/jack.h>
6     #include <jack/transport.h>
7     #include "version.h"
8     #include "widgets.h"
9     #include "callbacks.h"
10     #define _(string) gettext (string)
11    
12     int main (int argc, char* argv[]) {
13     GtkWidget* window; /* main window */
14     GtkWidget* timeline; /* time display */
15     GtkWidget* vbox;
16     GtkWidget* hbox;
17     GtkWidget* play, * rewind, * forward, * stepf, * stepr; /* buttons */
18     jack_client_t* jackd_client; /* jackd handle */
19     jack_status_t jackd_status; /* jackd status */
20    
21    
22     /* internationalization */
23     setlocale ( LC_ALL, "" );
24     bindtextdomain ("cabestan", LOCALEDIR);
25     textdomain ( "cabestan" );
26    
27     /* jack init */
28     jackd_client = jack_client_open("cabestan", JackNullOption, &jackd_status);
29     jack_activate(jackd_client);
30    
31     /* gtk init */
32     gtk_init (&argc, &argv);
33    
34     window = window_create("Cabestan");
35     vbox = vbox_create();
36     window_add_vbox(window, vbox);
37     timeline = timeline_create();
38     vbox_pack_widget(vbox, timeline);
39     hbox = hbox_create();
40     vbox_pack_widget(vbox, hbox);
41     rewind = button_create(GTK_STOCK_MEDIA_PREVIOUS);
42     hbox_pack_widget(hbox, rewind);
43     stepr = button_create(GTK_STOCK_MEDIA_REWIND);
44     hbox_pack_widget(hbox, stepr);
45     play = button_create(GTK_STOCK_MEDIA_PLAY);
46     hbox_pack_widget(hbox, play);
47     stepf = button_create(GTK_STOCK_MEDIA_FORWARD);
48     hbox_pack_widget(hbox, stepf);
49     forward = button_create(GTK_STOCK_MEDIA_NEXT);
50     hbox_pack_widget(hbox, forward);
51    
52     /* callback connection */
53     g_signal_connect_swapped(G_OBJECT(window), "delete-event", G_CALLBACK(gtk_main_quit), (gpointer)NULL);
54     g_signal_connect(G_OBJECT(play), "clicked", G_CALLBACK(on_play), (gpointer)jackd_client);
55     g_signal_connect(G_OBJECT(rewind), "clicked", G_CALLBACK(on_rewind), (gpointer)jackd_client);
56     g_signal_connect(G_OBJECT(stepf), "clicked", G_CALLBACK(on_stepf), (gpointer)jackd_client);
57     g_signal_connect(G_OBJECT(stepr), "clicked", G_CALLBACK(on_stepr), (gpointer)jackd_client);
58    
59     gtk_widget_show_all(window);
60    
61     gtk_main();
62    
63     return 0;
64     }

  ViewVC Help
Powered by ViewVC 1.1.26