[Xfce4-commits] <midori:master> Use GString to build text in copy tabs extension
Christian Dywan
noreply at xfce.org
Sun Dec 11 02:58:05 CET 2011
Updating branch refs/heads/master
to 622628b9c398c7a0771636fb65465d8ebdfc1a0e (commit)
from c4cf5affc51601947296fdc2ad6de606221ed26a (commit)
commit 622628b9c398c7a0771636fb65465d8ebdfc1a0e
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Dec 11 02:53:25 2011 +0100
Use GString to build text in copy tabs extension
extensions/copy-tabs.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/extensions/copy-tabs.c b/extensions/copy-tabs.c
index 636c119..8dc1e49 100644
--- a/extensions/copy-tabs.c
+++ b/extensions/copy-tabs.c
@@ -15,19 +15,19 @@ static void
copy_tabs_apply_cb (GtkWidget* menuitem,
MidoriBrowser* browser)
{
- guint i = 0;
- GtkWidget* view;
- gchar* text = g_strdup ("");
+ GList* children;
+ GString* text = g_string_sized_new (256);
GtkClipboard* clipboard = gtk_widget_get_clipboard (menuitem,
GDK_SELECTION_CLIPBOARD);
- while ((view = midori_browser_get_nth_tab (browser, i++)))
+ children = midori_browser_get_tabs (MIDORI_BROWSER (browser));
+ for (; children; children = g_list_next (children))
{
- gchar* new_text = g_strconcat (text,
- midori_view_get_display_uri (MIDORI_VIEW (view)), "\n", NULL);
- katze_assign (text, new_text);
+ g_string_append (text, midori_view_get_display_uri (children->data));
+ g_string_append_c (text, '\n');
}
- gtk_clipboard_set_text (clipboard, text, -1);
+ gtk_clipboard_set_text (clipboard, text->str, -1);
+ g_string_free (text, TRUE);
}
static void
More information about the Xfce4-commits
mailing list