Now use GLib case conversion functions, with the added benefit of UTF8
support, instead of libgeda string_tolower() and
string_toupper(). Consequently these two functions have been removed.
---
gschem/src/o_text.c | 10 ++++++----
gschem/src/x_dialog.c | 8 +++++---
libgeda/include/prototype.h | 2 --
libgeda/src/s_basic.c | 35 -----------------------------------
libgeda/src/s_clib.c | 3 +--
5 files changed, 12 insertions(+), 46 deletions(-)
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index edf7b65..83f8e97 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -291,15 +291,17 @@ void o_text_start(GSCHEM_TOPLEVEL *w_current, int w_x,
int w_y)
s_delete_object_glist(toplevel, toplevel->page_current->attrib_place_list);
toplevel->page_current->attrib_place_list = NULL;
- value = toplevel->current_attribute;
-
switch(w_current->text_caps) {
case(LOWER):
- string_tolower(value, value);
+ value = toplevel->current_attribute;
+ toplevel->current_attribute = g_utf8_strdown (value, -1);
+ g_free (value);
break;
case(UPPER):
- string_toupper(value, value);
+ value = toplevel->current_attribute;
+ toplevel->current_attribute = g_utf8_strup (value, -1);
+ g_free (value);
break;
case(BOTH):
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index c25f468..0d0db44 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -120,17 +120,18 @@ void text_input_dialog_apply(GtkWidget *w,
GSCHEM_TOPLEVEL *w_current)
string = gtk_text_iter_get_text (&start, &end);
if (string[0] != '\0' ) {
+ gchar *tmp = NULL;
len = strlen(string);
#if DEBUG
printf("text was: _%s_ %d\n", string, len);
#endif
switch(w_current->text_caps) {
case(LOWER):
- string_tolower(string, string);
+ tmp = g_utf8_strdown (string, -1);
break;
case(UPPER):
- string_toupper(string, string);
+ tmp = g_utf8_strup (string, -1);
break;
case(BOTH):
@@ -143,7 +144,8 @@ void text_input_dialog_apply(GtkWidget *w, GSCHEM_TOPLEVEL
*w_current)
select_all_text_in_textview(GTK_TEXT_VIEW(tientry));
gtk_widget_grab_focus(tientry);
- o_attrib_set_string(toplevel, string);
+ o_attrib_set_string(toplevel, tmp == NULL ? string : tmp);
+ g_free (tmp);
toplevel->page_current->CHANGED=1;
w_current->event_state = DRAWTEXT;
w_current->inside_action = 1;
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 77700df..3dc1ee3 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -342,8 +342,6 @@ void s_delete(TOPLEVEL *toplevel, OBJECT *o_current);
void s_delete_list_fromstart(TOPLEVEL *toplevel, OBJECT *start);
void s_delete_object_glist(TOPLEVEL *toplevel, GList *list);
OBJECT *s_remove(TOPLEVEL *toplevel, OBJECT *object);
-void string_toupper(char *in, char *out);
-void string_tolower(char *in, char *out);
char *remove_nl(char *string);
char *remove_last_nl(char *string);
gchar *s_expand_env_variables (const gchar *string);
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index 1d93135..935f73e 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -512,41 +512,6 @@ OBJECT *s_remove(TOPLEVEL *toplevel, OBJECT *object)
* \par Function Description
*
*/
-/* Done */
-void string_toupper(char *in, char *out)
-{
- int len;
- int i;
-
- len = strlen(in);
-
- for (i = 0 ; i < len ; i++) {
- out[i] = toupper(in[i]);
- }
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void string_tolower(char *in, char *out)
-{
- int len;
- int i;
-
- len = strlen(in);
-
- for (i = 0 ; i < len ; i++) {
- out[i] = tolower(in[i]);
- }
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
/* used by o_text_read */
char *remove_nl(char *string)
{
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index f3057c7..66d75fd 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -606,8 +606,7 @@ static void refresh_directory (CLibSource *source)
if (source_has_symbol (source, entry) != NULL) continue;
/* skip filenames which don't have the right suffix. */
- low_entry = g_strdup(entry);
- string_tolower (low_entry, low_entry);
+ low_entry = g_utf8_strdown (entry, -1);
if (!g_str_has_suffix (low_entry, SYM_FILENAME_FILTER)) {
g_free (low_entry);
continue;
--
1.5.6
_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev