Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- UTF-8 support

- libpopt support
  • Loading branch information...
commit d614181e3bc7c0c6c4a7e43df142f085f19e34bd 1 parent e48fe6e
andreas99 authored
View
8 ChangeLog
@@ -1,3 +1,11 @@
+2003-11-16 AV <andreas99@users.sourceforge.net>
+ * configure.in: added support for libpopt
+
+ * src/gtkcompletionline.cc: added UTF-8 support for input and output
+
+ * src/main.cc: added UTF-8 support for input and output and
+ added an option to place gmrun (-geometry)
+
2002-06-05 EJ <sonofkojak@users.sourceforge.net>
* src/history.cc (append): Previously, an item was not placed in
View
36 config.h.in
@@ -1,4 +1,8 @@
-/* config.h.in. Generated from configure.in by autoheader. */
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
#undef ENABLE_NLS
#undef HAVE_CATGETS
#undef HAVE_GETTEXT
@@ -9,41 +13,21 @@
#undef PACKAGE_DATA_DIR
#undef PACKAGE_SOURCE_DIR
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
- */
+/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
- */
+/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
- */
+/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
/* Name of package */
#undef PACKAGE
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
/* Version number of package */
#undef VERSION
+
View
12 configure.in
@@ -39,7 +39,17 @@ AC_HEADER_STDC
AC_PROG_CXX
AC_PATH_STLPORT_LIB
AC_PATH_STLPORT_INC
-
+
+
+AC_CHECK_FUNC( poptGetContext,
+ ,
+ AC_CHECK_LIB(popt,
+ poptGetContext,
+ LIBS="${LIBS} -lpopt",
+ echo "*** You need to get libpopt ***";exit
+ )
+ )
+
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.0.4
gobject-2.0 >= 2.0.4
gthread-2.0 >= 2.0.4)
View
20 src/gtkcompletionline.cc
@@ -1,5 +1,5 @@
/*****************************************************************************
- * $Id: gtkcompletionline.cc,v 1.32 2003/11/16 10:43:32 andreas99 Exp $
+ * $Id: gtkcompletionline.cc,v 1.33 2003/11/16 10:55:07 andreas99 Exp $
* Copyright (C) 2000, Mishoo
* Author: Mihai Bazon Email: mishoo@fenrir.infoiasi.ro
*
@@ -214,7 +214,8 @@ void gtk_completion_line_last_history_item(GtkCompletionLine* object) {
if (last_item) {
object->hist->set_default("");
const char* txt = object->hist->prev();
- gtk_entry_set_text(GTK_ENTRY(object), txt);
+ gtk_entry_set_text(GTK_ENTRY(object),
+ g_locale_to_utf8 (txt, -1, NULL, NULL, NULL));
gtk_entry_select_region(GTK_ENTRY(object), 0, strlen(txt));
}
}
@@ -320,7 +321,8 @@ set_words(GtkCompletionLine *object, const vector<string>& words, int pos = -1)
gtk_signal_emit_by_name(GTK_OBJECT(object), "ext_handler", NULL);
}
- gtk_entry_set_text(GTK_ENTRY(object), ss.str().c_str());
+ gtk_entry_set_text(GTK_ENTRY(object),
+ g_locale_to_utf8 (ss.str().c_str(), -1, NULL, NULL, NULL));
gtk_editable_set_position(GTK_EDITABLE(object), where);
return where;
}
@@ -782,14 +784,16 @@ static void
up_history(GtkCompletionLine* cl)
{
cl->hist->set_default(gtk_entry_get_text(GTK_ENTRY(cl)));
- gtk_entry_set_text(GTK_ENTRY(cl), cl->hist->prev());
+ gtk_entry_set_text(GTK_ENTRY(cl),
+ g_locale_to_utf8 (cl->hist->prev(), -1, NULL, NULL, NULL));
}
static void
down_history(GtkCompletionLine* cl)
{
cl->hist->set_default(gtk_entry_get_text(GTK_ENTRY(cl)));
- gtk_entry_set_text(GTK_ENTRY(cl), cl->hist->next());
+ gtk_entry_set_text(GTK_ENTRY(cl),
+ g_locale_to_utf8 (cl->hist->next(), -1, NULL, NULL, NULL));
}
static int
@@ -813,7 +817,8 @@ search_back_history(GtkCompletionLine* cl, bool avance, bool begin)
if (i != string::npos && !(begin && i != 0)) {
const char *tmp = gtk_entry_get_text(GTK_ENTRY(cl));
if (!(avance && strcmp(tmp, histext) == 0)) {
- gtk_entry_set_text(GTK_ENTRY(cl), histext);
+ gtk_entry_set_text(GTK_ENTRY(cl),
+ g_locale_to_utf8 (histext, -1, NULL, NULL, NULL));
gtk_entry_select_region(GTK_ENTRY(cl),
i, i + cl->hist_word->length());
gtk_signal_emit_by_name(GTK_OBJECT(cl), "search_letter");
@@ -855,7 +860,8 @@ search_forward_history(GtkCompletionLine* cl, bool avance, bool begin)
if (i != string::npos && !(begin && i != 0)) {
const char *tmp = gtk_entry_get_text(GTK_ENTRY(cl));
if (!(avance && strcmp(tmp, histext) == 0)) {
- gtk_entry_set_text(GTK_ENTRY(cl), histext);
+ gtk_entry_set_text(GTK_ENTRY(cl),
+ g_locale_to_utf8 (histext, -1, NULL, NULL, NULL));
gtk_entry_select_region(GTK_ENTRY(cl),
i, i + cl->hist_word->length());
gtk_signal_emit_by_name(GTK_OBJECT(cl), "search_letter");
View
64 src/main.cc
@@ -1,5 +1,5 @@
/*****************************************************************************
- * $Id: main.cc,v 1.25 2003/11/16 10:43:32 andreas99 Exp $
+ * $Id: main.cc,v 1.26 2003/11/16 10:55:07 andreas99 Exp $
* Copyright (C) 2000, Mishoo
* Author: Mihai Bazon Email: mishoo@fenrir.infoiasi.ro
*
@@ -19,6 +19,8 @@
#include <vector>
#include <algorithm>
#include <iterator>
+#include <popt.h>
+
using namespace std;
#ifdef MTRACE
@@ -155,7 +157,7 @@ run_the_command(const std::string& command, struct gigi* g)
{
string prog;
std::vector<char*> argv;
-
+
string cmd = command + ' ';
istringstream iss(cmd);
#ifdef DEBUG
@@ -277,7 +279,11 @@ on_ext_handler(GtkCompletionLine *cl, const char* ext, struct gigi* g)
static void
on_compline_runwithterm(GtkCompletionLine *cl, struct gigi* g)
{
- string command(gtk_entry_get_text(GTK_ENTRY(cl)));
+ string command(g_locale_from_utf8 (gtk_entry_get_text(GTK_ENTRY(cl)),
+ -1,
+ NULL,
+ NULL,
+ NULL));
string tmp;
string term;
@@ -381,7 +387,12 @@ on_search_not_found(GtkCompletionLine *cl, struct gigi *g)
static bool
url_check(GtkCompletionLine *cl, struct gigi *g)
{
- string text(gtk_entry_get_text(GTK_ENTRY(cl)));
+ string text(g_locale_from_utf8 (gtk_entry_get_text(GTK_ENTRY(cl)),
+ -1,
+ NULL,
+ NULL,
+ NULL));
+
string::size_type i;
string::size_type sp;
@@ -478,7 +489,12 @@ on_compline_activated(GtkCompletionLine *cl, struct gigi *g)
if (ext_check(cl, g))
return;
- string command = gtk_entry_get_text(GTK_ENTRY(cl));
+ string command = g_locale_from_utf8 (gtk_entry_get_text(GTK_ENTRY(cl)),
+ -1,
+ NULL,
+ NULL,
+ NULL);
+
string::size_type i;
i = command.find_first_not_of(" \t");
@@ -512,7 +528,7 @@ int main(int argc, char **argv)
GtkWidget *compline;
GtkWidget *label_search;
struct gigi g;
-
+
#ifdef MTRACE
mtrace();
#endif
@@ -604,12 +620,42 @@ int main(int argc, char **argv)
}
gtk_box_pack_start(GTK_BOX(hbox), compline, TRUE, TRUE, 0);
-
+
int prefs_top = 80;
int prefs_left = 100;
configuration.get_int("Top", prefs_top);
- configuration.get_int("Left", prefs_left);
- gtk_widget_set_uposition(win, prefs_left, prefs_top);
+ configuration.get_int("Left", prefs_left);
+
+ // parse commandline options
+ gboolean geo_parsed;
+ char geo_option[30] = "";
+ char *geoptr;
+ poptContext context;
+ int option;
+
+ geoptr = geo_option;
+
+ struct poptOption options[] = {
+ { "geometry", 'g', POPT_ARG_STRING | POPT_ARGFLAG_ONEDASH,
+ &geoptr, 0, "This option specifies the initial "
+ "size and location of the window.", NULL },
+ POPT_AUTOHELP
+ { NULL, '\0', 0, NULL, 0 }
+ };
+
+ context = poptGetContext("popt1", argc, (const char**) argv, options, 0);
+ option = poptGetNextOpt (context);
+
+ if (strcmp (geoptr, ""))
+ {
+ geo_parsed = gtk_window_parse_geometry (GTK_WINDOW (win),
+ geoptr);
+ }
+ else
+ {
+ gtk_widget_set_uposition(win, prefs_left, prefs_top);
+ }
+
gtk_widget_show(win);
gtk_window_set_focus(GTK_WINDOW(win), compline);
Please sign in to comment.
Something went wrong with that request. Please try again.