From 13c8b7335b1aacf79bb4f1e735f6b88bd8dd6e08 Mon Sep 17 00:00:00 2001 From: Adam Hooper Date: Fri, 17 Dec 2004 20:02:42 +0000 Subject: Use gtk_show_about_dialog(), and handle urls and mailto. --- ChangeLog | 8 ++++++++ src/ephy-main.c | 23 +++++++++++++++++++++++ src/ephy-shell.c | 2 +- src/window-commands.c | 46 ++++++++++++---------------------------------- 4 files changed, 44 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a91357eb..59693da6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-12-17 Adam Hooper + + * src/ephy-main.c: (handle_url), (handle_email), (main): + * src/ephy-shell.c: + * src/window-commands.c: (window_cmd_help_about): + + Use gtk_show_about_dialog(), and handle urls and mailto. + 2004-12-17 Adam Hooper * src/ephy-extension.c: (ephy_extension_attach_window), diff --git a/src/ephy-main.c b/src/ephy-main.c index 3bb38481e..49bc8f998 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -29,12 +29,14 @@ #include #include +#include #include #include #include #include #include #include +#include #include static gboolean open_in_existing = FALSE; @@ -69,6 +71,23 @@ static struct poptOption popt_options[] = { NULL, 0, 0, NULL, 0, NULL, NULL } }; +static void +handle_url (GtkAboutDialog *about, + const char *link, + gpointer data) +{ + ephy_shell_new_tab (ephy_shell, NULL, NULL, link, + EPHY_NEW_TAB_OPEN_PAGE); +} + +static void +handle_email (GtkAboutDialog *about, + const char *link, + gpointer data) +{ + gnome_vfs_url_show (link); +} + static void shell_weak_notify (gpointer data, GObject *where_the_object_was) @@ -166,6 +185,10 @@ main (int argc, char *argv[]) eel_gconf_monitor_add ("/apps/epiphany/lockdown"); eel_gconf_monitor_add ("/desktop/gnome/lockdown"); + /* Extensions may want these, so don't initialize in window-cmds */ + gtk_about_dialog_set_url_hook (handle_url, NULL, NULL); + gtk_about_dialog_set_email_hook (handle_email, NULL, NULL); + bonobo_activate (); ephy_shell = ephy_shell_new (); diff --git a/src/ephy-shell.c b/src/ephy-shell.c index a72fe5d36..46a56b2b6 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -511,7 +511,7 @@ load_homepage (EphyEmbed *embed) * @url: an url to load or %NULL * * Create a new tab and the parent window when necessary. - * Ever use this function to open urls in new window/tabs. + * Use this function to open urls in new window/tabs. * * ReturnValue: the created #EphyTab **/ diff --git a/src/window-commands.c b/src/window-commands.c index 0f89e32b7..171e16263 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -52,11 +52,11 @@ #include #include #include +#include #include #include #include #include -#include #include enum @@ -879,9 +879,6 @@ void window_cmd_help_about (GtkAction *action, GtkWidget *window) { - static GtkWidget *about = NULL; - GtkWidget** ptr; - static char *authors[] = { "Marco Pesenti Gritti ", "Xan Lopez ", @@ -890,42 +887,23 @@ window_cmd_help_about (GtkAction *action, NULL }; - char *documenters[] = { + static char *documenters[] = { "Patanjali Somayaji ", "David Bordoley ", "Piers Cornwell ", NULL }; - if (about != NULL) - { - gtk_window_present (GTK_WINDOW (about)); - - return; - } - - - about = g_object_new (GTK_TYPE_ABOUT_DIALOG, - "name", _("Epiphany"), - "version", VERSION, - "copyright", "Copyright \xc2\xa9 2002-2004 Marco Pesenti Gritti", - "authors", authors, - "documenters", documenters, - "translator-credits", _("translator-credits"), - "logo-icon-name", "web-browser", - NULL); - - gtk_window_set_icon_name (GTK_WINDOW (about), "web-browser"); - - g_signal_connect (about, "response", G_CALLBACK (gtk_widget_destroy), NULL); - - gtk_window_set_transient_for (GTK_WINDOW (about), GTK_WINDOW (window)); - gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE); - - ptr = &about; - g_object_add_weak_pointer (G_OBJECT (about), (gpointer *)ptr); - - gtk_window_present (GTK_WINDOW (about)); + gtk_show_about_dialog (GTK_WINDOW (window), + "name", _("Epiphany"), + "version", VERSION, + "copyright", "Copyright \xc2\xa9 2002-2004 Marco Pesenti Gritti", + "authors", authors, + "documenters", documenters, + "translator-credits", _("translator-credits"), + "logo-icon-name", "web-browser", + "website", "http://www.gnome.org/projects/epiphany", + NULL); } void -- cgit v1.2.3