From 593e026cf2d2f1e5671f7ecb58330f4c5ab1ba99 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 17 Jun 2003 21:14:27 +0000 Subject: Fix wrong cast of GtkDialog to GtkWindow. 2003-06-17 Christian Persch * src/prefs-dialog.c: Fix wrong cast of GtkDialog to GtkWindow. * data/glade/epiphany.glade: * src/pdm-dialog.c: (pdm_dialog_show_help), (pdm_dialog_response_cb): Implement help button for pdm dialogue. --- src/pdm-dialog.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'src/pdm-dialog.c') diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index c7119b065..f6370f419 100755 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -79,6 +79,8 @@ struct PdmDialogPrivate enum { + PROP_WINDOW, + PROP_NOTEBOOK, PROP_COOKIES_TREEVIEW, PROP_COOKIES_REMOVE, PROP_PASSWORDS_TREEVIEW, @@ -104,6 +106,9 @@ enum static const EphyDialogProperty properties [] = { + { PROP_WINDOW, "pdm_dialog", NULL, PT_NORMAL, NULL }, + { PROP_NOTEBOOK, "pdm_notebook", NULL, PT_NORMAL, NULL }, + { PROP_COOKIES_TREEVIEW, "cookies_treeview", NULL, PT_NORMAL, NULL }, { PROP_COOKIES_REMOVE, "cookies_remove_button", NULL, PT_NORMAL, NULL }, { PROP_PASSWORDS_TREEVIEW, "passwords_treeview", NULL, PT_NORMAL, NULL }, @@ -153,6 +158,32 @@ pdm_dialog_class_init (PdmDialogClass *klass) object_class->finalize = pdm_dialog_finalize; } +static void +pdm_dialog_show_help (PdmDialog *pd) +{ + GtkWidget *notebook, *window; + gint id; + + /* FIXME: Once we actually have documentation we + * should point these at the correct links. + */ + gchar *help_preferences[] = { + "pdm", + "pdm" + }; + + window = ephy_dialog_get_control (EPHY_DIALOG (pd), PROP_WINDOW); + g_return_if_fail (GTK_IS_WINDOW (window)); + + notebook = ephy_dialog_get_control (EPHY_DIALOG (pd), PROP_NOTEBOOK); + g_return_if_fail (notebook != NULL); + + id = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); + g_assert (id == 0 || id == 1); + + ephy_gui_help (GTK_WINDOW (window), "epiphany", help_preferences[id]); +} + static void cookies_treeview_selection_changed_cb (GtkTreeSelection *selection, PdmDialog *dialog) @@ -708,8 +739,16 @@ pdm_dialog_cookies_properties_button_clicked_cb (GtkWidget *button, } void -pdm_dialog_close_button_clicked_cb (GtkWidget *button, - PdmDialog *dialog) +pdm_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data) { - g_object_unref (dialog); + if (response_id == GTK_RESPONSE_CLOSE) + { + gtk_widget_destroy (GTK_WIDGET(dialog)); + } + else if (response_id == GTK_RESPONSE_HELP) + { + g_return_if_fail (IS_PDM_DIALOG (data)); + + pdm_dialog_show_help (PDM_DIALOG (data)); + } } -- cgit v1.2.3