summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-20 14:06:53 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-20 14:06:53 +0000
commit27a53acf7190d20985a927f19fb5d0e90ad25e60 (patch)
tree91b177aca82a7a1b9848bbb184b61975b66deb9e
parent2cdfde517e53ae2c7c3393a505e1f127e714fc59 (diff)
downloadlibrcc-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
-rw-r--r--configure.in36
-rw-r--r--examples/Makefile.am10
-rw-r--r--examples/example.c13
-rw-r--r--examples/rcc-gtk-config.c79
-rw-r--r--librcc.spec.in10
-rw-r--r--src/librcc.h2
-rw-r--r--src/rcclocale.c2
-rw-r--r--src/rccxml.c10
-rw-r--r--ui/gtk.c20
9 files changed, 141 insertions, 41 deletions
diff --git a/configure.in b/configure.in
index 5c0fb24..0699682 100644
--- a/configure.in
+++ b/configure.in
@@ -92,38 +92,30 @@ AC_CHECK_HEADER(dlfcn.h, [AC_CHECK_LIB(dl, dlopen, [
HAVE_DLOPEN=no
])])
-if test $enable_force_dynamic_engines = yes; then
- RCD_LIBS=""
- RCD_INCLUDES=""
- HAVE_RCD=no
- ENCA_LIBS=""
- ENCA_INCLUDES=""
- HAVE_ENCA=no
-else
+RCD_LIBS=""
+RCD_INCLUDES=""
+HAVE_RCD=no
+ENCA_LIBS=""
+ENCA_INCLUDES=""
+HAVE_ENCA=no
+
+if test "x$enable_force_dynamic_engines" != "xyes"; then
AC_CHECK_HEADER(librcd.h, [AC_CHECK_LIB(rcd, rcdGetRussianCharset, [
AC_DEFINE(HAVE_RCD,1,[Defines if libRCD is available])
RCD_LIBS="-lrcd"
RCD_INCLUDES=""
HAVE_RCD=yes
-],[
- RCD_LIBS=""
- RCD_INCLUDES=""
- HAVE_RCD=no
])])
AC_CHECK_HEADER(enca.h, [AC_CHECK_LIB(enca, enca_analyse, [
AC_DEFINE(HAVE_ENCA,1,[Defines if enca is available])
ENCA_LIBS="-lenca"
ENCA_INCLUDES=""
HAVE_ENCA=yes
-],[
- ENCA_LIBS=""
- ENCA_INCLUDES=""
- HAVE_ENCA=no
])])
fi
-AM_CONDITIONAL(HAVE_RCD, [ test $HAVE_RCD = yes ])
-AM_CONDITIONAL(HAVE_ENCA, [ test $HAVE_ENCA = yes ])
+AM_CONDITIONAL(HAVE_RCD, [ test "x$HAVE_RCD" = "xyes" ])
+AM_CONDITIONAL(HAVE_ENCA, [ test "x$HAVE_ENCA" = "xyes" ])
AC_SUBST(RCD_LIBS)
AC_SUBST(RCD_INCLUDES)
@@ -131,17 +123,17 @@ AC_SUBST(ENCA_LIBS)
AC_SUBST(ENCA_INCLUDES)
USE_DLOPEN=no
-if test $HAVE_DLOPEN = yes; then
- if test $HAVE_ENCA = no; then
+if test "x$HAVE_DLOPEN" = "xyes"; then
+ if test "x$HAVE_ENCA" = "xno"; then
HAVE_ENCA=dynamic
USE_DLOPEN=yes
fi
- if test $HAVE_RCD = no; then
+ if test "x$HAVE_RCD" = "xno"; then
HAVE_RCD=dynamic
USE_DLOPEN=yes
fi
- if test $USE_DLOPEN = no; then
+ if test "x$USE_DLOPEN" = "xno"; then
DLOPEN_LIBS=""
DLOPEN_INCLUDES=""
fi
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;
+}
diff --git a/librcc.spec.in b/librcc.spec.in
index ec3025f..768d6c9 100644
--- a/librcc.spec.in
+++ b/librcc.spec.in
@@ -6,7 +6,7 @@
%define release 0.%{buildname}.%{realrelease}csa
%else
%define buildname @VERSION@
-%define release %{realrelease}
+%define release %{realrelease}csa
%endif
@@ -52,12 +52,16 @@ is part of rusxmms patch.
%install
rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/etc
+mkdir -p $RPM_BUILD_ROOT/etc/rcc
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/rcc/engines/
+mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{prefix}/lib/*.la
rm -f $RPM_BUILD_ROOT%{prefix}/lib/rcc/engines/*.a
rm -f $RPM_BUILD_ROOT%{prefix}/lib/rcc/engines/*.la
+make -C examples
+install -m 755 examples/rcc-gtk-config $RPM_BUILD_ROOT/%{prefix}/bin
+
install -m 644 examples/rcc.xml $RPM_BUILD_ROOT/etc
@@ -72,9 +76,11 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-, root, root)
%doc AUTHORS ChangeLog NEWS README COPYING
%doc examples/rcc-example.xml
+%dir /etc/rcc
/etc/rcc.xml
%{prefix}/lib/lib*.so.*
%{prefix}/lib/rcc/
+%{prefix}/bin/rcc-gtk-config
%files devel
%defattr(-, root, root)
diff --git a/src/librcc.h b/src/librcc.h
index a72274a..6b28813 100644
--- a/src/librcc.h
+++ b/src/librcc.h
@@ -1,6 +1,8 @@
#ifndef _LIBRCC_H
#define _LIBRCC_H
+#include <stdlib.h>
+
/*******************************************************************************
***************************** Global Defines ***********************************
*******************************************************************************/
diff --git a/src/rcclocale.c b/src/rcclocale.c
index c0b4e63..99d2b8f 100644
--- a/src/rcclocale.c
+++ b/src/rcclocale.c
@@ -108,7 +108,7 @@ int rccLocaleGetCharset(char *result, const char *lv, unsigned int n) {
for (i=0;((l[i])&&(l[i]!='@'));i++);
if (i>=n) return -1;
- strncpy(result,l,i);
+ strncpy(result,l+1,i-1);
result[i]=0;
return 0;
diff --git a/src/rccxml.c b/src/rccxml.c
index 65a9c4d..143f930 100644
--- a/src/rccxml.c
+++ b/src/rccxml.c
@@ -281,12 +281,12 @@ int rccSave(rcc_context ctx, const char *name) {
if (!doc) {
doc = xmlNewDoc("1.0");
if (!doc) goto clear;
+ pnode = NULL;
+ } else {
+ xpathctx = xmlXPathNewContext(doc);
+ pnode = rccNodeFind(xpathctx, XPATH_SELECTED);
}
- xpathctx = xmlXPathNewContext(doc);
- if (!xpathctx) goto clear;
-
- pnode = rccNodeFind(xpathctx, XPATH_SELECTED);
if (pnode) {
lnode = rccNodeFind(xpathctx, XPATH_SELECTED_LANGUAGE);
onode = rccNodeFind(xpathctx, XPATH_SELECTED_OPTIONS);
@@ -483,8 +483,6 @@ int rccLoad(rcc_context ctx, const char *name) {
if ((!doc)&&(!sysdoc)) goto clear;
-
-
node = rccNodeFind(xpathctx, XPATH_SELECTED_LANGUAGE);
if (!node) node = rccNodeFind(sysxpathctx, XPATH_SELECTED_LANGUAGE);
if (node) {
diff --git a/ui/gtk.c b/ui/gtk.c
index 749405e..cf69a87 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -100,11 +100,12 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
if (!languages) return -1;
list = gtk_menu_new();
+ gtk_widget_show(list);
for (i=0; languages[i]; i++) {
item = gtk_menu_item_new_with_label(rccUiGetLanguageName(uictx, languages[i]->sn));
+ gtk_widget_show(item);
gtk_signal_connect(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(rccGtkMenuLanguageCB), ctx);
gtk_menu_append(GTK_MENU(list), item);
- gtk_widget_show(item);
}
language_id = rccGetSelectedLanguage(rccctx);
@@ -113,6 +114,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
if (ctx->widget) menu = ctx->widget;
else {
menu = gtk_option_menu_new();
+ gtk_widget_show(menu);
ctx->widget = menu;
}
gtk_option_menu_remove_menu(GTK_OPTION_MENU(menu));
@@ -126,6 +128,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
if (!charsets) return -1;
list = gtk_menu_new();
+ gtk_widget_show(list);
for (i=0;charsets[i];i++) {
item = gtk_menu_item_new_with_label(rccUiGetCharsetName(uictx,charsets[i]));
gtk_widget_show(item);
@@ -135,6 +138,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
if (ctx->widget) menu = ctx->widget;
else {
menu = gtk_option_menu_new();
+ gtk_widget_show(menu);
ctx->widget = menu;
}
@@ -153,6 +157,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
if (!engines) return -1;
list = gtk_menu_new();
+ gtk_widget_show(list);
for (i=0;engines[i];i++) {
item = gtk_menu_item_new_with_label(rccUiGetEngineName(uictx,engines[i]->title));
gtk_widget_show(item);
@@ -162,6 +167,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
if (ctx->widget) menu = ctx->widget;
else {
menu = gtk_option_menu_new();
+ gtk_widget_show(menu);
ctx->widget = menu;
}
@@ -177,6 +183,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
case RCC_OPTION_RANGE_TYPE_BOOLEAN:
if (!ctx->widget) {
item = gtk_check_button_new_with_label(rccUiGetOptionName(uictx, rccUiMenuGetOption(ctx)));
+ gtk_widget_show(item);
ctx->widget = item;
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->widget), rccGetOption(rccctx, rccUiMenuGetOption(ctx)));
@@ -189,6 +196,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
if (!optnames) return -1;
list = gtk_menu_new();
+ gtk_widget_show(list);
for (i=0;optnames[i];i++) {
item = gtk_menu_item_new_with_label(optnames[i]);
gtk_widget_show(item);
@@ -196,6 +204,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
}
menu = gtk_option_menu_new();
+ gtk_widget_show(menu);
ctx->widget = menu;
gtk_option_menu_remove_menu(GTK_OPTION_MENU(menu));
@@ -218,9 +227,11 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
rcc_ui_box rccUiBoxCreate(rcc_ui_menu_context ctx, const char *title) {
GtkWidget *hbox, *label;
hbox = gtk_hbox_new(FALSE, BOX_SPACING);
+ gtk_widget_show(hbox);
gtk_container_border_width(GTK_CONTAINER(hbox), BOX_BORDER);
if ((ctx->type != RCC_UI_MENU_OPTION)||(rccUiMenuGetRangeType(ctx) != RCC_OPTION_RANGE_TYPE_BOOLEAN)) {
label = gtk_label_new(title);
+ gtk_widget_show(label);
gtk_widget_set_usize(label, TITLE_WIDTH, TITLE_HEIGHT);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
}
@@ -234,9 +245,11 @@ rcc_ui_frame rccUiFrameCreate(rcc_ui_frame_context ctx, const char *title) {
if (!ctx) return NULL;
frame = gtk_frame_new(title?title:"");
+ gtk_widget_show(frame);
gtk_container_border_width(GTK_CONTAINER(frame), FRAME_BORDER);
box = gtk_vbox_new(FALSE, FRAME_SPACING);
+ gtk_widget_show(box);
gtk_container_add(GTK_CONTAINER(frame), box);
return (rcc_ui_frame)frame;
@@ -257,7 +270,10 @@ int rccUiFrameAdd(rcc_ui_frame_context ctx, rcc_ui_box box) {
}
rcc_ui_page rccUiPageCreate(rcc_ui_context ctx, const char *title) {
- return (rcc_ui_page)gtk_vbox_new(FALSE, PAGE_SPACING);
+ GtkWidget *vbox;
+ vbox = gtk_vbox_new(FALSE, PAGE_SPACING);
+ gtk_widget_show(vbox);
+ return (rcc_ui_page)vbox;
}
int rccUiPageAdd(rcc_ui_page page, rcc_ui_frame frame) {