[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright gtkshell/arguments.c libantiright/str...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright gtkshell/arguments.c libantiright/str... |
Date: |
Mon, 05 Mar 2007 16:28:14 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/03/05 16:28:14
Modified files:
gtkshell : arguments.c
libantiright : string.c
Log message:
Split antiright_beautified_string into subfunctions.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/arguments.c?cvsroot=antiright&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/string.c?cvsroot=antiright&r1=1.6&r2=1.7
Patches:
Index: gtkshell/arguments.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/arguments.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- gtkshell/arguments.c 5 Mar 2007 01:05:42 -0000 1.11
+++ gtkshell/arguments.c 5 Mar 2007 16:28:14 -0000 1.12
@@ -81,6 +81,7 @@
event_button=(GdkEventButton *)event;
gtk_menu_popup(GTK_MENU(widget), NULL, NULL, NULL, NULL,
event_button->button, event_button->time);
+
return TRUE;
}
@@ -95,6 +96,7 @@
{
GtkWidget * oldrow;
GtkWidget * button;
+
oldrow=gsh->rows.v;
/* Set gsh->rows.v to a row within a menu.
Index: libantiright/string.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/string.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libantiright/string.c 1 Mar 2007 06:13:41 -0000 1.6
+++ libantiright/string.c 5 Mar 2007 16:28:14 -0000 1.7
@@ -37,29 +37,47 @@
return return_value;
}
-/* Free the returned value! */
-char *
-antiright_beautified_label(char *text)
+static gint
+get_last_space(const gchar * text, gint length)
{
- gint i, length;
- gchar *formatted;
-
+ gint i;
- length=strlen(text);
for(i = 0; (i < length) && (*(text+length-i) != ' '); i++);
- text+=length-i;
- length=ar_asprintf(&formatted, "%s", text);
+
+ return length - i;
+}
+
+static void
+substitute(gchar **formatted, gint length)
+{
+ gint i;
+
for (i = 0; i < length; i++)
{
- if (formatted[i] == '_')
- formatted[i]=' ';
+ if ((*formatted)[i] == '_')
+ (*formatted)[i]=' ';
/* This substitution is needed for constructing ACE
* commands on drag & drop. */
- if (formatted[i] == '@')
- formatted[i]='_';
+ if ((*formatted)[i] == '@')
+ (*formatted)[i]='_';
}
+
/* Ensure that the string is null-terminated. */
- formatted[i]='\0';
+ (*formatted)[i]='\0';
+}
+
+/* Free the returned value! */
+char *
+antiright_beautified_label(char *text)
+{
+ gint length;
+ gchar *formatted;
+
+ length=strlen(text);
+ text += get_last_space(text, length);
+ length=ar_asprintf(&formatted, "%s", text);
+ substitute(&formatted, length);
return (formatted);
}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright gtkshell/arguments.c libantiright/str...,
Jeffrey Bedard <=