1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * arch-tag: Implementation of Rhythmbox dialog wrapper functions
5 * Copyright (C) 2002 Jorn Baayen
6 * Copyright (C) 2004 Colin Walters <walters@redhat.com>
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, or (at your option)
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.
26 #include <glib/gi18n.h>
30 #include <glib/gprintf.h>
35 #include "rb-dialog.h"
36 #include "rb-stock-icons.h"
39 rb_error_dialog (GtkWindow
*parent
,
41 const char *secondary
,
48 va_start (args
, secondary
);
49 g_vasprintf (&text
, secondary
, args
);
52 dialog
= gtk_message_dialog_new (parent
,
53 GTK_DIALOG_DESTROY_WITH_PARENT
,
58 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog
),
61 gtk_window_set_title (GTK_WINDOW (dialog
), "");
63 gtk_container_set_border_width (GTK_CONTAINER (dialog
), 6);
65 g_signal_connect (dialog
, "response", G_CALLBACK (gtk_widget_destroy
), NULL
);
67 gtk_widget_show (dialog
);
73 rb_file_chooser_new (const char *title
,
75 GtkFileChooserAction action
,
80 if (action
== GTK_FILE_CHOOSER_ACTION_OPEN
||
81 action
== GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
||
82 action
== GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
) {
83 dialog
= gtk_file_chooser_dialog_new (title
, parent
,
85 GTK_STOCK_CANCEL
, GTK_RESPONSE_CANCEL
,
86 GTK_STOCK_OPEN
, GTK_RESPONSE_ACCEPT
,
88 gtk_dialog_set_default_response (GTK_DIALOG (dialog
),
90 } else if (action
== GTK_FILE_CHOOSER_ACTION_SAVE
) {
91 dialog
= gtk_file_chooser_dialog_new (title
, parent
,
93 GTK_STOCK_CANCEL
, GTK_RESPONSE_CANCEL
,
94 GTK_STOCK_SAVE
, GTK_RESPONSE_ACCEPT
,
96 gtk_dialog_set_default_response (GTK_DIALOG (dialog
),
98 #if GTK_MINOR_VERSION >= 8
99 gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog
), TRUE
);
102 g_assert_not_reached ();
106 gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog
), local_only
);
108 if (parent
!= NULL
) {
109 gtk_window_set_transient_for (GTK_WINDOW (dialog
), GTK_WINDOW (parent
));
110 gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog
), TRUE
);
113 gtk_widget_show_all (dialog
);