diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-24 01:47:52 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-24 01:47:52 +0000 |
commit | cfaef1b6c9f33fbaa114628cf513d129bdff3c1c (patch) | |
tree | b5207f980062d0aaaa2515f76983f5386408a298 | |
parent | cd75d05e2a72eff41d6eedb61bc89ca2e1cd185d (diff) | |
download | librcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.tar.gz librcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.tar.bz2 librcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.tar.xz librcc-cfaef1b6c9f33fbaa114628cf513d129bdff3c1c.zip |
Fixes
- Dummy UI plugin
- GTK2 UI plugin
- Fixed typo: 'const rcc_string' -> 'rcc_const_string'
- Fix: Disable BDB recoding in case if recoding switched off
-rw-r--r-- | ToDo | 1 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | configure.in | 16 | ||||
-rw-r--r-- | engines/Makefile.am | 2 | ||||
-rw-r--r-- | examples/Makefile.am | 12 | ||||
-rw-r--r-- | examples/rcc-gtk-config.c | 4 | ||||
-rw-r--r-- | librcc.spec.in | 4 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/librcc.h | 6 | ||||
-rw-r--r-- | src/recode.c | 12 | ||||
-rw-r--r-- | ui/Makefile.am | 28 | ||||
-rw-r--r-- | ui/librccui.h | 6 | ||||
-rw-r--r-- | ui/null.c | 57 | ||||
-rw-r--r-- | ui/rccnames.h | 7 |
14 files changed, 128 insertions, 31 deletions
@@ -1,3 +1,4 @@ * Provide way to add to all languages several default Unicode encodings (UTF8, UTF16, UTF16BE) * Special type of classes to select only from Unicode encodings (or even just specified subset of encodings) * Multibyte(not-UTF8) support for FS classes +* SetBufferSize ( 0 - autogrow ) @@ -1 +1 @@ -0.1.1 +0.1.2 diff --git a/configure.in b/configure.in index 0699682..1be9411 100644 --- a/configure.in +++ b/configure.in @@ -70,16 +70,19 @@ AC_SUBST(XML_INCLUDES) AC_PATH_PROG(GTK_CONFIG, gtk-config, no) AM_CONDITIONAL(HAVE_GTK, [ test $GTK_CONFIG != no ]) if test $GTK_CONFIG = no; then - GTK_LIBS="" - GTK_INCLUDES="" + GTK1_LIBS="" + GTK1_INCLUDES="" HAVE_GTK=no else - GTK_LIBS="\`gtk-config --libs\`" - GTK_INCLUDES="\`gtk-config --cflags\`" + GTK1_LIBS="\`gtk-config --libs\`" + GTK1_INCLUDES="\`gtk-config --cflags\`" HAVE_GTK=yes fi -AC_SUBST(GTK_LIBS) -AC_SUBST(GTK_INCLUDES) +AC_SUBST(GTK1_LIBS) +AC_SUBST(GTK1_INCLUDES) + +PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.0, HAVE_GTK2=yes, HAVE_GTK2=no) +AM_CONDITIONAL(HAVE_GTK2, [ test $HAVE_GTK2 = yes ]) AC_CHECK_HEADER(dlfcn.h, [AC_CHECK_LIB(dl, dlopen, [ AC_DEFINE(HAVE_DLOPEN,1,[Defines if dlopen is available]) @@ -173,6 +176,7 @@ echo " Multilanguage support with DB4: $HAVE_BDB" echo "" echo "User Interfaces:" echo " GTK User Interface: $HAVE_GTK" +echo " GTK2 User Interface: $HAVE_GTK2" echo "" echo "" echo "" diff --git a/engines/Makefile.am b/engines/Makefile.am index 307fddf..7226682 100644 --- a/engines/Makefile.am +++ b/engines/Makefile.am @@ -8,4 +8,4 @@ librussian_la_SOURCES = russian.c librussian_la_LDFLAGS = -module -avoid-version -export-symbols-regex "rccGetInfo" endif -INCLUDES = -I../src @RCD_INCLUDES@ +AM_CPPFLAGS = -I../src @RCD_INCLUDES@ diff --git a/examples/Makefile.am b/examples/Makefile.am index 15df761..6886a77 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -5,7 +5,15 @@ example_LDADD= ../src/librcc.la 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@ +rcc_gtk_config_LDADD=../ui/librccgtk.la @GTK1_LIBS@ +rcc_gtk_config_CPPFLAGS = @GTK1_INCLUDES@ -I../src -I../ui +endif + +if HAVE_GTK2 +bin_PROGRAMS+= rcc-gtk2-config +rcc_gtk2_config_SOURCES = rcc-gtk-config.c +rcc_gtk2_config_LDADD=../ui/librccgtk2.la @GTK2_LIBS@ +rcc_gtk2_config_CPPFLAGS = @GTK2_CFLAGS@ -I../src -I../ui endif EXTRA_DIST= input-russian.txt rcc.xml rcc-example.xml mpg123-rcc.patch @@ -13,4 +21,4 @@ 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 @GTK_INCLUDES@ +AM_CPPFLAGS = -I../src -I../ui diff --git a/examples/rcc-gtk-config.c b/examples/rcc-gtk-config.c index a46350f..7758f09 100644 --- a/examples/rcc-gtk-config.c +++ b/examples/rcc-gtk-config.c @@ -10,6 +10,9 @@ static rcc_class classes[] = { { "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 }, + { "ftp", RCC_CLASS_STANDARD, NULL, NULL, "FTP Encoding", 0 }, + { "http", RCC_CLASS_STANDARD, NULL, NULL, "HTTP Encoding", 0 }, + { "ssh", RCC_CLASS_STANDARD, NULL, NULL, "SSH Encoding", 0 }, { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, NULL, 0 }, { NULL } }; @@ -47,6 +50,7 @@ int main (int argc, char *argv[]) window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_policy(GTK_WINDOW (window1), FALSE, FALSE, TRUE); gtk_window_set_title (GTK_WINDOW (window1), "LibRCC Config"); + gtk_window_set_wmclass (GTK_WINDOW(window1), "librcc", "libRCC"); gtk_widget_show(window1); box = rccUiGetPage(uictx, NULL); diff --git a/librcc.spec.in b/librcc.spec.in index 768d6c9..3a193a3 100644 --- a/librcc.spec.in +++ b/librcc.spec.in @@ -60,7 +60,7 @@ 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 755 examples/rcc-gtk*-config $RPM_BUILD_ROOT/%{prefix}/bin install -m 644 examples/rcc.xml $RPM_BUILD_ROOT/etc @@ -80,7 +80,7 @@ rm -rf $RPM_BUILD_ROOT /etc/rcc.xml %{prefix}/lib/lib*.so.* %{prefix}/lib/rcc/ -%{prefix}/bin/rcc-gtk-config +%{prefix}/bin/rcc-gtk*-config %files devel %defattr(-, root, root) diff --git a/src/Makefile.am b/src/Makefile.am index 5c105f3..50c6836 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,7 +20,7 @@ librcc_la_SOURCES = librcc.c \ internal.h include_HEADERS = librcc.h -INCLUDES = -I../src -DLIBRCC_DATA_DIR=\"${pkgdatadir}\" @XML_INCLUDES@ @DLOPEN_INCLUDES@ @RCD_INCLUDES@ @ENCA_INCLUDES@ @BDB_INCLUDES@ +AM_CPPFLAGS = -I../src -DLIBRCC_DATA_DIR=\"${pkgdatadir}\" @XML_INCLUDES@ @DLOPEN_INCLUDES@ @RCD_INCLUDES@ @ENCA_INCLUDES@ @BDB_INCLUDES@ librcc_la_LIBADD = @XML_LIBS@ @DLOPEN_LIBS@ @RCD_LIBS@ @ENCA_LIBS@ @BDB_LIBS@ librcc_la_LDFLAGS = -version-info @LIBRCC_VERSION_INFO@ diff --git a/src/librcc.h b/src/librcc.h index 6b28813..a70d6df 100644 --- a/src/librcc.h +++ b/src/librcc.h @@ -952,7 +952,7 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, * @param rlen in rlen the size of recoded string will be returned. * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. */ -char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, const rcc_string buf, size_t *rlen); +char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, rcc_const_string buf, size_t *rlen); /** * Recode string between different encoding classes. The conversion is relays on rccSizedFrom * and rccSizedTo functions. @@ -1008,7 +1008,7 @@ rcc_string rccSizedFromCharset(rcc_context ctx, const char *charset, const char * @param rlen in rlen the size of recoded string will be returned. * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. */ -char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string buf, size_t *rlen); +char *rccSizedToCharset(rcc_context ctx, const char *charset, rcc_const_string buf, size_t *rlen); /** * Recode string between specified encoding class and encoding. * @@ -1023,7 +1023,7 @@ char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string b * @param rlen in rlen the size of recoded string will be returned. * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. */ -char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, const rcc_string buf, size_t len, size_t *rlen); +char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen); /** * Recode string between specified encoding and encoding class. * diff --git a/src/recode.c b/src/recode.c index 4016186..a1b7f31 100644 --- a/src/recode.c +++ b/src/recode.c @@ -48,6 +48,10 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, ret = rccStringSizedCheck(buf, len); if (ret) return NULL; + language_id = rccGetCurrentLanguage(ctx); + if (language_id == (rcc_language_id)-1) return NULL; + if (!strcasecmp(ctx->languages[language_id]->sn, "off")) return NULL; + usedb4 = rccGetOption(ctx, RCC_OPTION_LEARNING_MODE); if (usedb4&RCC_OPTION_LEARNING_FLAG_USE) { @@ -61,8 +65,6 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, err = rccConfigure(ctx); if (err) return NULL; - language_id = rccGetCurrentLanguage(ctx); - charset_id = rccIConvAuto(ctx, class_id, buf, len); if (charset_id != (rcc_autocharset_id)-1) icnv = ctx->iconv_auto[charset_id]; else icnv = ctx->iconv_from[class_id]; @@ -84,7 +86,7 @@ rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, return result; } -char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, const rcc_string buf, size_t *rlen) { +char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, rcc_const_string buf, size_t *rlen) { int err; size_t newlen; char *result; @@ -280,7 +282,7 @@ rcc_string rccSizedFromCharset(rcc_context ctx, const char *charset, const char return rccCreateString(language_id, buf, len); } -char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string buf, size_t *rlen) { +char *rccSizedToCharset(rcc_context ctx, const char *charset, rcc_const_string buf, size_t *rlen) { rcc_iconv icnv; size_t res; @@ -304,7 +306,7 @@ char *rccSizedToCharset(rcc_context ctx, const char *charset, const rcc_string b } /* Convert from class_id to Charset */ -char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, const rcc_string buf, size_t len, size_t *rlen) { +char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen) { size_t res; rcc_iconv icnv; const char *str; diff --git a/ui/Makefile.am b/ui/Makefile.am index 69395fb..c41cc8c 100644 --- a/ui/Makefile.am +++ b/ui/Makefile.am @@ -1,13 +1,35 @@ +lib_LTLIBRARIES = librccui.la +librccui_la_SOURCES = librccui.c \ + rccmenu.c rccmenu.h \ + rccnames.c rccnames.h \ + internal.h \ + null.c +librccui_la_LIBADD = @XML_LIBS@ ../src/librcc.la +librccui_la_LDFLAGS = -version-info @LIBRCC_VERSION_INFO@ + if HAVE_GTK -lib_LTLIBRARIES = librccgtk.la +lib_LTLIBRARIES += librccgtk.la librccgtk_la_SOURCES = librccui.c \ rccmenu.c rccmenu.h \ rccnames.c rccnames.h \ internal.h \ gtk.c -librccgtk_la_LIBADD = @GTK_LIBS@ @XML_LIBS@ ../src/librcc.la +librccgtk_la_LIBADD = @GTK1_LIBS@ @XML_LIBS@ ../src/librcc.la librccgtk_la_LDFLAGS = -version-info @LIBRCC_VERSION_INFO@ +librccgtk_la_CPPFLAGS = -I../src @XML_INCLUDES@ @GTK1_INCLUDES@ +endif + +if HAVE_GTK2 +lib_LTLIBRARIES += librccgtk2.la +librccgtk2_la_SOURCES = librccui.c \ + rccmenu.c rccmenu.h \ + rccnames.c rccnames.h \ + internal.h \ + gtk.c +librccgtk2_la_LIBADD = @GTK2_LIBS@ @XML_LIBS@ ../src/librcc.la +librccgtk2_la_LDFLAGS = -version-info @LIBRCC_VERSION_INFO@ +librccgtk2_la_CPPFLAGS = -I../src @XML_INCLUDES@ @GTK2_CFLAGS@ endif -INCLUDES = -I../src @GTK_INCLUDES@ @XML_INCLUDES@ +AM_CPPFLAGS = -I../src @XML_INCLUDES@ include_HEADERS = librccui.h diff --git a/ui/librccui.h b/ui/librccui.h index cb17649..2c72678 100644 --- a/ui/librccui.h +++ b/ui/librccui.h @@ -62,6 +62,12 @@ typedef struct rcc_ui_page_name_t rcc_ui_page_name; rcc_ui_page_name *rccUiGetDefaultPageName(); +const char *rccUiGetLanguageName(rcc_ui_context ctx, const char *lang); +const char *rccUiGetCharsetName(rcc_ui_context ctx, const char *charset); +const char *rccUiGetEngineName(rcc_ui_context ctx, const char *engine); +const char *rccUiGetClassName(rcc_ui_context ctx, const char *cl); +const char *rccUiGetOptionName(rcc_ui_context ctx, rcc_option option); +const char *rccUiGetOptionValueName(rcc_ui_context ctx, rcc_option option, rcc_option_value value); /******************************************************************************* ************************************ API *************************************** diff --git a/ui/null.c b/ui/null.c new file mode 100644 index 0000000..36ad032 --- /dev/null +++ b/ui/null.c @@ -0,0 +1,57 @@ +#include <stdio.h> +#include <librcc.h> + +#include "internal.h" + +rcc_ui_internal rccUiCreateInternal(rcc_ui_context ctx) { + return NULL; +} + +void rccUiFreeInternal(rcc_ui_context ctx) { +} + +rcc_ui_widget rccUiMenuCreateWidget(rcc_ui_menu_context ctx) { + return NULL; +} + +void rccUiMenuFreeWidget(rcc_ui_menu_context ctx) { +} + +rcc_ui_id rccUiMenuGet(rcc_ui_menu_context ctx) { + return 0; +} + +int rccUiMenuSet(rcc_ui_menu_context ctx, rcc_ui_id id) { + return 0; +} + + +int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) { + ctx->widget = NULL; + return 0; +} + + +rcc_ui_box rccUiBoxCreate(rcc_ui_menu_context ctx, const char *title) { + return (rcc_ui_box)NULL; +} + +rcc_ui_frame rccUiFrameCreate(rcc_ui_frame_context ctx, const char *title) { + return (rcc_ui_frame)NULL; +} + +void rccUiFrameFree(rcc_ui_frame_context ctx) { +} + + +int rccUiFrameAdd(rcc_ui_frame_context ctx, rcc_ui_box box) { + return 0; +} + +rcc_ui_page rccUiPageCreate(rcc_ui_context ctx, const char *title) { + return (rcc_ui_page)NULL; +} + +int rccUiPageAdd(rcc_ui_page page, rcc_ui_frame frame) { + return 0; +} diff --git a/ui/rccnames.h b/ui/rccnames.h index b026797..bfb022a 100644 --- a/ui/rccnames.h +++ b/ui/rccnames.h @@ -11,18 +11,11 @@ extern rcc_name *rcc_default_class_names; extern rcc_name *rcc_default_charset_names; extern rcc_name *rcc_default_engine_names; - rcc_name *rccUiGetLanguageRccName(rcc_ui_context ctx, const char *lang); -const char *rccUiGetLanguageName(rcc_ui_context ctx, const char *lang); rcc_name *rccUiGetCharsetRccName(rcc_ui_context ctx, const char *charset); -const char *rccUiGetCharsetName(rcc_ui_context ctx, const char *charset); rcc_name *rccUiGetEngineRccName(rcc_ui_context ctx, const char *engine); -const char *rccUiGetEngineName(rcc_ui_context ctx, const char *engine); rcc_name *rccUiGetClassRccName(rcc_ui_context ctx, const char *cl); -const char *rccUiGetClassName(rcc_ui_context ctx, const char *cl); rcc_option_name *rccUiGetOptionRccName(rcc_ui_context ctx, rcc_option option); -const char *rccUiGetOptionName(rcc_ui_context ctx, rcc_option option); -const char *rccUiGetOptionValueName(rcc_ui_context ctx, rcc_option option, rcc_option_value value); #endif /* _RCC_UI_NAMES_H */ |