From 0edd1d380be6ee3a7dbcf5b93fe757ed5bbc1ebb Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 4 Mar 2003 11:42:28 +0000 Subject: about:options and about:epiphany 2003-03-04 Marco Pesenti Gritti * data/Makefile.am: * embed/mozilla/Makefile.am: * embed/mozilla/MozRegisterComponents.cpp: * src/Makefile.am: about:options and about:epiphany * src/ephy-shell.c: (ephy_init_services): monitor proxy changes * src/prefs-dialog.c: (create_page), (prefs_dialog_get_page): * src/ui-prefs.c: * src/ui-prefs.h: * lib/widgets/ephy-spinner.c: (ephy_spinner_get_theme_info), (ephy_spinner_init_directory_list), (ephy_spinner_info_free), (ephy_spinner_get_theme_path): * lib/widgets/ephy-spinner.h: Remove spinner configuration, this should be part of the icon theme at some point. --- ChangeLog | 24 ++++ data/Makefile.am | 3 + embed/mozilla/Makefile.am | 3 +- embed/mozilla/MozRegisterComponents.cpp | 16 +++ lib/widgets/ephy-spinner.c | 86 ++---------- lib/widgets/ephy-spinner.h | 9 -- src/Makefile.am | 2 - src/ephy-shell.c | 1 + src/prefs-dialog.c | 21 ++- src/ui-prefs.c | 232 -------------------------------- src/ui-prefs.h | 58 -------- 11 files changed, 77 insertions(+), 378 deletions(-) delete mode 100755 src/ui-prefs.c delete mode 100644 src/ui-prefs.h diff --git a/ChangeLog b/ChangeLog index f3925183f..52f29e8cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2003-03-04 Marco Pesenti Gritti + + * data/Makefile.am: + * embed/mozilla/Makefile.am: + * embed/mozilla/MozRegisterComponents.cpp: + * src/Makefile.am: + + about:options and about:epiphany + + * src/ephy-shell.c: (ephy_init_services): + + monitor proxy changes + + * src/prefs-dialog.c: (create_page), (prefs_dialog_get_page): + * src/ui-prefs.c: + * src/ui-prefs.h: + * lib/widgets/ephy-spinner.c: (ephy_spinner_get_theme_info), + (ephy_spinner_init_directory_list), (ephy_spinner_info_free), + (ephy_spinner_get_theme_path): + * lib/widgets/ephy-spinner.h: + + Remove spinner configuration, this should be part of the icon theme + at some point. + 2003-03-01 Xan Lopez * src/bookmarks/ephy-bookmarks-editor.c: diff --git a/data/Makefile.am b/data/Makefile.am index 141762d4c..26e4bbe44 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -18,6 +18,9 @@ schemadir = $(sysconfdir)/gconf/schemas schema_in_files = epiphany.schemas.in schema_DATA = epiphany.schemas +aboutdir = $(pkgdatadir) +about_DATA = epiphany.html + EXTRA_DIST = $(glade_DATA) install-data-local: diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index 34db7859e..c59edc29c 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -43,7 +43,6 @@ INCLUDES = \ -I$(MOZILLA_INCLUDE_ROOT)/typeaheadfind \ $(GCONF_CFLAGS) \ $(EPIPHANY_DEPENDENCY_CFLAGS) \ - -DLIB_DIR=\"$(pkglibdir)\" \ -DG_DISABLE_DEPRECATED \ -DGDK_DISABLE_DEPRECATED \ -DGTK_DISABLE_DEPRECATED \ @@ -61,6 +60,8 @@ libephymozillaembed_la_SOURCES = \ BaseProtocolContentHandler.h \ ContentHandler.cpp \ ContentHandler.h \ + EphyAboutRedirector.cpp \ + EphyAboutRedirector.h \ EphyEventListener.cpp \ EphyEventListener.h \ EphyWrapper.cpp \ diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp index a8950fc70..8534738ec 100644 --- a/embed/mozilla/MozRegisterComponents.cpp +++ b/embed/mozilla/MozRegisterComponents.cpp @@ -20,6 +20,7 @@ #include #endif +#include "EphyAboutRedirector.h" #include "StartHereProtocolHandler.h" #include "ContentHandler.h" #include "ExternalProtocolService.h" @@ -41,6 +42,7 @@ static NS_DEFINE_CID(kContentHandlerCID, G_CONTENTHANDLER_CID); static NS_DEFINE_CID(kProtocolServiceCID, G_EXTERNALPROTOCOLSERVICE_CID); static NS_DEFINE_CID(kFilePickerCID, G_FILEPICKER_CID); static NS_DEFINE_CID(kStartHereProcotolHandlerCID, G_START_HERE_PROTOCOLHANDLER_CID); +static NS_DEFINE_CID(kEphyAboutRedirectorCID, EPHY_ABOUT_REDIRECTOR_CID); static NS_DEFINE_CID(knsFtpProtocolHandlerCID, NS_FTPPROTOCOLHANDLER_CID); static NS_DEFINE_CID(kFtpHandlerCID, G_FTP_PROTOCOL_CID); static NS_DEFINE_CID(kIRCHandlerCID, G_IRC_PROTOCOL_CID); @@ -95,6 +97,20 @@ mozilla_register_components (void) PR_TRUE); if (NS_FAILED(rv)) ret = FALSE; + rv = RegisterFactory (NS_NewEphyAboutRedirectorFactory, + kEphyAboutRedirectorCID, + EPHY_ABOUT_REDIRECTOR_CLASSNAME, + EPHY_ABOUT_REDIRECTOR_OPTIONS_CONTRACTID, + PR_TRUE); + if (NS_FAILED(rv)) ret = FALSE; + + rv = RegisterFactory (NS_NewEphyAboutRedirectorFactory, + kEphyAboutRedirectorCID, + EPHY_ABOUT_REDIRECTOR_CLASSNAME, + EPHY_ABOUT_REDIRECTOR_EPIPHANY_CONTRACTID, + PR_TRUE); + if (NS_FAILED(rv)) ret = FALSE; + rv = RegisterFactory (NS_NewFtpHandlerFactory, kFtpHandlerCID, G_FTP_CONTENT_CLASSNAME, G_FTP_CONTENT_CONTRACTID, PR_TRUE); diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c index f89bd6ef0..aaa43746a 100644 --- a/lib/widgets/ephy-spinner.c +++ b/lib/widgets/ephy-spinner.c @@ -71,13 +71,17 @@ static GList *spinner_directories = NULL; static void ephy_spinner_init_directory_list (void); -static void -ephy_spinner_search_directory (const gchar *base, GList **spinner_list); static EphySpinnerInfo * ephy_spinner_get_theme_info (const gchar *base, const gchar *theme_name); static gchar * ephy_spinner_get_theme_path (const gchar *theme_name); +struct EphySpinnerInfo +{ + char *name; + char *filename; + char *directory; +}; static GObjectClass *parent_class = NULL; @@ -550,38 +554,6 @@ ephy_spinner_class_init (EphySpinnerClass *class) widget_class->map = ephy_spinner_map; } -static void -ephy_spinner_search_directory (const gchar *base, GList **spinner_list) -{ - GnomeVFSResult rc; - GList *list, *node; - - rc = gnome_vfs_directory_list_load - (&list, base, (GNOME_VFS_FILE_INFO_GET_MIME_TYPE | - GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE | - GNOME_VFS_FILE_INFO_FOLLOW_LINKS)); - if (rc != GNOME_VFS_OK) return; - - for (node = list; node != NULL; node = g_list_next (node)) - { - GnomeVFSFileInfo *file_info = node->data; - EphySpinnerInfo *info; - - if (file_info->name[0] == '.') - continue; - if (file_info->type != GNOME_VFS_FILE_TYPE_DIRECTORY) - continue; - - info = ephy_spinner_get_theme_info (base, file_info->name); - if (info != NULL) - { - *spinner_list = g_list_append (*spinner_list, info); - } - } - - gnome_vfs_file_info_list_free (list); -} - static EphySpinnerInfo * ephy_spinner_get_theme_info (const gchar *base, const gchar *theme_name) { @@ -589,20 +561,9 @@ ephy_spinner_get_theme_info (const gchar *base, const gchar *theme_name) gchar *path; gchar *icon; - path = g_build_filename (base, theme_name, NULL); + path = g_build_filename (base, theme_name, "throbber", NULL); icon = g_build_filename (path, "rest.png", NULL); - if (!g_file_test (icon, G_FILE_TEST_EXISTS)) - { - g_free (path); - g_free (icon); - - /* handle nautilus throbbers as well */ - - path = g_build_filename (base, theme_name, "throbber", NULL); - icon = g_build_filename (path, "rest.png", NULL); - } - if (!g_file_test (icon, G_FILE_TEST_EXISTS)) { g_free (path); @@ -624,12 +585,6 @@ ephy_spinner_init_directory_list (void) { gchar *path; - path = g_build_filename (g_get_home_dir (), ephy_dot_dir (), "spinners", NULL); - spinner_directories = g_list_append (spinner_directories, path); - - path = g_build_filename (SHARE_DIR, "spinners", NULL); - spinner_directories = g_list_append (spinner_directories, path); - path = g_build_filename (SHARE_DIR, "..", "pixmaps", "nautilus", NULL); spinner_directories = g_list_append (spinner_directories, path); @@ -639,19 +594,13 @@ ephy_spinner_init_directory_list (void) #endif } -GList * -ephy_spinner_list_spinners (void) +static void +ephy_spinner_info_free (EphySpinnerInfo *info) { - GList *spinner_list = NULL; - GList *tmp; - - for (tmp = spinner_directories; tmp != NULL; tmp = g_list_next (tmp)) - { - gchar *path = tmp->data; - ephy_spinner_search_directory (path, &spinner_list); - } - - return spinner_list; + g_free (info->name); + g_free (info->directory); + g_free (info->filename); + g_free (info); } static gchar * @@ -675,12 +624,3 @@ ephy_spinner_get_theme_path (const gchar *theme_name) return NULL; } - -void -ephy_spinner_info_free (EphySpinnerInfo *info) -{ - g_free (info->name); - g_free (info->directory); - g_free (info->filename); - g_free (info); -} diff --git a/lib/widgets/ephy-spinner.h b/lib/widgets/ephy-spinner.h index 5ea60b074..5bdc1f279 100644 --- a/lib/widgets/ephy-spinner.h +++ b/lib/widgets/ephy-spinner.h @@ -41,13 +41,6 @@ G_BEGIN_DECLS typedef struct EphySpinnerInfo EphySpinnerInfo; -struct EphySpinnerInfo -{ - gchar *name; - gchar *filename; - gchar *directory; -}; - typedef struct EphySpinner EphySpinner; typedef struct EphySpinnerClass EphySpinnerClass; typedef struct EphySpinnerDetails EphySpinnerDetails; @@ -67,8 +60,6 @@ void ephy_spinner_start (EphySpinner *throbber); void ephy_spinner_stop (EphySpinner *throbber); void ephy_spinner_set_small_mode (EphySpinner *spinner, gboolean new_mode); -GList *ephy_spinner_list_spinners (void); -void ephy_spinner_info_free (EphySpinnerInfo *info); G_END_DECLS diff --git a/src/Makefile.am b/src/Makefile.am index 81f3a02a6..e3b977cd8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -87,8 +87,6 @@ epiphany_SOURCES = \ statusbar.h \ toolbar.c \ toolbar.h \ - ui-prefs.c \ - ui-prefs.h \ window-commands.c \ window-commands.h diff --git a/src/ephy-shell.c b/src/ephy-shell.c index dd8ac4eca..6f5ca6445 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -347,6 +347,7 @@ ephy_init_services (EphyShell *gs) /* it also enables notifiers support */ eel_gconf_monitor_add ("/apps/epiphany"); eel_gconf_monitor_add ("/apps/nautilus/preferences"); + eel_gconf_monitor_add ("/system/proxy"); #ifdef ENABLE_NAUTILUS_VIEW diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 1d7bb34ee..813821cb6 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -23,7 +23,6 @@ #include "prefs-dialog.h" #include "general-prefs.h" #include "appearance-prefs.h" -#include "ui-prefs.h" #include "ephy-dialog.h" #include "ephy-prefs.h" #include "ephy-embed-prefs.h" @@ -78,6 +77,23 @@ EphyDialogProperty network_properties [] = { -1, NULL, NULL } }; +enum +{ + OPEN_IN_TABS_PROP, + JUMP_TO_PROP, + POPUPS_PROP +}; + +static const +EphyDialogProperty ui_properties [] = +{ + { OPEN_IN_TABS_PROP, "open_in_tabs_checkbutton", CONF_TABS_TABBED, PT_AUTOAPPLY, NULL }, + { JUMP_TO_PROP, "jump_to_checkbutton", CONF_TABS_TABBED_AUTOJUMP, PT_AUTOAPPLY, NULL }, + { POPUPS_PROP, "popups_checkbutton", CONF_TABS_TABBED_POPUPS, PT_AUTOAPPLY, NULL }, + + { -1, NULL, NULL } +}; + struct PrefsDialogPrivate { GtkWidget *notebook; @@ -167,8 +183,6 @@ create_page (PrefsPageID id, page = appearance_prefs_new (); break; case PREFS_PAGE_UI: - page = ui_prefs_new (); - break; case PREFS_PAGE_ADVANCED: page = ephy_dialog_new (); ephy_dialog_construct (EPHY_DIALOG(page), @@ -199,6 +213,7 @@ prefs_dialog_get_page (PrefsDialog *pd, break; case PREFS_PAGE_UI: page_widget = "ui_page_box"; + prop = ui_properties; break; case PREFS_PAGE_ADVANCED: page_widget = "network_page_box"; diff --git a/src/ui-prefs.c b/src/ui-prefs.c deleted file mode 100755 index e461bf7e6..000000000 --- a/src/ui-prefs.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2002 Marco Pesenti Gritti - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "ui-prefs.h" -#include "ephy-shell.h" -#include "ephy-prefs.h" -#include "eel-gconf-extensions.h" -#include "ephy-spinner.h" - -#include -#include -#include - -static void ui_prefs_class_init (UIPrefsClass *klass); -static void ui_prefs_init (UIPrefs *dialog); -static void ui_prefs_finalize (GObject *object); - -/* Glade callbacks */ -void -spinners_iconlist_select_icon_cb (GtkWidget *iconlist, gint num, - GdkEvent *event, UIPrefs *dialog); - -static GObjectClass *parent_class = NULL; - -struct UIPrefsPrivate -{ - gpointer dummy; - GList *spinner_list; -}; - -enum -{ - SPINNERS_PROP, - OPEN_IN_TABS_PROP, - JUMP_TO_PROP, - POPUPS_PROP -}; - -static const -EphyDialogProperty properties [] = -{ - { SPINNERS_PROP, "spinners_iconlist", NULL, PT_NORMAL, NULL }, - { OPEN_IN_TABS_PROP, "open_in_tabs_checkbutton", CONF_TABS_TABBED, PT_AUTOAPPLY, NULL }, - { JUMP_TO_PROP, "jump_to_checkbutton", CONF_TABS_TABBED_AUTOJUMP, PT_AUTOAPPLY, NULL }, - { POPUPS_PROP, "popups_checkbutton", CONF_TABS_TABBED_POPUPS, PT_AUTOAPPLY, NULL }, - - { -1, NULL, NULL } -}; - -GType -ui_prefs_get_type (void) -{ - static GType ui_prefs_type = 0; - - if (ui_prefs_type == 0) - { - static const GTypeInfo our_info = - { - sizeof (UIPrefsClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) ui_prefs_class_init, - NULL, - NULL, /* class_data */ - sizeof (UIPrefs), - 0, /* n_preallocs */ - (GInstanceInitFunc) ui_prefs_init - }; - - ui_prefs_type = g_type_register_static (EPHY_DIALOG_TYPE, - "UIPrefs", - &our_info, 0); - } - - return ui_prefs_type; - -} - -static void -ui_prefs_class_init (UIPrefsClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = ui_prefs_finalize; -} - -/** - * Free any existing spinner list. - */ -static void -free_spinner_list (UIPrefs *dialog) -{ - GList *node; - - for (node = dialog->priv->spinner_list; node; node = node->next) - g_free(node->data); - - g_list_free(dialog->priv->spinner_list); - dialog->priv->spinner_list = NULL; -} - -/** - * spinner_get_path_from_index: used in prefs_callbacks.c to get the - * path of selected icon - */ -static const gchar * -spinner_get_path_from_index (UIPrefs *dialog, gint index) -{ - gchar *path; - - path = g_list_nth_data (dialog->priv->spinner_list, index); - - return path; -} - -/* - * spinner_fill_iconlist: fill a gnome icon list with icons of available spinners - */ -static void -spinner_fill_iconlist (UIPrefs *dialog, GnomeIconList *icon_list) -{ - GList *spinners, *tmp; - gchar *pref_spinner_path; - gint index; - - /* clear spinner list */ - free_spinner_list (dialog); - gnome_icon_list_clear (GNOME_ICON_LIST (icon_list)); - - pref_spinner_path = - eel_gconf_get_string (CONF_TOOLBAR_SPINNER_THEME); - index = gnome_icon_list_get_num_icons (icon_list); - - spinners = ephy_spinner_list_spinners (); - for (tmp = spinners; tmp != NULL; tmp = g_list_next (tmp)) - { - EphySpinnerInfo *info = tmp->data; - - dialog->priv->spinner_list = - g_list_append (dialog->priv->spinner_list, - g_strdup (info->name)); - - gnome_icon_list_append (icon_list, info->filename, info->name); - - /* Select the icon configured in prefs */ - if (pref_spinner_path && - strcmp (pref_spinner_path, info->name) == 0) - { - gnome_icon_list_select_icon (icon_list, index); - } - index++; - } - g_list_foreach (spinners, (GFunc)ephy_spinner_info_free, NULL); - g_list_free (spinners); - - g_free (pref_spinner_path); -} - -static void -ui_prefs_init (UIPrefs *dialog) -{ - GtkWidget *icon_list; - - dialog->priv = g_new0 (UIPrefsPrivate, 1); - dialog->priv->spinner_list = NULL; - - ephy_dialog_construct (EPHY_DIALOG(dialog), - properties, - "prefs-dialog.glade", - "ui_page_box"); - - icon_list = ephy_dialog_get_control (EPHY_DIALOG(dialog), - SPINNERS_PROP); - - spinner_fill_iconlist (dialog, GNOME_ICON_LIST (icon_list)); -} - -static void -ui_prefs_finalize (GObject *object) -{ - UIPrefs *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_UI_PREFS (object)); - - dialog = UI_PREFS (object); - - g_return_if_fail (dialog->priv != NULL); - - free_spinner_list (dialog); - - g_free (dialog->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -EphyDialog * -ui_prefs_new (void) -{ - UIPrefs *dialog; - - dialog = UI_PREFS (g_object_new (UI_PREFS_TYPE, - NULL)); - - return EPHY_DIALOG(dialog); -} - -void -spinners_iconlist_select_icon_cb (GtkWidget *iconlist, gint num, - GdkEvent *event, UIPrefs *dialog) -{ - const char *path; - path = spinner_get_path_from_index (dialog, num); - eel_gconf_set_string (CONF_TOOLBAR_SPINNER_THEME, path); -} diff --git a/src/ui-prefs.h b/src/ui-prefs.h deleted file mode 100644 index bbd3dbe75..000000000 --- a/src/ui-prefs.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2002 Jorn Baayen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef UI_PREFS_H -#define UI_PREFS_H - -#include "ephy-dialog.h" - -#include -#include - -G_BEGIN_DECLS - -typedef struct UIPrefs UIPrefs; -typedef struct UIPrefsClass UIPrefsClass; - -#define UI_PREFS_TYPE (ui_prefs_get_type ()) -#define UI_PREFS(obj) (GTK_CHECK_CAST ((obj), UI_PREFS_TYPE, UIPrefs)) -#define UI_PREFS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), UI_PREFS, UIPrefsClass)) -#define IS_UI_PREFS(obj) (GTK_CHECK_TYPE ((obj), UI_PREFS_TYPE)) -#define IS_UI_PREFS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), UI_PREFS)) - -typedef struct UIPrefsPrivate UIPrefsPrivate; - -struct UIPrefs -{ - EphyDialog parent; - UIPrefsPrivate *priv; -}; - -struct UIPrefsClass -{ - EphyDialogClass parent_class; -}; - -GType ui_prefs_get_type (void); - -EphyDialog *ui_prefs_new (void); - -G_END_DECLS - -#endif - -- cgit v1.2.3