From c76b79acb1dd84aec4b91bae8841099699a38139 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 29 Dec 2003 21:05:09 +0000 Subject: Unified return type of ephy_embed_shell_get_X to be GObject *. Fixed all 2003-12-29 Christian Persch * embed/ephy-embed-shell.c: (ephy_embed_shell_get_favicon_cache), (ephy_embed_shell_get_global_history), (ephy_embed_shell_get_downloader_view), (ephy_embed_shell_get_embed_single), (ephy_embed_shell_get_encodings), (ephy_embed_shell_check_mime), (ephy_embed_shell_class_init): * embed/ephy-embed-shell.h: * embed/mozilla/ContentHandler.cpp: * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/GlobalHistory.cpp: * embed/mozilla/mozilla-notifiers.cpp: * src/bookmarks/ephy-bookmarks.c: (compute_lower_fav), (ephy_setup_history_notifiers): * src/ephy-completion-model.c: (ephy_completion_model_init): * src/ephy-shell.c: (ephy_shell_get_history_window): * src/ephy-tab.c: (ephy_tab_set_icon_address), (ephy_tab_address_cb), (ephy_tab_zoom_changed_cb): * src/ephy-toolbars-model.c: (impl_get_item_id): * src/prefs-dialog.c: (setup_font_combo), (prefs_clear_cache_button_clicked_cb): Unified return type of ephy_embed_shell_get_X to be GObject *. Fixed all callers. --- ChangeLog | 26 +++++++++++++++ embed/ephy-embed-shell.c | 65 +++++++++++++++++-------------------- embed/ephy-embed-shell.h | 23 ++++--------- embed/mozilla/ContentHandler.cpp | 3 +- embed/mozilla/EphyHeaderSniffer.cpp | 4 ++- embed/mozilla/GlobalHistory.cpp | 7 ++-- embed/mozilla/mozilla-notifiers.cpp | 9 +++-- src/bookmarks/ephy-bookmarks.c | 9 ++--- src/ephy-completion-model.c | 4 +-- src/ephy-shell.c | 4 +-- src/ephy-tab.c | 16 +++++---- src/ephy-toolbars-model.c | 4 ++- src/prefs-dialog.c | 7 ++-- 13 files changed, 101 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9beb5cb1..de4cd717a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2003-12-29 Christian Persch + + * embed/ephy-embed-shell.c: (ephy_embed_shell_get_favicon_cache), + (ephy_embed_shell_get_global_history), + (ephy_embed_shell_get_downloader_view), + (ephy_embed_shell_get_embed_single), + (ephy_embed_shell_get_encodings), (ephy_embed_shell_check_mime), + (ephy_embed_shell_class_init): + * embed/ephy-embed-shell.h: + * embed/mozilla/ContentHandler.cpp: + * embed/mozilla/EphyHeaderSniffer.cpp: + * embed/mozilla/GlobalHistory.cpp: + * embed/mozilla/mozilla-notifiers.cpp: + * src/bookmarks/ephy-bookmarks.c: (compute_lower_fav), + (ephy_setup_history_notifiers): + * src/ephy-completion-model.c: (ephy_completion_model_init): + * src/ephy-shell.c: (ephy_shell_get_history_window): + * src/ephy-tab.c: (ephy_tab_set_icon_address), + (ephy_tab_address_cb), (ephy_tab_zoom_changed_cb): + * src/ephy-toolbars-model.c: (impl_get_item_id): + * src/prefs-dialog.c: (setup_font_combo), + (prefs_clear_cache_button_clicked_cb): + + Unified return type of ephy_embed_shell_get_X to be GObject *. + Fixed all callers. + 2003-12-28 Christian Persch * Makefile.am: diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index 364eab5e6..003ea9425 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -26,6 +26,7 @@ #include "ephy-embed-factory.h" #include "ephy-marshal.h" #include "ephy-file-helpers.h" +#include "ephy-history.h" #include "ephy-favicon-cache.h" #include "mozilla-embed-single.h" #include "downloader-view.h" @@ -140,6 +141,8 @@ ephy_embed_shell_finalize (GObject *object) GObject * ephy_embed_shell_get_favicon_cache (EphyEmbedShell *shell) { + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL); + if (shell->priv->favicon_cache == NULL) { shell->priv->favicon_cache = ephy_favicon_cache_new (); @@ -148,48 +151,25 @@ ephy_embed_shell_get_favicon_cache (EphyEmbedShell *shell) return G_OBJECT (shell->priv->favicon_cache); } -EphyHistory * -ephy_embed_shell_get_global_history (EphyEmbedShell *shell) -{ - EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell); - return klass->get_global_history (shell); -} - GObject * -ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell) -{ - EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell); - return klass->get_downloader_view (shell); -} - -EphyEmbedSingle * -ephy_embed_shell_get_embed_single (EphyEmbedShell *shell) +ephy_embed_shell_get_global_history (EphyEmbedShell *shell) { + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL); - if (!shell->priv->embed_single) - { - shell->priv->embed_single = EPHY_EMBED_SINGLE - (ephy_embed_factory_new_object ("EphyEmbedSingle")); - } - - return shell->priv->embed_single; -} - -static EphyHistory * -impl_get_global_history (EphyEmbedShell *shell) -{ - if (!shell->priv->global_history) + if (shell->priv->global_history == NULL) { shell->priv->global_history = ephy_history_new (); } - return shell->priv->global_history; + return G_OBJECT (shell->priv->global_history); } -static GObject * -impl_get_downloader_view (EphyEmbedShell *shell) +GObject * +ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell) { - if (!shell->priv->downloader_view) + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL); + + if (shell->priv->downloader_view == NULL) { shell->priv->downloader_view = downloader_view_new (); g_object_add_weak_pointer @@ -200,9 +180,25 @@ impl_get_downloader_view (EphyEmbedShell *shell) return G_OBJECT (shell->priv->downloader_view); } +GObject * +ephy_embed_shell_get_embed_single (EphyEmbedShell *shell) +{ + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL); + + if (shell->priv->embed_single == NULL) + { + shell->priv->embed_single = EPHY_EMBED_SINGLE + (ephy_embed_factory_new_object ("EphyEmbedSingle")); + } + + return G_OBJECT (shell->priv->embed_single); +} + GObject * ephy_embed_shell_get_encodings (EphyEmbedShell *shell) { + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL); + if (shell->priv->encodings == NULL) { shell->priv->encodings = ephy_encodings_new (); @@ -271,6 +267,8 @@ ephy_embed_shell_check_mime (EphyEmbedShell *shell, const char *mime_type) EphyMimePermission permission; gpointer tmp; + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), EPHY_MIME_PERMISSION_UNKNOWN); + if (shell->priv->mime_table == NULL) { shell->priv->mime_table = g_hash_table_new_full @@ -316,8 +314,5 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass) object_class->finalize = ephy_embed_shell_finalize; - klass->get_downloader_view = impl_get_downloader_view; - klass->get_global_history = impl_get_global_history; - g_type_class_add_private (object_class, sizeof (EphyEmbedShellPrivate)); } diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h index 3bff4327b..cc2febf60 100644 --- a/embed/ephy-embed-shell.h +++ b/embed/ephy-embed-shell.h @@ -21,17 +21,12 @@ #ifndef EPHY_EMBED_SHELL_H #define EPHY_EMBED_SHELL_H -#include "ephy-embed.h" -#include "ephy-embed-single.h" -#include "ephy-history.h" - #include #include G_BEGIN_DECLS #define EPHY_TYPE_EMBED_SHELL (ephy_embed_shell_get_type ()) -#define EPHY_EMBED_SHELL_IMPL (ephy_embed_shell_get_impl ()) #define EPHY_EMBED_SHELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_SHELL, EphyEmbedShell)) #define EPHY_EMBED_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellClass)) #define EPHY_IS_EMBED_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_SHELL)) @@ -62,26 +57,22 @@ struct EphyEmbedShell struct EphyEmbedShellClass { GObjectClass parent_class; - - /* Methods */ - EphyHistory * (* get_global_history) (EphyEmbedShell *shell); - GObject * (* get_downloader_view) (EphyEmbedShell *shell); }; GType ephy_embed_shell_get_type (void); -GObject *ephy_embed_shell_get_favicon_cache (EphyEmbedShell *ges); +GObject *ephy_embed_shell_get_favicon_cache (EphyEmbedShell *ges); -EphyHistory *ephy_embed_shell_get_global_history (EphyEmbedShell *shell); +GObject *ephy_embed_shell_get_global_history (EphyEmbedShell *shell); -GObject *ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell); +GObject *ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell); -GObject *ephy_embed_shell_get_encodings (EphyEmbedShell *shell); +GObject *ephy_embed_shell_get_encodings (EphyEmbedShell *shell); -EphyEmbedSingle *ephy_embed_shell_get_embed_single (EphyEmbedShell *shell); +GObject *ephy_embed_shell_get_embed_single (EphyEmbedShell *shell); -EphyMimePermission ephy_embed_shell_check_mime (EphyEmbedShell *shell, - const char *mime_type); +EphyMimePermission ephy_embed_shell_check_mime (EphyEmbedShell *shell, + const char *mime_type); G_END_DECLS diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp index 1ad9095ff..32a18ca96 100644 --- a/embed/mozilla/ContentHandler.cpp +++ b/embed/mozilla/ContentHandler.cpp @@ -35,6 +35,7 @@ #include "ephy-prefs.h" #include "eel-gconf-extensions.h" +#include "ephy-embed-single.h" #include "ephy-embed-shell.h" #include @@ -79,7 +80,7 @@ NS_IMETHODIMP GContentHandler::Show(nsIHelperAppLauncher *aLauncher, rv = Init (); if (NS_FAILED (rv)) return rv; - single = ephy_embed_shell_get_embed_single (embed_shell); + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); g_signal_emit_by_name (single, "handle_content", mMimeType, mUrl.get(), &handled); diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index b6bc1ffb0..cfd61913f 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -49,6 +49,8 @@ #include "EphyHeaderSniffer.h" #include "netCore.h" +#include "ephy-embed-single.h" +#include "ephy-embed-shell.h" #include "ephy-file-chooser.h" #include "ephy-prefs.h" #include "ephy-gui.h" @@ -101,7 +103,7 @@ EphyHeaderSniffer::HandleContent () if (mPostData) return NS_ERROR_FAILURE; mURL->GetSpec (uriSpec); - single = ephy_embed_shell_get_embed_single (embed_shell); + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); g_signal_emit_by_name (single, "handle_content", mContentType.get(), uriSpec.get(), &handled); diff --git a/embed/mozilla/GlobalHistory.cpp b/embed/mozilla/GlobalHistory.cpp index a2c2c5861..3e87d84ca 100644 --- a/embed/mozilla/GlobalHistory.cpp +++ b/embed/mozilla/GlobalHistory.cpp @@ -14,13 +14,16 @@ * 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. + * + * $Id$ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include "ephy-embed-shell.h" + #include "GlobalHistory.h" #include "nsString.h" @@ -28,7 +31,7 @@ NS_IMPL_ISUPPORTS2(MozGlobalHistory, nsIGlobalHistory, nsIBrowserHistory) MozGlobalHistory::MozGlobalHistory () { - mGlobalHistory = ephy_embed_shell_get_global_history (embed_shell); + mGlobalHistory = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); } MozGlobalHistory::~MozGlobalHistory () diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp index b742a3bfe..fdf6529b1 100644 --- a/embed/mozilla/mozilla-notifiers.cpp +++ b/embed/mozilla/mozilla-notifiers.cpp @@ -1,5 +1,6 @@ /* - * Copyright (C) 2000 Nate Case + * Copyright (C) 2000 Nate Case + * Copyright (C) 2003 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 @@ -14,14 +15,16 @@ * 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. + * + * $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "ephy-embed-shell.h" #include "ephy-embed-single.h" +#include "ephy-embed-shell.h" #include "mozilla-notifiers.h" #include "eel-gconf-extensions.h" #include "MozRegisterComponents.h" @@ -36,6 +39,8 @@ #include #include #include +#include + #include #include #include diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index c569ec2ca..2c4fdd413 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -24,6 +24,7 @@ #include "ephy-bookmarks.h" #include "ephy-file-helpers.h" +#include "ephy-embed-shell.h" #include "ephy-shell.h" #include "ephy-history.h" #include "ephy-debug.h" @@ -310,12 +311,10 @@ compute_lower_fav (EphyNode *favorites, double *score) { GPtrArray *children; int i; - EphyEmbedShell *embed_shell; EphyHistory *history; EphyNode *result = NULL; - embed_shell = EPHY_EMBED_SHELL (ephy_shell); - history = ephy_embed_shell_get_global_history (embed_shell); + history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); *score = DBL_MAX; children = ephy_node_get_children (favorites); @@ -389,11 +388,9 @@ history_site_visited_cb (EphyHistory *gh, const char *url, EphyBookmarks *eb) static void ephy_setup_history_notifiers (EphyBookmarks *eb) { - EphyEmbedShell *embed_shell; EphyHistory *history; - embed_shell = EPHY_EMBED_SHELL (ephy_shell); - history = ephy_embed_shell_get_global_history (embed_shell); + history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); g_signal_connect (history, "visited", G_CALLBACK (history_site_visited_cb), eb); diff --git a/src/ephy-completion-model.c b/src/ephy-completion-model.c index b8f75bce6..651afe882 100644 --- a/src/ephy-completion-model.c +++ b/src/ephy-completion-model.c @@ -23,6 +23,7 @@ #include "ephy-completion-model.h" #include "ephy-node.h" #include "ephy-shell.h" +#include "ephy-history.h" static void ephy_completion_model_class_init (EphyCompletionModelClass *klass); static void ephy_completion_model_init (EphyCompletionModel *model); @@ -230,8 +231,7 @@ ephy_completion_model_init (EphyCompletionModel *model) model->priv = EPHY_COMPLETION_MODEL_GET_PRIVATE (model); model->priv->stamp = g_random_int (); - history = ephy_embed_shell_get_global_history - (EPHY_EMBED_SHELL (ephy_shell)); + history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); model->priv->history = ephy_history_get_pages (history); connect_signals (model, model->priv->history); diff --git a/src/ephy-shell.c b/src/ephy-shell.c index fd450634f..47b51f7c8 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -781,8 +781,8 @@ ephy_shell_get_history_window (EphyShell *shell) if (shell->priv->history_window == NULL) { - history = ephy_embed_shell_get_global_history - (EPHY_EMBED_SHELL (ephy_shell)); + history = EPHY_HISTORY + (ephy_embed_shell_get_global_history (embed_shell)); g_assert (history != NULL); shell->priv->history_window = ephy_history_window_new (history); diff --git a/src/ephy-tab.c b/src/ephy-tab.c index e40e51207..25c7f0e4e 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -24,7 +24,6 @@ #endif #include "ephy-tab.h" -#include "ephy-shell.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" #include "ephy-embed-factory.h" @@ -36,6 +35,9 @@ #include "ephy-zoom.h" #include "ephy-favicon-cache.h" #include "ephy-embed-persist.h" +#include "ephy-history.h" +#include "ephy-embed-shell.h" +#include "ephy-shell.h" #include #include @@ -555,8 +557,8 @@ ephy_tab_set_icon_address (EphyTab *tab, const char *address) if (tab->priv->icon_address) { eb = ephy_shell_get_bookmarks (ephy_shell); - history = ephy_embed_shell_get_global_history - (EPHY_EMBED_SHELL (ephy_shell)); + history = EPHY_HISTORY + (ephy_embed_shell_get_global_history (embed_shell)); ephy_bookmarks_set_icon (eb, tab->priv->address, tab->priv->icon_address); ephy_history_set_icon (history, tab->priv->address, @@ -613,8 +615,8 @@ ephy_tab_address_cb (EphyEmbed *embed, const char *address, EphyTab *tab) GValue value = { 0, }; float zoom = 1.0, current_zoom; - history = ephy_embed_shell_get_global_history - (EPHY_EMBED_SHELL (ephy_shell)); + history = EPHY_HISTORY + (ephy_embed_shell_get_global_history (embed_shell)); host = ephy_history_get_host (history, address); if (host != NULL && ephy_node_get_property @@ -654,8 +656,8 @@ ephy_tab_zoom_changed_cb (EphyEmbed *embed, float zoom, EphyTab *tab) EphyHistory *history; EphyNode *host; GValue value = { 0, }; - history = ephy_embed_shell_get_global_history - (EPHY_EMBED_SHELL (ephy_shell)); + history = EPHY_HISTORY + (ephy_embed_shell_get_global_history (embed_shell)); host = ephy_history_get_host (history, address); if (host != NULL) diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c index c022b9ba8..8e0c578b4 100755 --- a/src/ephy-toolbars-model.c +++ b/src/ephy-toolbars-model.c @@ -23,6 +23,8 @@ #include "ephy-bookmarks.h" #include "ephy-node-common.h" #include "ephy-file-helpers.h" +#include "ephy-history.h" +#include "ephy-embed-shell.h" #include "ephy-shell.h" #include "ephy-debug.h" #include "ephy-string.h" @@ -202,7 +204,7 @@ impl_get_item_id (EggToolbarsModel *t, node = ephy_bookmarks_add (bookmarks, title, netscape_url[URL]); g_return_val_if_fail (node != NULL, NULL); - gh = ephy_embed_shell_get_global_history (EPHY_EMBED_SHELL (ephy_shell)); + gh = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); icon = ephy_history_get_icon (gh, netscape_url[URL]); if (icon) diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index f8d699e59..06d5ea77a 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -441,8 +441,7 @@ setup_font_combo (EphyDialog *dialog, char key[255]; EphyEmbedSingle *single; - single = ephy_embed_shell_get_embed_single - (EPHY_EMBED_SHELL (ephy_shell)); + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); fonts = ephy_embed_single_get_font_list (single, code); g_snprintf (key, 255, "%s_%s_%s", CONF_RENDERING_FONT, type, code); @@ -1230,9 +1229,7 @@ prefs_clear_cache_button_clicked_cb (GtkWidget *button, { EphyEmbedSingle *single; - single = ephy_embed_shell_get_embed_single - (EPHY_EMBED_SHELL (ephy_shell)); - + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); ephy_embed_single_clear_cache (single); } -- cgit v1.2.3