[Xfce4-commits] <midori:master> Calculate action name length for --help-execute
Christian Dywan
noreply at xfce.org
Sun May 13 04:48:01 CEST 2012
Updating branch refs/heads/master
to fb6b01759d67d688447003048ea34d466dd9c035 (commit)
from 184a664731cb659aa01dd74566e6f799b5e830d0 (commit)
commit fb6b01759d67d688447003048ea34d466dd9c035
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun May 13 04:46:29 2012 +0200
Calculate action name length for --help-execute
Fixes: https://bugs.launchpad.net/midori/+bug/998597
midori/main.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/midori/main.c b/midori/main.c
index cb4e1c4..7db7522 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -2020,11 +2020,21 @@ main (int argc,
MidoriBrowser* browser = midori_browser_new ();
GtkActionGroup* action_group = midori_browser_get_action_group (browser);
GList* actions = gtk_action_group_list_actions (action_group);
+ GList* temp = actions;
+ guint length = 1;
+ gchar* space;
+
+ for (; temp; temp = g_list_next (temp))
+ {
+ GtkAction* action = temp->data;
+ length = MAX (length, 1 + strlen (gtk_action_get_name (action)));
+ }
+
+ space = g_strnfill (length, ' ');
for (; actions; actions = g_list_next (actions))
{
GtkAction* action = actions->data;
const gchar* name = gtk_action_get_name (action);
- const gchar* space = " ";
gchar* padding = g_strndup (space, strlen (space) - strlen (name));
gchar* label = katze_object_get_string (action, "label");
gchar* stripped = katze_strip_mnemonics (label);
@@ -2036,6 +2046,7 @@ main (int argc,
g_free (label);
g_free (stripped);
}
+ g_free (space);
g_list_free (actions);
gtk_widget_destroy (GTK_WIDGET (browser));
return 0;
More information about the Xfce4-commits
mailing list