aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2011-12-15 04:45:43 +0800
committerXan Lopez <xan@igalia.com>2011-12-15 04:45:43 +0800
commita9397985aaf2dd1f4279b7b355de0c14f628f814 (patch)
tree8803f41f991bb9862c51cc658c6924eeaa1658d2 /lib
parentf60cd7fc43d25855cafaab84e655e0f2b99c95ee (diff)
downloadgsoc2013-epiphany-a9397985aaf2dd1f4279b7b355de0c14f628f814.tar
gsoc2013-epiphany-a9397985aaf2dd1f4279b7b355de0c14f628f814.tar.gz
gsoc2013-epiphany-a9397985aaf2dd1f4279b7b355de0c14f628f814.tar.bz2
gsoc2013-epiphany-a9397985aaf2dd1f4279b7b355de0c14f628f814.tar.lz
gsoc2013-epiphany-a9397985aaf2dd1f4279b7b355de0c14f628f814.tar.xz
gsoc2013-epiphany-a9397985aaf2dd1f4279b7b355de0c14f628f814.tar.zst
gsoc2013-epiphany-a9397985aaf2dd1f4279b7b355de0c14f628f814.zip
ephy-zoom-control: remove, there are no zoom toolbar items anymore
Diffstat (limited to 'lib')
-rw-r--r--lib/widgets/Makefile.am4
-rw-r--r--lib/widgets/ephy-zoom-action.c44
-rw-r--r--lib/widgets/ephy-zoom-control.c265
-rw-r--r--lib/widgets/ephy-zoom-control.h66
4 files changed, 4 insertions, 375 deletions
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am
index f9a114ee5..941a9548a 100644
--- a/lib/widgets/Makefile.am
+++ b/lib/widgets/Makefile.am
@@ -16,9 +16,7 @@ libephywidgets_la_SOURCES = \
totem-glow-button.c \
totem-glow-button.h \
ephy-zoom-action.h \
- ephy-zoom-action.c \
- ephy-zoom-control.c \
- ephy-zoom-control.h
+ ephy-zoom-action.c
libephywidgets_la_CPPFLAGS = \
-I$(top_builddir)/lib \
diff --git a/lib/widgets/ephy-zoom-action.c b/lib/widgets/ephy-zoom-action.c
index 0d42b9ce9..86d8a06f8 100644
--- a/lib/widgets/ephy-zoom-action.c
+++ b/lib/widgets/ephy-zoom-action.c
@@ -19,13 +19,12 @@
*/
#include "config.h"
-
-#include <glib/gi18n.h>
-
#include "ephy-zoom-action.h"
-#include "ephy-zoom-control.h"
+
#include "ephy-zoom.h"
+#include <glib/gi18n.h>
+
/**
* SECTION:ephy-zoom-action
* @short_description: A #GtkAction implementing a zoom control
@@ -61,41 +60,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (EphyZoomAction, ephy_zoom_action, GTK_TYPE_ACTION)
static void
-zoom_to_level_cb (EphyZoomControl *control,
- float zoom,
- EphyZoomAction *action)
-{
- g_signal_emit (action, signals[ZOOM_TO_LEVEL_SIGNAL], 0, zoom);
-}
-
-static void
-sync_zoom_cb (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
-{
- EphyZoomAction *zoom_action = EPHY_ZOOM_ACTION (action);
-
- g_object_set (G_OBJECT (proxy), "zoom", zoom_action->priv->zoom, NULL);
-}
-
-static void
-connect_proxy (GtkAction *action, GtkWidget *proxy)
-{
- if (EPHY_IS_ZOOM_CONTROL (proxy))
- {
- /* Ensure the sync is done when the item is added to
- the toolbar */
- sync_zoom_cb (action, NULL, proxy);
-
- g_signal_connect_object (action, "notify::zoom",
- G_CALLBACK (sync_zoom_cb), proxy, 0);
-
- g_signal_connect (proxy, "zoom_to_level",
- G_CALLBACK (zoom_to_level_cb), action);
- }
-
- GTK_ACTION_CLASS (ephy_zoom_action_parent_class)->connect_proxy (action, proxy);
-}
-
-static void
proxy_menu_activate_cb (GtkMenuItem *menu_item, EphyZoomAction *action)
{
gint index;
@@ -195,8 +159,6 @@ ephy_zoom_action_class_init (EphyZoomActionClass *class)
object_class->set_property = ephy_zoom_action_set_property;
object_class->get_property = ephy_zoom_action_get_property;
- action_class->toolbar_item_type = EPHY_TYPE_ZOOM_CONTROL;
- action_class->connect_proxy = connect_proxy;
action_class->create_menu_item = create_menu_item;
/**
diff --git a/lib/widgets/ephy-zoom-control.c b/lib/widgets/ephy-zoom-control.c
deleted file mode 100644
index e16f91b15..000000000
--- a/lib/widgets/ephy-zoom-control.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * 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 <glib/gi18n.h>
-
-#include "ephy-zoom-control.h"
-#include "ephy-zoom.h"
-
-/**
- * SECTION:ephy-zoom-control
- * @short_description: A #GtkToolItem implementing a zoom control
- *
- * #EphyZoomControl implements the zoom control used in Epiphany's toolbar.
- */
-
-#define EPHY_ZOOM_CONTROL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ZOOM_CONTROL, EphyZoomControlPrivate))
-
-struct _EphyZoomControlPrivate
-{
- GtkComboBox *combo;
- float zoom;
- guint handler_id;
-};
-
-enum
-{
- PROP_0,
- PROP_ZOOM
-};
-
-enum
-{
- ZOOM_TO_LEVEL_SIGNAL,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-static void ephy_zoom_control_class_init (EphyZoomControlClass *klass);
-static void ephy_zoom_control_init (EphyZoomControl *control);
-static void ephy_zoom_control_dispose (GObject *o);
-
-G_DEFINE_TYPE (EphyZoomControl, ephy_zoom_control, GTK_TYPE_TOOL_ITEM)
-
-static void
-combo_changed_cb (GtkComboBox *combo, EphyZoomControl *control)
-{
- gint index;
- float zoom;
-
- index = gtk_combo_box_get_active (combo);
- zoom = zoom_levels[index].level;
-
- if (zoom != control->priv->zoom)
- {
- g_signal_emit (control, signals[ZOOM_TO_LEVEL_SIGNAL], 0, zoom);
- }
-}
-
-static void
-sync_zoom_cb (EphyZoomControl *control, GParamSpec *pspec, gpointer data)
-{
- EphyZoomControlPrivate *p = control->priv;
- guint index;
-
- index = ephy_zoom_get_zoom_level_index (p->zoom);
-
- g_signal_handler_block (p->combo, p->handler_id);
- gtk_combo_box_set_active (p->combo, index);
- g_signal_handler_unblock (p->combo, p->handler_id);
-}
-
-static void
-ephy_zoom_control_init (EphyZoomControl *control)
-{
- EphyZoomControlPrivate *p;
- GtkComboBox *combo;
- GtkWidget *vbox;
- guint i;
-
- p = EPHY_ZOOM_CONTROL_GET_PRIVATE (control);
- control->priv = p;
-
- p->zoom = 1.0;
-
- combo = p->combo = GTK_COMBO_BOX (gtk_combo_box_text_new ());
-
- for (i = 0; i < n_zoom_levels; i++)
- {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _(zoom_levels[i].name));
- }
-
- p->combo = combo;
- gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (p->combo), FALSE);
- g_object_ref_sink (combo);
- gtk_widget_show (GTK_WIDGET (combo));
-
- i = ephy_zoom_get_zoom_level_index (p->zoom);
- gtk_combo_box_set_active (combo, i);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (combo), TRUE, FALSE, 0);
- gtk_widget_show (vbox);
-
- gtk_container_add (GTK_CONTAINER (control), vbox);
-
- p->handler_id = g_signal_connect (combo, "changed",
- G_CALLBACK (combo_changed_cb), control);
-
- g_signal_connect_object (control, "notify::zoom",
- G_CALLBACK (sync_zoom_cb), NULL, 0);
-}
-
-static void
-ephy_zoom_control_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EphyZoomControl *control;
- EphyZoomControlPrivate *p;
-
- control = EPHY_ZOOM_CONTROL (object);
- p = control->priv;
-
- switch (prop_id)
- {
- case PROP_ZOOM:
- p->zoom = g_value_get_float (value);
- break;
- }
-}
-
-static void
-ephy_zoom_control_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EphyZoomControl *control;
- EphyZoomControlPrivate *p;
-
- control = EPHY_ZOOM_CONTROL (object);
- p = control->priv;
-
- switch (prop_id)
- {
- case PROP_ZOOM:
- g_value_set_float (value, p->zoom);
- break;
- }
-}
-
-static void
-ephy_zoom_control_class_init (EphyZoomControlClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *)klass;
-
- object_class->set_property = ephy_zoom_control_set_property;
- object_class->get_property = ephy_zoom_control_get_property;
- object_class->dispose = ephy_zoom_control_dispose;
-
- /**
- * EphyZoomControl:zoom:
- *
- * The current value of #EphyZoomControl, as a float.
- */
- g_object_class_install_property (object_class,
- PROP_ZOOM,
- g_param_spec_float ("zoom", NULL, NULL,
- ZOOM_MINIMAL,
- ZOOM_MAXIMAL,
- 1.0,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- /**
- * EphyZoomControl::zoom-to-level:
- * @control: the object on which the signal is emitted
- * @level: new zoom level
- *
- * Emitted when the user changes the value of the #EphyZoomControl.
- */
- signals[ZOOM_TO_LEVEL_SIGNAL] =
- g_signal_new ("zoom-to-level",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EphyZoomControlClass,
- zoom_to_level),
- NULL, NULL,
- g_cclosure_marshal_VOID__FLOAT,
- G_TYPE_NONE,
- 1,
- G_TYPE_FLOAT);
-
- g_type_class_add_private (object_class, sizeof (EphyZoomControlPrivate));
-}
-
-static void
-ephy_zoom_control_dispose (GObject *o)
-{
- EphyZoomControl *control = EPHY_ZOOM_CONTROL (o);
-
- if (control->priv->combo)
- {
- g_object_unref (control->priv->combo);
- control->priv->combo = NULL;
- }
-
- G_OBJECT_CLASS (ephy_zoom_control_parent_class)->dispose (o);
-}
-
-/**
- * ephy_zoom_control_set_zoom_level:
- * @control: an #EphyZoomControl
- * @zoom: the new value for the zoom level
- *
- * Sets the zoom level of @control.
- **/
-void
-ephy_zoom_control_set_zoom_level (EphyZoomControl *control, float zoom)
-{
- g_return_if_fail (EPHY_IS_ZOOM_CONTROL (control));
-
- if (zoom < ZOOM_MINIMAL || zoom > ZOOM_MAXIMAL) return;
-
- control->priv->zoom = zoom;
- g_object_notify (G_OBJECT (control), "zoom");
-}
-
-/**
- * ephy_zoom_control_get_zoom_level:
- * @control: an #EphyZoomControl
- *
- * Get the current zoom level of @control.
- *
- * Returns: the zoom level as a float
- **/
-float
-ephy_zoom_control_get_zoom_level (EphyZoomControl *control)
-{
- g_return_val_if_fail (EPHY_IS_ZOOM_CONTROL (control), 1.0);
-
- return control->priv->zoom;
-}
diff --git a/lib/widgets/ephy-zoom-control.h b/lib/widgets/ephy-zoom-control.h
deleted file mode 100644
index 04b6c61dc..000000000
--- a/lib/widgets/ephy-zoom-control.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright © 2003 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_ZOOM_CONTROL_H
-#define EPHY_ZOOM_CONTROL_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EPHY_TYPE_ZOOM_CONTROL (ephy_zoom_control_get_type())
-#define EPHY_ZOOM_CONTROL(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EPHY_TYPE_ZOOM_CONTROL, EphyZoomControl))
-#define EPHY_ZOOM_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_ZOOM_CONTROL, EphyZoomControlClass))
-#define EPHY_IS_ZOOM_CONTROL(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EPHY_TYPE_ZOOM_CONTROL))
-#define EPHY_IS_ZOOM_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_ZOOM_CONTROL))
-#define EPHY_ZOOM_CONTROL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_ZOOM_CONTROL, EphyZoomControlClass))
-
-typedef struct _EphyZoomControl EphyZoomControl;
-typedef struct _EphyZoomControlClass EphyZoomControlClass;
-typedef struct _EphyZoomControlPrivate EphyZoomControlPrivate;
-
-struct _EphyZoomControlClass
-{
- GtkToolItemClass parent_class;
-
- /* signals */
- void (*zoom_to_level) (EphyZoomControl *control, float level);
-};
-
-struct _EphyZoomControl
-{
- GtkToolItem parent_object;
-
- /*< private >*/
- EphyZoomControlPrivate *priv;
-};
-
-GType ephy_zoom_control_get_type (void);
-
-void ephy_zoom_control_set_zoom_level (EphyZoomControl *control, float zoom);
-
-float ephy_zoom_control_get_zoom_level (EphyZoomControl *control);
-
-G_END_DECLS
-
-#endif