diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/prefs-dialog.c | 47 |
2 files changed, 38 insertions, 16 deletions
@@ -1,3 +1,10 @@ +2003-12-26 Christian Persch <chpe@cvs.gnome.org> + + * src/prefs-dialog.c: (prefs_dialog_finalize), + (prefs_download_path_button_clicked_cb): + + One download directory chooser is enough. + 2003-12-25 Christian Persch <chpe@cvs.gnome.org> * src/ephy-window.h: diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 75f26dc79..f8d699e59 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -76,7 +76,7 @@ void prefs_homepage_blank_button_clicked_cb (GtkWidget *button, void prefs_language_more_button_clicked_cb (GtkWidget *button, EphyDialog *dialog); void prefs_download_path_button_clicked_cb (GtkWidget *button, - EphyDialog *dialog); + PrefsDialog *dialog); void language_editor_add_button_clicked_cb (GtkWidget *button, PrefsDialog *pd); void language_editor_remove_button_clicked_cb (GtkWidget *button, @@ -326,6 +326,7 @@ enum struct PrefsDialogPrivate { + GtkWidget *download_dir_chooser; GtkTreeView *lang_treeview; GtkTreeModel *lang_model; EphyDialog *add_lang_dialog; @@ -378,6 +379,13 @@ prefs_dialog_finalize (GObject *object) g_object_unref (dialog->priv->add_lang_dialog); } + if (dialog->priv->download_dir_chooser != NULL) + { + g_object_remove_weak_pointer + (G_OBJECT (dialog->priv->download_dir_chooser), + (gpointer *) &dialog->priv->download_dir_chooser); + } + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1299,22 +1307,29 @@ download_path_response_cb (GtkDialog *fc, gint response, EphyDialog *dialog) void prefs_download_path_button_clicked_cb (GtkWidget *button, - EphyDialog *dialog) + PrefsDialog *dialog) { - GtkWidget *parent; - EphyFileChooser *fc; - - parent = ephy_dialog_get_control (dialog, properties[WINDOW_PROP].id); - - fc = ephy_file_chooser_new (_("Select a directory"), - GTK_WIDGET (parent), - GTK_FILE_CHOOSER_ACTION_OPEN, - NULL); - gtk_file_chooser_set_folder_mode (GTK_FILE_CHOOSER (fc), TRUE); + if (dialog->priv->download_dir_chooser == NULL) + { + GtkWidget *parent; + EphyFileChooser *fc; - g_signal_connect (GTK_DIALOG (fc), "response", - G_CALLBACK (download_path_response_cb), - dialog); + parent = ephy_dialog_get_control + (EPHY_DIALOG (dialog), properties[WINDOW_PROP].id); + + fc = ephy_file_chooser_new (_("Select a directory"), + GTK_WIDGET (parent), + GTK_FILE_CHOOSER_ACTION_OPEN, + NULL); + gtk_file_chooser_set_folder_mode (GTK_FILE_CHOOSER (fc), TRUE); + + g_signal_connect (GTK_DIALOG (fc), "response", + G_CALLBACK (download_path_response_cb), + dialog); + dialog->priv->download_dir_chooser = GTK_WIDGET (fc); + g_object_add_weak_pointer + (G_OBJECT (fc), (gpointer *) &dialog->priv->download_dir_chooser); + } - gtk_widget_show (GTK_WIDGET (fc)); + gtk_widget_show (dialog->priv->download_dir_chooser); } |