Updated Finnish translation
[rhythmbox.git] / daapsharing / rb-daap-dialog.c
blob55bd8b9524b6a0fc9a855e43673a6d76fcb83d31
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
3 * Implementation of DAAP (iTunes Music Sharing) dialogs
4 * (password & name collision)
6 * Copyright (C) 2005 Charles Schmidt <cschmidt2@emich.edu>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "config.h"
26 #include <string.h>
28 #include <glib/gi18n.h>
29 #include <glib/gprintf.h>
30 #include <gtk/gtk.h>
32 #include "rb-daap-dialog.h"
34 char *
35 rb_daap_collision_dialog_new_run (GtkWindow *parent,
36 const char *old_name)
38 GtkWidget *dialog;
39 GtkWidget *hbox;
40 GtkWidget *image;
41 GtkWidget *vbox;
42 char *s;
43 GtkWidget *label;
44 GtkWidget *entry;
45 gint resp;
47 dialog = gtk_dialog_new_with_buttons (_("Invalid share name"),
48 parent,
49 GTK_DIALOG_DESTROY_WITH_PARENT,
50 GTK_STOCK_OK,
51 GTK_RESPONSE_OK,
52 NULL);
53 gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
54 gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
56 hbox = gtk_hbox_new (FALSE, 6);
57 gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
58 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
60 image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
61 gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
63 vbox = gtk_vbox_new (FALSE, 6);
64 gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
66 s = g_strdup_printf (_("The shared music name '%s' is already taken. Please choose another."), old_name);
67 label = gtk_label_new (s);
68 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
69 g_free (s);
71 hbox = gtk_hbox_new (FALSE, 12);
72 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
74 label = gtk_label_new_with_mnemonic (_("Shared music _name:"));
75 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
77 entry = gtk_entry_new ();
78 gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
79 gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
80 gtk_entry_set_text (GTK_ENTRY (entry), old_name);
81 gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
83 gtk_widget_show_all (dialog);
85 do {
86 resp = gtk_dialog_run (GTK_DIALOG (dialog));
87 } while (resp != GTK_RESPONSE_OK);
89 s = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
90 gtk_widget_destroy (dialog);
92 return s;