[rhythmbox] library: don't use gtk_dialog_run for library location selection
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] library: don't use gtk_dialog_run for library location selection
- Date: Fri, 10 Feb 2012 10:33:40 +0000 (UTC)
commit 8b3f84257a26844906ed284f354af29d84e652c2
Author: Jonathan Matthew <jonathan d14n org>
Date: Fri Feb 10 20:33:07 2012 +1000
library: don't use gtk_dialog_run for library location selection
sources/rb-library-source.c | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/sources/rb-library-source.c b/sources/rb-library-source.c
index da7b87f..d9b2014 100644
--- a/sources/rb-library-source.c
+++ b/sources/rb-library-source.c
@@ -361,31 +361,40 @@ rb_library_source_profile_settings_clicked_cb (GtkButton *button, RBLibrarySourc
}
static void
-rb_library_source_location_button_clicked_cb (GtkButton *button, RBLibrarySource *source)
+location_response_cb (GtkDialog *dialog, int response, RBLibrarySource *source)
{
- GtkWidget *dialog;
+ char *uri;
- dialog = rb_file_chooser_new (_("Choose Library Location"), GTK_WINDOW (source->priv->shell_prefs),
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, FALSE);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
- char *uri;
- char *path;
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+ if (uri == NULL) {
+ uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog));
+ }
+ gtk_widget_destroy (GTK_WIDGET (dialog));
- uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
- if (uri == NULL) {
- uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog));
- }
+ if (response == GTK_RESPONSE_ACCEPT) {
+ char *path;
path = g_uri_unescape_string (uri, NULL);
gtk_entry_set_text (GTK_ENTRY (source->priv->library_location_entry), path);
rb_library_source_library_location_cb (GTK_ENTRY (source->priv->library_location_entry),
NULL, source);
- g_free (uri);
g_free (path);
}
+ g_free (uri);
+}
- gtk_widget_destroy (GTK_WIDGET (dialog));
+static void
+rb_library_source_location_button_clicked_cb (GtkButton *button, RBLibrarySource *source)
+{
+ GtkWidget *dialog;
+
+ dialog = rb_file_chooser_new (_("Choose Library Location"),
+ GTK_WINDOW (source->priv->shell_prefs),
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ FALSE);
+ g_signal_connect (dialog, "response", G_CALLBACK (location_response_cb), source);
+ gtk_widget_show_all (dialog);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]