Use GString to build text in copy tabs extension

This commit is contained in:
Christian Dywan 2011-12-11 02:53:25 +01:00
parent c4cf5affc5
commit 622628b9c3

View file

@ -15,19 +15,19 @@ static void
copy_tabs_apply_cb (GtkWidget* menuitem, copy_tabs_apply_cb (GtkWidget* menuitem,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
guint i = 0; GList* children;
GtkWidget* view; GString* text = g_string_sized_new (256);
gchar* text = g_strdup ("");
GtkClipboard* clipboard = gtk_widget_get_clipboard (menuitem, GtkClipboard* clipboard = gtk_widget_get_clipboard (menuitem,
GDK_SELECTION_CLIPBOARD); 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, g_string_append (text, midori_view_get_display_uri (children->data));
midori_view_get_display_uri (MIDORI_VIEW (view)), "\n", NULL); g_string_append_c (text, '\n');
katze_assign (text, new_text);
} }
gtk_clipboard_set_text (clipboard, text, -1); gtk_clipboard_set_text (clipboard, text->str, -1);
g_string_free (text, TRUE);
} }
static void static void