From 7792ee06ab725d997a2f288357cbe658525a120a Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Fri, 5 Jun 2009 18:49:22 +0300 Subject: Kill EphyBaseEmbed, move the small widget logic it had to EphyEmbed. --- embed/Makefile.am | 2 - embed/ephy-base-embed.c | 101 ------------------------------------------------ embed/ephy-base-embed.h | 63 ------------------------------ embed/ephy-embed.c | 49 ++++++++++++++++++++++- 4 files changed, 48 insertions(+), 167 deletions(-) delete mode 100644 embed/ephy-base-embed.c delete mode 100644 embed/ephy-base-embed.h (limited to 'embed') diff --git a/embed/Makefile.am b/embed/Makefile.am index ebbdd26df..03281c2a3 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -18,7 +18,6 @@ NOINST_H_FILES = \ INST_H_FILES = \ ephy-adblock.h \ ephy-adblock-manager.h \ - ephy-base-embed.h \ ephy-command-manager.h \ ephy-embed.h \ ephy-embed-container.h \ @@ -42,7 +41,6 @@ BUILT_SOURCES = \ libephyembed_la_SOURCES = \ ephy-adblock.c \ ephy-adblock-manager.c \ - ephy-base-embed.c \ downloader-view.c \ ephy-command-manager.c \ ephy-embed.c \ diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c deleted file mode 100644 index 1d11439c9..000000000 --- a/embed/ephy-base-embed.c +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ -/* - * Copyright © 2000-2004 Marco Pesenti Gritti - * Copyright © 2003-2007 Christian Persch - * Copyright © 2007 Xan Lopez - * - * 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 -#include -#include - -#include "eel-gconf-extensions.h" -#include "ephy-base-embed.h" -#include "ephy-debug.h" -#include "ephy-embed.h" -#include "ephy-embed-container.h" -#include "ephy-embed-prefs.h" -#include "ephy-embed-shell.h" -#include "ephy-embed-single.h" -#include "ephy-embed-type-builtins.h" -#include "ephy-embed-utils.h" -#include "ephy-permission-manager.h" -#include "ephy-favicon-cache.h" -#include "ephy-history.h" -#include "ephy-string.h" -#include "ephy-zoom.h" - -G_DEFINE_TYPE (EphyBaseEmbed, ephy_base_embed, GTK_TYPE_BIN) - -static void -ephy_base_embed_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - GtkWidget *child; - - GTK_WIDGET_CLASS (ephy_base_embed_parent_class)->size_request (widget, requisition); - - child = GTK_BIN (widget)->child; - - if (child && GTK_WIDGET_VISIBLE (child)) { - GtkRequisition child_requisition; - gtk_widget_size_request (GTK_WIDGET (child), &child_requisition); - } -} - -static void -ephy_base_embed_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - GtkWidget *child; - - widget->allocation = *allocation; - - child = GTK_BIN (widget)->child; - g_return_if_fail (child != NULL); - - gtk_widget_size_allocate (child, allocation); -} - -static void -ephy_base_embed_grab_focus (GtkWidget *widget) -{ - GtkWidget *child; - - child = gtk_bin_get_child (GTK_BIN (widget)); - - if (child) - gtk_widget_grab_focus (child); -} - -static void -ephy_base_embed_class_init (EphyBaseEmbedClass *klass) -{ - GtkWidgetClass *widget_class = (GtkWidgetClass *)klass; - - widget_class->size_request = ephy_base_embed_size_request; - widget_class->size_allocate = ephy_base_embed_size_allocate; - widget_class->grab_focus = ephy_base_embed_grab_focus; -} - -static void -ephy_base_embed_init (EphyBaseEmbed *self) -{ -} diff --git a/embed/ephy-base-embed.h b/embed/ephy-base-embed.h deleted file mode 100644 index 9e34007e8..000000000 --- a/embed/ephy-base-embed.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ -/* - * Copyright © 2000-2004 Marco Pesenti Gritti - * Copyright © 2003-2007 Christian Persch - * Copyright © 2007 Xan Lopez - * - * 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. - * - */ - -#ifndef __EPHY_BASE_EMBED_H__ -#define __EPHY_BASE_EMBED_H__ - -#include "ephy-embed.h" - -#include - - -G_BEGIN_DECLS - -#define EPHY_TYPE_BASE_EMBED (ephy_base_embed_get_type ()) -#define EPHY_BASE_EMBED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_BASE_EMBED, EphyBaseEmbed)) -#define EPHY_BASE_EMBED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_BASE_EMBED, EphyBaseEmbedClass)) -#define EPHY_IS_BASE_EMBED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_BASE_EMBED)) -#define EPHY_IS_BASE_EMBED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_TYPE_BASE_EMBED)) -#define EPHY_BASE_EMBED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_TYPE_BASE_EMBED, EphyBaseEmbedClass)) - -typedef struct _EphyBaseEmbed EphyBaseEmbed; -typedef struct _EphyBaseEmbedClass EphyBaseEmbedClass; -typedef struct _EphyBaseEmbedPrivate EphyBaseEmbedPrivate; - -struct _EphyBaseEmbedClass { - GtkBinClass parent_class; -}; - -struct _EphyBaseEmbed { - GtkBin parent_instance; - - /*< private >*/ - EphyBaseEmbedPrivate *priv; -}; - -GType ephy_base_embed_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) -#error "Only can be included directly." -#endif - -#endif /* __EPHY_BASE_EMBED_H__ */ diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index ad0a9f5f6..d3b092396 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -114,7 +114,7 @@ ephy_command_manager_iface_init (EphyCommandManagerIface *iface) iface->can_do_command = impl_manager_can_do_command; } -G_DEFINE_TYPE_WITH_CODE (EphyEmbed, ephy_embed, EPHY_TYPE_BASE_EMBED, +G_DEFINE_TYPE_WITH_CODE (EphyEmbed, ephy_embed, GTK_TYPE_BIN, G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER, ephy_command_manager_iface_init)) @@ -321,9 +321,56 @@ zoom_changed_cb (WebKitWebView *web_view, g_free (address); } +static void +ephy_embed_size_request (GtkWidget *widget, + GtkRequisition *requisition) +{ + GtkWidget *child; + + GTK_WIDGET_CLASS (ephy_embed_parent_class)->size_request (widget, requisition); + + child = GTK_BIN (widget)->child; + + if (child && GTK_WIDGET_VISIBLE (child)) { + GtkRequisition child_requisition; + gtk_widget_size_request (GTK_WIDGET (child), &child_requisition); + } +} + +static void +ephy_embed_size_allocate (GtkWidget *widget, + GtkAllocation *allocation) +{ + GtkWidget *child; + + widget->allocation = *allocation; + + child = GTK_BIN (widget)->child; + g_return_if_fail (child != NULL); + + gtk_widget_size_allocate (child, allocation); +} + +static void +ephy_embed_grab_focus (GtkWidget *widget) +{ + GtkWidget *child; + + child = gtk_bin_get_child (GTK_BIN (widget)); + + if (child) + gtk_widget_grab_focus (child); +} + static void ephy_embed_class_init (EphyEmbedClass *klass) { + GtkWidgetClass *widget_class = (GtkWidgetClass *)klass; + + widget_class->size_request = ephy_embed_size_request; + widget_class->size_allocate = ephy_embed_size_allocate; + widget_class->grab_focus = ephy_embed_grab_focus; + g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(EphyEmbedPrivate)); } -- cgit v1.2.3