diff options
author | Xan Lopez <xan@igalia.com> | 2011-12-15 01:01:14 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2011-12-15 01:01:14 +0800 |
commit | 3295288a7292a74d14c6a5a20e41e2afe010f34e (patch) | |
tree | b508743f41c1fe93f8997b295d1fa21df2ab3118 /src | |
parent | 2db47fb32732e9613e5338d8c165ed5f771e819a (diff) | |
download | gsoc2013-epiphany-3295288a7292a74d14c6a5a20e41e2afe010f34e.tar gsoc2013-epiphany-3295288a7292a74d14c6a5a20e41e2afe010f34e.tar.gz gsoc2013-epiphany-3295288a7292a74d14c6a5a20e41e2afe010f34e.tar.bz2 gsoc2013-epiphany-3295288a7292a74d14c6a5a20e41e2afe010f34e.tar.lz gsoc2013-epiphany-3295288a7292a74d14c6a5a20e41e2afe010f34e.tar.xz gsoc2013-epiphany-3295288a7292a74d14c6a5a20e41e2afe010f34e.tar.zst gsoc2013-epiphany-3295288a7292a74d14c6a5a20e41e2afe010f34e.zip |
Remove last traces of the EggToolbar code
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 31 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-ui.h | 3 | ||||
-rw-r--r-- | src/ephy-shell.c | 60 | ||||
-rw-r--r-- | src/ephy-shell.h | 3 | ||||
-rw-r--r-- | src/ephy-toolbars-model.c | 292 | ||||
-rw-r--r-- | src/ephy-toolbars-model.h | 65 |
6 files changed, 4 insertions, 450 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 84b707883..45b55d210 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,6 @@ NOINST_H_FILES = \ ephy-navigation-history-action.h \ ephy-navigation-up-action.h \ ephy-password-info.h \ - ephy-toolbars-model.h \ languages.h \ pdm-dialog.h \ popup-commands.h \ @@ -71,7 +70,6 @@ libephymain_la_SOURCES = \ ephy-password-info.c \ ephy-session.c \ ephy-shell.c \ - ephy-toolbars-model.c \ ephy-window.c \ pdm-dialog.c \ popup-commands.c \ @@ -274,26 +272,7 @@ EPHY_GIR_C_FILES = \ $(top_srcdir)/src/ephy-window.c \ $(NULL) -EphyEgg-$(EPIPHANY_API_VERSION).gir: $(INTROSPECTION_SCANNER) - $(AM_V_GEN) PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ - $(INTROSPECTION_SCANNER) -v --warn-all \ - --identifier-prefix=Egg \ - --symbol-prefix=egg \ - --namespace=EphyEgg \ - --nsversion=$(EPIPHANY_API_VERSION) \ - --include=Gtk-3.0 \ - --include=libxml2-2.0 \ - --library=$(top_builddir)/lib/egg/libegg.la \ - --pkg=gtk+-3.0 \ - --pkg=libxml-2.0 \ - --output=$@ \ - $(top_srcdir)/lib/egg/egg-editable-toolbar.h \ - $(top_srcdir)/lib/egg/egg-toolbars-model.h \ - $(top_srcdir)/lib/egg/egg-editable-toolbar.c \ - $(top_srcdir)/lib/egg/egg-toolbars-model.c \ - $(top_builddir)/lib/egg/libegg.la - -Epiphany-$(EPIPHANY_API_VERSION).gir: EphyEgg-$(EPIPHANY_API_VERSION).gir $(INTROSPECTION_SCANNER) $(EPHY_GIR_H_FILES) \ +Epiphany-$(EPIPHANY_API_VERSION).gir: $(INTROSPECTION_SCANNER) $(EPHY_GIR_H_FILES) \ $(EPHY_GIR_C_FILES) epiphany $(AM_V_GEN) PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ $(INTROSPECTION_SCANNER) -v --warn-all \ @@ -306,7 +285,6 @@ Epiphany-$(EPIPHANY_API_VERSION).gir: EphyEgg-$(EPIPHANY_API_VERSION).gir $(INTR --include=Gtk-3.0 \ --include=libxml2-2.0 \ --include=WebKit-3.0 \ - --include-uninstalled=EphyEgg-$(EPIPHANY_API_VERSION).gir \ --program=./epiphany \ --output=$@ \ --pkg=epiphany-$(EPIPHANY_API_VERSION) \ @@ -320,17 +298,14 @@ Epiphany-$(EPIPHANY_API_VERSION).gir: EphyEgg-$(EPIPHANY_API_VERSION).gir $(INTR $(EPHY_GIR_C_FILES) girdir = $(datadir)/gir-1.0 -gir_DATA = Epiphany-$(EPIPHANY_API_VERSION).gir EphyEgg-$(EPIPHANY_API_VERSION).gir +gir_DATA = Epiphany-$(EPIPHANY_API_VERSION).gir typelibsdir = $(libdir)/girepository-1.0 -typelibs_DATA = Epiphany-$(EPIPHANY_API_VERSION).typelib EphyEgg-$(EPIPHANY_API_VERSION).typelib +typelibs_DATA = Epiphany-$(EPIPHANY_API_VERSION).typelib Epiphany-$(EPIPHANY_API_VERSION).typelib: Epiphany-$(EPIPHANY_API_VERSION).gir $(INTROSPECTION_COMPILER) $(AM_V_GEN) $(INTROSPECTION_COMPILER) Epiphany-$(EPIPHANY_API_VERSION).gir --includedir=$(top_builddir)/src --includedir=$(srcdir) -o Epiphany-$(EPIPHANY_API_VERSION).typelib -EphyEgg-$(EPIPHANY_API_VERSION).typelib: EphyEgg-$(EPIPHANY_API_VERSION).gir $(INTROSPECTION_COMPILER) - $(AM_V_GEN) $(INTROSPECTION_COMPILER) EphyEgg-$(EPIPHANY_API_VERSION).gir -o EphyEgg-$(EPIPHANY_API_VERSION).typelib - CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # HAVE_INTROSPECTION diff --git a/src/bookmarks/ephy-bookmarks-ui.h b/src/bookmarks/ephy-bookmarks-ui.h index 2dfbebcac..c44f2a292 100644 --- a/src/bookmarks/ephy-bookmarks-ui.h +++ b/src/bookmarks/ephy-bookmarks-ui.h @@ -24,9 +24,8 @@ #ifndef EPHY_BOOKMARKS_UI_H #define EPHY_BOOKMARKS_UI_H -#include "egg-toolbars-model.h" -#include "ephy-node.h" #include "ephy-window.h" +#include "ephy-node.h" #include <gtk/gtk.h> diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 217b79b1c..c5c71abac 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -23,7 +23,6 @@ #include "config.h" #include "ephy-shell.h" -#include "egg-toolbars-model.h" #include "ephy-bookmarks-editor.h" #include "ephy-bookmarks-import.h" #include "ephy-debug.h" @@ -40,7 +39,6 @@ #include "ephy-profile-utils.h" #include "ephy-session.h" #include "ephy-settings.h" -#include "ephy-toolbars-model.h" #include "ephy-type-builtins.h" #include "ephy-web-view.h" #include "ephy-window.h" @@ -56,8 +54,6 @@ struct _EphyShellPrivate { EphySession *session; GObject *lockdown; EphyBookmarks *bookmarks; - EggToolbarsModel *toolbars_model; - EggToolbarsModel *fs_toolbars_model; EphyExtensionsManager *extensions_manager; GNetworkMonitor *network_monitor; GtkWidget *bme; @@ -515,18 +511,6 @@ ephy_shell_dispose (GObject *object) priv->lockdown = NULL; } - if (priv->toolbars_model != NULL) { - LOG ("Unref toolbars model"); - g_object_unref (priv->toolbars_model); - priv->toolbars_model = NULL; - } - - if (priv->fs_toolbars_model != NULL) { - LOG ("Unref fullscreen toolbars model"); - g_object_unref (priv->fs_toolbars_model); - priv->fs_toolbars_model = NULL; - } - if (priv->bme != NULL) { LOG ("Unref Bookmarks Editor"); gtk_widget_destroy (GTK_WIDGET (priv->bme)); @@ -829,50 +813,6 @@ ephy_shell_get_bookmarks (EphyShell *shell) } /** - * ephy_shell_get_toolbars_model: - * - * Return value: (transfer none): - **/ -GObject * -ephy_shell_get_toolbars_model (EphyShell *shell, gboolean fullscreen) -{ - LOG ("ephy_shell_get_toolbars_model fs=%d", fullscreen); - - if (fullscreen) { - if (shell->priv->fs_toolbars_model == NULL) { - EggTbModelFlags flags; - gboolean success; - const char *xml; - - shell->priv->fs_toolbars_model = egg_toolbars_model_new (); - xml = ephy_file ("epiphany-fs-toolbar.xml"); - g_return_val_if_fail (xml != NULL, NULL); - - success = egg_toolbars_model_load_toolbars - (shell->priv->fs_toolbars_model, xml); - g_return_val_if_fail (success, NULL); - - flags = egg_toolbars_model_get_flags - (shell->priv->fs_toolbars_model, 0); - egg_toolbars_model_set_flags - (shell->priv->fs_toolbars_model, 0, - flags | EGG_TB_MODEL_NOT_REMOVABLE); - } - - return G_OBJECT (shell->priv->fs_toolbars_model); - } else { - if (shell->priv->toolbars_model == NULL) { - shell->priv->toolbars_model = ephy_toolbars_model_new (); - - ephy_toolbars_model_load - (EPHY_TOOLBARS_MODEL (shell->priv->toolbars_model)); - } - - return G_OBJECT (shell->priv->toolbars_model); - } -} - -/** * ephy_shell_get_extensions_manager: * * Return value: (transfer none): diff --git a/src/ephy-shell.h b/src/ephy-shell.h index 55a90547e..1780a2e4d 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -130,9 +130,6 @@ GObject *ephy_shell_get_net_monitor (EphyShell *shell); EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *shell); -GObject *ephy_shell_get_toolbars_model (EphyShell *shell, - gboolean fullscreen); - GObject *ephy_shell_get_extensions_manager (EphyShell *shell); GtkWidget *ephy_shell_get_bookmarks_editor (EphyShell *shell); diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c deleted file mode 100644 index 346aa0253..000000000 --- a/src/ephy-toolbars-model.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright © 2002-2004 Marco Pesenti Gritti - * Copyright © 2003, 2004 Christian Persch - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" -#include "ephy-toolbars-model.h" - -#include "eggtypebuiltins.h" -#include "ephy-debug.h" -#include "ephy-embed-shell.h" -#include "ephy-file-helpers.h" -#include "ephy-prefs.h" -#include "ephy-settings.h" - -#include <string.h> - -#define EPHY_TOOLBARS_XML_FILE "epiphany-toolbars-3.xml" -#define EPHY_TOOLBARS_XML_VERSION "1.1" - -#define EPHY_TOOLBARS_MODEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModelPrivate)) - -struct _EphyToolbarsModelPrivate -{ - char *xml_file; - EggTbModelFlags style; - guint timeout; -}; - -static void ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass); -static void ephy_toolbars_model_init (EphyToolbarsModel *model); - -G_DEFINE_TYPE (EphyToolbarsModel, ephy_toolbars_model, EGG_TYPE_TOOLBARS_MODEL) - -static gboolean -save_changes_idle (EphyToolbarsModel *model) -{ - LOG ("Saving toolbars model"); - - egg_toolbars_model_save_toolbars - (EGG_TOOLBARS_MODEL (model), - model->priv->xml_file, - EPHY_TOOLBARS_XML_VERSION); - - model->priv->timeout = 0; - - /* don't run again */ - return FALSE; -} - -static void -save_changes (EphyToolbarsModel *model) -{ - if (model->priv->timeout == 0) - { - model->priv->timeout = - g_idle_add ((GSourceFunc) save_changes_idle, model); - } -} - -static void -update_flags (EphyToolbarsModel *model) -{ - EggToolbarsModel *eggmodel = EGG_TOOLBARS_MODEL (model); - int i, n_toolbars; - int flag = 0; - - n_toolbars = egg_toolbars_model_n_toolbars (eggmodel); - - if (n_toolbars <= 1) - { - flag |= EGG_TB_MODEL_NOT_REMOVABLE; - } - - for (i = 0; i < n_toolbars; i++) - { - const char *t_name; - EggTbModelFlags flags; - - t_name = egg_toolbars_model_toolbar_nth (eggmodel, i); - g_return_if_fail (t_name != NULL); - - flags = egg_toolbars_model_get_flags (eggmodel, i); - flags &= ~(EGG_TB_MODEL_NOT_REMOVABLE | EGG_TB_MODEL_STYLES_MASK); - flags |= flag; - flags |= model->priv->style; - egg_toolbars_model_set_flags (eggmodel, i, flags); - } -} - -static void -update_flags_and_save_changes (EphyToolbarsModel *model) -{ - update_flags (model); - save_changes (model); -} - -static EggTbModelFlags -get_toolbar_style (void) -{ - GFlagsClass *flags_class; - const GFlagsValue *value; - EggTbModelFlags flags = 0; - char *pref; - - pref = g_settings_get_string (EPHY_SETTINGS_UI, - EPHY_PREFS_UI_TOOLBAR_STYLE); - if (pref != NULL) - { - flags_class = g_type_class_ref (EGG_TYPE_TB_MODEL_FLAGS); - value = g_flags_get_value_by_nick (flags_class, pref); - if (value != NULL) - { - flags = value->value; - } - g_type_class_unref (flags_class); - } - flags &= EGG_TB_MODEL_STYLES_MASK; - - g_free (pref); - - return flags; -} - -static void -toolbar_style_changed_cb (GSettings *settings, - char *key, - EphyToolbarsModel *model) -{ - model->priv->style = get_toolbar_style (); - - update_flags (model); -} - -void -ephy_toolbars_model_load (EphyToolbarsModel *model) -{ - EggToolbarsModel *eggmodel = EGG_TOOLBARS_MODEL (model); - gboolean success; - int i; - - egg_toolbars_model_load_names (eggmodel, ephy_file ("epiphany-toolbar.xml")); - - success = egg_toolbars_model_load_toolbars (eggmodel, model->priv->xml_file); - LOG ("Loading the toolbars was %ssuccessful", success ? "" : "un"); - - /* maybe an old format, try to migrate: load the old layout, and - * remove the BookmarksBar toolbar - */ - if (success == FALSE) - { - char *old_xml; - - old_xml = g_build_filename (ephy_dot_dir (), - "epiphany-toolbars-2.xml", - NULL); - success = egg_toolbars_model_load_toolbars (eggmodel, old_xml); - g_free (old_xml); - - if (success == TRUE) - { - old_xml = g_build_filename (ephy_dot_dir (), - "epiphany-bookmarksbar.xml", - NULL); - egg_toolbars_model_load_toolbars (eggmodel, old_xml); - g_free (old_xml); - } - - LOG ("Migration was %ssuccessful", success ? "" : "un"); - } - - if (success == FALSE) - { - char *old_xml; - - old_xml = g_build_filename (ephy_dot_dir (), - "epiphany-toolbars.xml", - NULL); - success = egg_toolbars_model_load_toolbars (eggmodel, old_xml); - g_free (old_xml); - - LOG ("Migration was %ssuccessful", success ? "" : "un"); - } - - /* Still no success, load the default toolbars */ - if (success == FALSE) - { - success = egg_toolbars_model_load_toolbars - (eggmodel, ephy_file ("epiphany-toolbar.xml")); - LOG ("Loading the default toolbars was %ssuccessful", success ? "" : "un"); - } - - /* Cleanup any empty toolbars */ - for (i = egg_toolbars_model_n_toolbars (eggmodel)-1; i >= 0; i--) - { - if (egg_toolbars_model_n_items (eggmodel, i) == 0) - { - egg_toolbars_model_remove_toolbar (eggmodel, i); - } - } - - /* Ensure we have at least 1 toolbar unless we are in WebApp mode. */ - if (ephy_embed_shell_get_mode (embed_shell) != EPHY_EMBED_SHELL_MODE_APPLICATION && - egg_toolbars_model_n_toolbars (eggmodel) < 1) - { - egg_toolbars_model_add_toolbar (eggmodel, 0, "DefaultToolbar"); - } -} - -static void -ephy_toolbars_model_init (EphyToolbarsModel *model) -{ - EphyToolbarsModelPrivate *priv; - - priv = model->priv = EPHY_TOOLBARS_MODEL_GET_PRIVATE (model); - - priv->xml_file = g_build_filename (ephy_dot_dir (), - EPHY_TOOLBARS_XML_FILE, - NULL); - - priv->style = get_toolbar_style (); - g_signal_connect (EPHY_SETTINGS_UI, - "changed::" EPHY_PREFS_UI_TOOLBAR_STYLE, - G_CALLBACK (toolbar_style_changed_cb), model); - - g_signal_connect_after (model, "item_added", - G_CALLBACK (save_changes), NULL); - g_signal_connect_after (model, "item_removed", - G_CALLBACK (save_changes), NULL); - g_signal_connect_after (model, "toolbar_added", - G_CALLBACK (update_flags_and_save_changes), NULL); - g_signal_connect_after (model, "toolbar_removed", - G_CALLBACK (update_flags_and_save_changes), NULL); -} - -static void -ephy_toolbars_model_dispose (GObject *object) -{ - EphyToolbarsModel *model = EPHY_TOOLBARS_MODEL (object); - - save_changes_idle (model); - - G_OBJECT_CLASS (ephy_toolbars_model_parent_class)->dispose (object); -} - -static void -ephy_toolbars_model_finalize (GObject *object) -{ - EphyToolbarsModel *model = EPHY_TOOLBARS_MODEL (object); - EphyToolbarsModelPrivate *priv = model->priv; - - if (priv->timeout != 0) - { - g_source_remove (priv->timeout); - } - - g_free (priv->xml_file); - - G_OBJECT_CLASS (ephy_toolbars_model_parent_class)->finalize (object); -} - -static void -ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = ephy_toolbars_model_dispose; - object_class->finalize = ephy_toolbars_model_finalize; - - g_type_class_add_private (object_class, sizeof (EphyToolbarsModelPrivate)); -} - -EggToolbarsModel * -ephy_toolbars_model_new (void) -{ - return EGG_TOOLBARS_MODEL (g_object_new (EPHY_TYPE_TOOLBARS_MODEL, NULL)); -} diff --git a/src/ephy-toolbars-model.h b/src/ephy-toolbars-model.h deleted file mode 100644 index 708370602..000000000 --- a/src/ephy-toolbars-model.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright © 2003, 2004 Marco Pesenti Gritti - * Copyright © 2003, 2004 Christian Persch - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) -#error "Only <epiphany/epiphany.h> can be included directly." -#endif - -#ifndef EPHY_TOOLBARS_MODEL_H -#define EPHY_TOOLBARS_MODEL_H - -#include "egg-toolbars-model.h" -#include "ephy-bookmarks.h" - -G_BEGIN_DECLS - -#define EPHY_TYPE_TOOLBARS_MODEL (ephy_toolbars_model_get_type ()) -#define EPHY_TOOLBARS_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModel)) -#define EPHY_TOOLBARS_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModelClass)) -#define EPHY_IS_TOOLBARS_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TOOLBARS_MODEL)) -#define EPHY_IS_TOOLBARS_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TOOLBARS_MODEL)) -#define EPHY_TOOLBARS_MODEL_GET_CLASS(o)(G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModelClass)) - -typedef struct _EphyToolbarsModelClass EphyToolbarsModelClass; -typedef struct _EphyToolbarsModel EphyToolbarsModel; -typedef struct _EphyToolbarsModelPrivate EphyToolbarsModelPrivate; - -struct _EphyToolbarsModel -{ - EggToolbarsModel parent_object; - - /*< private >*/ - EphyToolbarsModelPrivate *priv; -}; - -struct _EphyToolbarsModelClass -{ - EggToolbarsModelClass parent_class; -}; - -GType ephy_toolbars_model_get_type (void); - -EggToolbarsModel *ephy_toolbars_model_new (void); - -void ephy_toolbars_model_load (EphyToolbarsModel *model); - -G_END_DECLS - -#endif |