diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-20 14:06:53 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-20 14:06:53 +0000 |
commit | 27a53acf7190d20985a927f19fb5d0e90ad25e60 (patch) | |
tree | 91b177aca82a7a1b9848bbb184b61975b66deb9e /examples | |
parent | 2cdfde517e53ae2c7c3393a505e1f127e714fc59 (diff) | |
download | librcc-27a53acf7190d20985a927f19fb5d0e90ad25e60.tar.gz librcc-27a53acf7190d20985a927f19fb5d0e90ad25e60.tar.bz2 librcc-27a53acf7190d20985a927f19fb5d0e90ad25e60.tar.xz librcc-27a53acf7190d20985a927f19fb5d0e90ad25e60.zip |
Fixes
- Added 'rcc-gtk-config' program to examples
- Fixed problems in autoconf configuration
- Fixed bug in rccLocaleGetCharset
- Fixed visibility of all items in gtkui
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 10 | ||||
-rw-r--r-- | examples/example.c | 13 | ||||
-rw-r--r-- | examples/rcc-gtk-config.c | 79 |
3 files changed, 94 insertions, 8 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index abf3ebb..15df761 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -2,9 +2,15 @@ bin_PROGRAMS= example example_SOURCES= example.c example_LDADD= ../src/librcc.la -EXTRA_DIST= input-russian.txt rcc.xml rcc-example.xml +if HAVE_GTK +bin_PROGRAMS+= rcc-gtk-config +rcc_gtk_config_SOURCES = rcc-gtk-config.c +rcc_gtk_config_LDADD=../ui/librccgtk.la @GTK_LIBS@ +endif + +EXTRA_DIST= input-russian.txt rcc.xml rcc-example.xml mpg123-rcc.patch test-russian: example cat input-russian.txt | ./example -INCLUDES = -I../src -I../ui +INCLUDES = -I../src -I../ui @GTK_INCLUDES@ diff --git a/examples/example.c b/examples/example.c index 820bae0..43fc853 100644 --- a/examples/example.c +++ b/examples/example.c @@ -5,22 +5,23 @@ #include <librcc.h> -static rcc_class classes[] = { - { "input", RCC_CLASS_STANDARD, NULL, NULL, "Input Encoding", 0 }, - { "output", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output Encoding", 0 }, - { NULL } -}; int main() { const char *language; char buf[255]; char *recoded; + + rcc_class classes[] = { + { "input", RCC_CLASS_STANDARD, NULL, NULL, "Input Encoding", 0 }, + { "output", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output Encoding", 0 }, + { NULL } + }; setlocale(LC_ALL, ""); rccInit(); rccInitDefaultContext(NULL, 0, 0, classes, 0); - + language = rccGetCurrentLanguageName(NULL); if (language) printf("Current Language: %s\n\n", language); else printf("Unable Detect Language\n\n"); diff --git a/examples/rcc-gtk-config.c b/examples/rcc-gtk-config.c new file mode 100644 index 0000000..eae029e --- /dev/null +++ b/examples/rcc-gtk-config.c @@ -0,0 +1,79 @@ +#include <gtk/gtk.h> + +#include <librcc.h> +#include <librccui.h> + +static rcc_class classes[] = { + { "id3", RCC_CLASS_STANDARD, NULL, NULL, "ID3 Encoding", 0 }, + { "pl", RCC_CLASS_STANDARD, "id3", NULL, "PlayList Title Encoding", 0}, + { "plfs", RCC_CLASS_STANDARD, "pl", NULL, "PlayList File Encoding", 0 }, + { "fs", RCC_CLASS_FS, "LC_CTYPE", NULL, "FileSystem Encoding", 0 }, + { "oem", RCC_CLASS_STANDARD, NULL, NULL, "Zip OEM Encoding", 0 }, + { "iso", RCC_CLASS_STANDARD, NULL, NULL, "Zip ISO Encoding", 0 }, + { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, NULL, 0 }, + { NULL } +}; + +static char *config; +static rcc_context ctx; +static rcc_ui_context uictx; + +static void apply_cb(GtkWidget * w, gpointer data) +{ + rccUiUpdate(uictx); + rccSave(ctx, config); +} + + +int main (int argc, char *argv[]) +{ + GtkWidget *window1; + GtkWidget *save, *close, *hbox; + GtkWidget *box; + + + if (argc<1) config = argv[0]; + else config = argv[1]; + + gtk_set_locale (); + gtk_init (&argc, &argv); + + rccInit(); + rccUiInit(); + ctx = rccCreateContext(NULL, 0, 0, classes, 0); + rccLoad(ctx, config); + uictx = rccUiCreateContext(ctx); + + window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_policy(GTK_WINDOW (window1), FALSE, FALSE, FALSE); + gtk_window_set_title (GTK_WINDOW (window1), "LibRCC Config"); + gtk_widget_show(window1); + + box = rccUiGetPage(uictx, NULL); + gtk_widget_show (box); + gtk_container_add (GTK_CONTAINER (window1), box); + + hbox = gtk_hbox_new (TRUE, 0); + gtk_widget_show (hbox); + gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0); + + close = gtk_button_new_with_label("Close"); + gtk_widget_show (close); + gtk_signal_connect (GTK_OBJECT (window1), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); + gtk_signal_connect (GTK_OBJECT (close), "clicked", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); + gtk_box_pack_start (GTK_BOX (hbox), close, FALSE, FALSE, 0); + + save = gtk_button_new_with_label("Save"); + gtk_widget_show (save); + gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(apply_cb), NULL); + gtk_box_pack_start (GTK_BOX (hbox), save, FALSE, FALSE, 0); + + gtk_main (); + + rccUiFreeContext(uictx); + rccFreeContext(ctx); + rccUiFree(); + rccFree(); + + return 0; +} |