diff options
author | Xan Lopez <xan@src.gnome.org> | 2008-12-31 06:33:08 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2008-12-31 06:33:08 +0800 |
commit | ddb6a105bb5a0de256ed8fbe676673cd74b3a551 (patch) | |
tree | d5061ecfb4b094df02e3eb0a902c78d80785d451 | |
parent | 6191d0ea18b36b108d64edcae7652aa3ec805482 (diff) | |
download | gsoc2013-epiphany-ddb6a105bb5a0de256ed8fbe676673cd74b3a551.tar gsoc2013-epiphany-ddb6a105bb5a0de256ed8fbe676673cd74b3a551.tar.gz gsoc2013-epiphany-ddb6a105bb5a0de256ed8fbe676673cd74b3a551.tar.bz2 gsoc2013-epiphany-ddb6a105bb5a0de256ed8fbe676673cd74b3a551.tar.lz gsoc2013-epiphany-ddb6a105bb5a0de256ed8fbe676673cd74b3a551.tar.xz gsoc2013-epiphany-ddb6a105bb5a0de256ed8fbe676673cd74b3a551.tar.zst gsoc2013-epiphany-ddb6a105bb5a0de256ed8fbe676673cd74b3a551.zip |
Delete EphyIconEntry, it's unused.
svn path=/trunk/; revision=8655
-rw-r--r-- | lib/widgets/Makefile.am | 2 | ||||
-rw-r--r-- | lib/widgets/ephy-icon-entry.c | 377 | ||||
-rw-r--r-- | lib/widgets/ephy-icon-entry.h | 80 | ||||
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/testephyiconentry.c | 117 |
5 files changed, 0 insertions, 583 deletions
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am index ef4ee116a..4a3a69033 100644 --- a/lib/widgets/Makefile.am +++ b/lib/widgets/Makefile.am @@ -1,8 +1,6 @@ noinst_LTLIBRARIES = libephywidgets.la libephywidgets_la_SOURCES = \ - ephy-icon-entry.c \ - ephy-icon-entry.h \ ephy-location-entry.c \ ephy-location-entry.h \ ephy-node-view.c \ diff --git a/lib/widgets/ephy-icon-entry.c b/lib/widgets/ephy-icon-entry.c deleted file mode 100644 index 78af35edc..000000000 --- a/lib/widgets/ephy-icon-entry.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright © 2003, 2004, 2005 Christian Persch - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * Adapted and modified from gtk+ code: - * - * Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Modified by the GTK+ Team and others 1997-2005. See the AUTHORS - * file in the gtk+ distribution for a list of people on the GTK+ Team. - * See the ChangeLog in the gtk+ distribution files for a list of changes. - * These files are distributed with GTK+ at ftp://ftp.gtk.org/pub/gtk/. - * - * $Id$ - */ - -#include "config.h" - -#include "ephy-icon-entry.h" - -#include <gtk/gtk.h> - -#define EPHY_ICON_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ICON_ENTRY, EphyIconEntryPrivate)) - -struct _EphyIconEntryPrivate -{ - GtkWidget *hbox; -}; - -static GtkWidgetClass *parent_class = NULL; - -/* private helper functions */ - -static gboolean -entry_focus_change_cb (GtkWidget *widget, - GdkEventFocus *event, - GtkWidget *entry) -{ - gtk_widget_queue_draw (entry); - - return FALSE; -} - -static void -ephy_icon_entry_get_borders (GtkWidget *widget, - GtkWidget *entry, - int *xborder, - int *yborder) -{ - int focus_width; - gboolean interior_focus; - - g_return_if_fail (entry->style != NULL); - - gtk_widget_style_get (entry, - "focus-line-width", &focus_width, - "interior-focus", &interior_focus, - NULL); - - *xborder = entry->style->xthickness; - *yborder = entry->style->ythickness; - - if (!interior_focus) - { - *xborder += focus_width; - *yborder += focus_width; - } -} - -static void -ephy_icon_entry_paint (GtkWidget *widget, - GdkEventExpose *event) -{ - EphyIconEntry *entry = EPHY_ICON_ENTRY (widget); - GtkWidget *entry_widget = entry->entry; - int x = 0, y = 0, width, height, focus_width; - gboolean interior_focus; - - gtk_widget_style_get (entry_widget, - "interior-focus", &interior_focus, - "focus-line-width", &focus_width, - NULL); - - gdk_drawable_get_size (widget->window, &width, &height); - - if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus) - { - x += focus_width; - y += focus_width; - width -= 2 * focus_width; - height -= 2 * focus_width; - } - - gtk_paint_flat_box (entry_widget->style, widget->window, - GTK_WIDGET_STATE (entry_widget), GTK_SHADOW_NONE, - NULL, entry_widget, "entry_bg", - /* FIXME: was 0, 0 in gtk_entry_expose, but I think this is correct: */ - x, y, width, height); - - gtk_paint_shadow (entry_widget->style, widget->window, - GTK_STATE_NORMAL, GTK_SHADOW_IN, - NULL, entry_widget, "entry", - x, y, width, height); - - if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus) - { - x -= focus_width; - y -= focus_width; - width += 2 * focus_width; - height += 2 * focus_width; - - gtk_paint_focus (entry_widget->style, widget->window, - GTK_WIDGET_STATE (entry_widget), - NULL, entry_widget, "entry", - /* FIXME: was 0, 0 in gtk_entry_draw_frame, but I think this is correct: */ - x, y, width, height); - } -} - -/* Class implementation */ - -static void -ephy_icon_entry_init (EphyIconEntry *entry) -{ - EphyIconEntryPrivate *priv; - GtkWidget *widget = (GtkWidget *) entry; - - priv = entry->priv = EPHY_ICON_ENTRY_GET_PRIVATE (entry); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW); - - priv->hbox = gtk_hbox_new (FALSE, /* FIXME */ 0); - gtk_container_add (GTK_CONTAINER (entry), priv->hbox); - - entry->entry = gtk_entry_new (); - gtk_entry_set_has_frame (GTK_ENTRY (entry->entry), FALSE); - gtk_box_pack_start (GTK_BOX (priv->hbox), entry->entry, TRUE, TRUE, /* FIXME */ 0); - - /* We need to queue a redraw when focus changes, to comply with themes - * (like Clearlooks) which draw focused and unfocused entries differently. - */ - g_signal_connect_after (entry->entry, "focus-in-event", - G_CALLBACK (entry_focus_change_cb), entry); - g_signal_connect_after (entry->entry, "focus-out-event", - G_CALLBACK (entry_focus_change_cb), entry); -} - -static void -ephy_icon_entry_realize (GtkWidget *widget) -{ - GdkWindowAttr attributes; - gint attributes_mask; - gint border_width; - - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); - - border_width = GTK_CONTAINER (widget)->border_width; - - attributes.x = widget->allocation.x + border_width; - attributes.y = widget->allocation.y + border_width; - attributes.width = widget->allocation.width - 2 * border_width; - attributes.height = widget->allocation.height - 2 * border_width; - attributes.window_type = GDK_WINDOW_CHILD; - attributes.event_mask = gtk_widget_get_events (widget) - | GDK_EXPOSURE_MASK; - - attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); - attributes.wclass = GDK_INPUT_OUTPUT; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, widget); - - widget->style = gtk_style_attach (widget->style, widget->window); - - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); -} - -static void -ephy_icon_entry_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - EphyIconEntry *entry = EPHY_ICON_ENTRY (widget); - GtkContainer *container = GTK_CONTAINER (widget); - GtkBin *bin = GTK_BIN (widget); - int xborder, yborder; - - requisition->width = requisition->height = container->border_width * 2; - - gtk_widget_ensure_style (entry->entry); - ephy_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder); - - if (GTK_WIDGET_VISIBLE (bin->child)) - { - GtkRequisition child_requisition; - - gtk_widget_size_request (bin->child, &child_requisition); - requisition->width += child_requisition.width; - requisition->height += child_requisition.height; - } - - requisition->width += 2 * xborder; - requisition->height += 2 * yborder; -} - -static void -ephy_icon_entry_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EphyIconEntry *entry = EPHY_ICON_ENTRY (widget); - GtkContainer *container = GTK_CONTAINER (widget); - GtkBin *bin = GTK_BIN (widget); - GtkAllocation child_allocation; - int xborder, yborder; - - widget->allocation = *allocation; - - ephy_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder); - - if (GTK_WIDGET_REALIZED (widget)) - { - child_allocation.x = container->border_width; - child_allocation.y = container->border_width; - child_allocation.width = MAX (allocation->width - container->border_width * 2, 0); - child_allocation.height = MAX (allocation->height - container->border_width * 2, 0); - - gdk_window_move_resize (widget->window, - allocation->x + child_allocation.x, - allocation->y + child_allocation.y, - child_allocation.width, - child_allocation.height); - } - - child_allocation.x = container->border_width + xborder; - child_allocation.y = container->border_width + yborder; - child_allocation.width = MAX (allocation->width - (container->border_width + xborder) * 2, 0); - child_allocation.height = MAX (allocation->height - (container->border_width + yborder) * 2, 0); - - gtk_widget_size_allocate (bin->child, &child_allocation); -} - -static gboolean -ephy_icon_entry_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - if (GTK_WIDGET_DRAWABLE (widget) && - event->window == widget->window) - { - ephy_icon_entry_paint (widget, event); - } - - return parent_class->expose_event (widget, event); -} - -static void -ephy_icon_entry_class_init (EphyIconEntryClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - parent_class = GTK_WIDGET_CLASS (g_type_class_peek_parent (klass)); - - widget_class->realize = ephy_icon_entry_realize; - widget_class->size_request = ephy_icon_entry_size_request; - widget_class->size_allocate = ephy_icon_entry_size_allocate; - widget_class->expose_event = ephy_icon_entry_expose; - - g_type_class_add_private (object_class, sizeof (EphyIconEntryPrivate)); -} - -GType -ephy_icon_entry_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - const GTypeInfo our_info = - { - sizeof (EphyIconEntryClass), - NULL, - NULL, - (GClassInitFunc) ephy_icon_entry_class_init, - NULL, - NULL, - sizeof (EphyIconEntry), - 0, - (GInstanceInitFunc) ephy_icon_entry_init - }; - - type = g_type_register_static (GTK_TYPE_BIN, - "EphyIconEntry", - &our_info, 0); - } - - return type; -} - -/* public functions */ - -/** - * ephy_icon_entry_new: - * - * Creates a new #EphyIconEntry. - * - * Return value: the new #GtkWidget - * - **/ -GtkWidget * -ephy_icon_entry_new (void) -{ - return GTK_WIDGET (g_object_new (EPHY_TYPE_ICON_ENTRY, NULL)); -} - -/** - * ephy_icon_entry_pack_widget: - * @entry: an #EphyIconEntry - * @widget: a #GtkWidget to pack into the entry - * @start: wheter we should use gtk_box_pack_start or gtk_box_pack_end - * - * Packs a widget into an #EphyIconEntry, the @start parameter determines if - * it's packed at the start or end of it. - * - **/ -void -ephy_icon_entry_pack_widget (EphyIconEntry *entry, - GtkWidget *widget, - gboolean start) -{ - EphyIconEntryPrivate *priv; - - g_return_if_fail (EPHY_IS_ICON_ENTRY (entry)); - - priv = entry->priv; - - if (start) - { - gtk_box_pack_start (GTK_BOX (priv->hbox), widget, FALSE, FALSE, /* FIXME */ 2); - gtk_box_reorder_child (GTK_BOX (priv->hbox), widget, 0); - } - else - { - gtk_box_pack_end (GTK_BOX (priv->hbox), widget, FALSE, FALSE, /* FIXME */ 2); - } -} - -/** - * ephy_icon_entry_get_entry: - * @entry: an #EphyIconEntry - * - * Returns the #GtkEntry inside @entry. - * - * Return value: the embedded #GtkEntry - * - **/ -GtkWidget * -ephy_icon_entry_get_entry (EphyIconEntry *entry) -{ - g_return_val_if_fail (EPHY_IS_ICON_ENTRY (entry), NULL); - - return entry->entry; -} diff --git a/lib/widgets/ephy-icon-entry.h b/lib/widgets/ephy-icon-entry.h deleted file mode 100644 index f14cf306a..000000000 --- a/lib/widgets/ephy-icon-entry.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright © 2003, 2004, 2005 Christian Persch - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * Adapted and modified from gtk+ code: - * - * Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file in the gtk+ distribution for a list of people on the GTK+ Team. - * See the ChangeLog in the gtk+ distribution files for a list of changes. - * These files are distributed with GTK+ at ftp://ftp.gtk.org/pub/gtk/. - * - * $Id$ - */ - -#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) -#error "Only <epiphany/epiphany.h> can be included directly." -#endif - -#ifndef EPHY_ICON_ENTRY_H -#define EPHY_ICON_ENTRY_H - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define EPHY_TYPE_ICON_ENTRY (ephy_icon_entry_get_type()) -#define EPHY_ICON_ENTRY(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EPHY_TYPE_ICON_ENTRY, EphyIconEntry)) -#define EPHY_ICON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_ICON_ENTRY, EphyIconEntryClass)) -#define EPHY_IS_ICON_ENTRY(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EPHY_TYPE_ICON_ENTRY)) -#define EPHY_IS_ICON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_ICON_ENTRY)) -#define EPHY_ICON_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_ICON_ENTRY, EphyIconEntryClass)) - -typedef struct _EphyIconEntryClass EphyIconEntryClass; -typedef struct _EphyIconEntry EphyIconEntry; -typedef struct _EphyIconEntryPrivate EphyIconEntryPrivate; - -struct _EphyIconEntryClass -{ - GtkBinClass parent_class; -}; - -struct _EphyIconEntry -{ - GtkBin parent_object; - - /*< public >*/ - GtkWidget *entry; - - /*< private >*/ - EphyIconEntryPrivate *priv; -}; - -GType ephy_icon_entry_get_type (void); - -GtkWidget *ephy_icon_entry_new (void); - -void ephy_icon_entry_pack_widget (EphyIconEntry *entry, - GtkWidget *widget, - gboolean start); - -GtkWidget *ephy_icon_entry_get_entry (EphyIconEntry *entry); - -G_END_DECLS - -#endif diff --git a/tests/Makefile.am b/tests/Makefile.am index ad2a9f949..7302f6e80 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,6 @@ noinst_PROGRAMS = \ testephysearchentry \ testephylocationentry \ - testephyiconentry \ testephyzoomcontrol INCLUDES = \ @@ -21,12 +20,6 @@ testephysearchentry_LDADD = \ $(top_builddir)/lib/widgets/libephywidgets.la \ $(DEPENDENCIES_LIBS) -testephyiconentry_SOURCES = \ - testephyiconentry.c -testephyiconentry_LDADD = \ - $(top_builddir)/lib/widgets/libephywidgets.la \ - $(DEPENDENCIES_LIBS) - testephylocationentry_SOURCES = \ testephylocationentry.c testephylocationentry_LDADD = \ diff --git a/tests/testephyiconentry.c b/tests/testephyiconentry.c deleted file mode 100644 index 8486f1554..000000000 --- a/tests/testephyiconentry.c +++ /dev/null @@ -1,117 +0,0 @@ -/* vim: set sw=2 ts=2 sts=2 et: */ -/* - * testephyiconentry.c - * This file is part of Epiphany - * - * Copyright (C) 2008 - Diego Escalante Urrelo - * - * Epiphany 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 of the License, or - * (at your option) any later version. - * - * Epiphany 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 Epiphany; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "ephy-icon-entry.h" -#include <gtk/gtk.h> - -static void -test_entry_new (void) -{ - GtkWidget *entry; - - entry = ephy_icon_entry_new (); - - g_assert (GTK_IS_WIDGET (entry)); - g_assert (EPHY_IS_ICON_ENTRY (entry)); -} - -static void -test_entry_pack_widget (void) -{ - GtkWidget *entry; - - GtkWidget *first; - GtkWidget *last; - - GList *hbox = NULL; - GList *list = NULL; - GList *l = NULL; - - entry = ephy_icon_entry_new (); - - first = gtk_button_new (); - last = gtk_entry_new (); - - /* Add a widget to the start */ - ephy_icon_entry_pack_widget (EPHY_ICON_ENTRY (entry), first, TRUE); - /* Add a widget to the end */ - ephy_icon_entry_pack_widget (EPHY_ICON_ENTRY (entry), last, FALSE); - - /* The first children is an hbox */ - hbox = gtk_container_get_children (GTK_CONTAINER (entry)); - list = gtk_container_get_children (GTK_CONTAINER (hbox->data)); - g_list_free (hbox); - - g_assert (list); - - /* Remember inside the hbox there's a GtkEntry + our widgets */ - g_assert_cmpuint (g_list_length (list), ==, 3); - - /* Get the first one */ - l = g_list_nth (list, 0); - g_assert (l); - g_assert (GTK_IS_BUTTON (l->data)); - - /* Get the last one */ - l = g_list_nth (list, 2); - g_assert (l); - g_assert (GTK_IS_ENTRY (l->data)); - - g_list_free (list); - g_list_free (l); -} - -static void -test_entry_get_entry (void) -{ - GtkWidget *internal; - - GtkWidget *entry; - - entry = ephy_icon_entry_new (); - internal = ephy_icon_entry_get_entry (EPHY_ICON_ENTRY (entry)); - - g_assert (GTK_IS_ENTRY (internal)); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv); - - g_test_add_func ( - "/lib/widgets/ephy-icon-entry/new", - test_entry_new); - /* FIXME: If we invert this two add_funcs, it will NOT segfault, weird! - * memory leak anyone? - */ - g_test_add_func ( - "/lib/widgets/ephy-icon-entry/pack_widget", - test_entry_pack_widget); - g_test_add_func ( - "/lib/widgets/ephy-icon-entry/get_entry", - test_entry_get_entry); - - return g_test_run (); -} |