Commit e8aa2321 authored by Germán Poo-Caamaño's avatar Germán Poo-Caamaño

misc: Remove EvPageAction widget

EvPageAction widget was the old widget for selecting a page,
which used to be shared between the main application and the
print previewer. It was superseded by EvPageActionWidget,
but the previewer was pending to use it, until now. We do not
need EvPageAction anymore.
parent da02030d
......@@ -92,7 +92,6 @@
<xi:include href="xml/ev-password-view.xml"/>
<xi:include href="xml/ev-media-player-keys.xml"/>
<xi:include href="xml/ev-file-monitor.xml"/>
<xi:include href="xml/ev-page-action.xml"/>
<xi:include href="xml/ev-window-title.xml"/>
<xi:include href="xml/ev-keyring.xml"/>
<xi:include href="xml/ev-utils.xml"/>
......
......@@ -343,25 +343,6 @@ EV_IS_FILE_MONITOR_CLASS
EV_FILE_MONITOR_GET_CLASS
</SECTION>
<SECTION>
<FILE>ev-page-action</FILE>
<TITLE>EvPageAction</TITLE>
EvPageAction
EvPageActionPrivate
EvPageActionClass
ev_page_action_set_model
ev_page_action_set_links_model
ev_page_action_grab_focus
<SUBSECTION Standard>
EV_PAGE_ACTION
EV_IS_PAGE_ACTION
EV_TYPE_PAGE_ACTION
ev_page_action_get_type
EV_PAGE_ACTION_CLASS
EV_IS_PAGE_ACTION_CLASS
EV_PAGE_ACTION_GET_CLASS
</SECTION>
<SECTION>
<FILE>ev-window-title</FILE>
EvWindowTitle
......
......@@ -4,7 +4,6 @@ ev_history_get_type
ev_media_player_keys_get_type
ev_message_area_get_type
ev_metadata_get_type
ev_page_action_get_type
ev_page_action_widget_get_type
ev_password_view_get_type
ev_progress_message_area_get_type
......
noinst_LTLIBRARIES = libevmisc.la
libevmisc_la_SOURCES = \
ev-page-action.c \
ev-page-action.h \
ev-page-action-widget.c \
ev-page-action-widget.h \
ev-search-box.c \
......
/*
* Copyright (C) 2003, 2004 Marco Pesenti Gritti
* Copyright (C) 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.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "ev-page-action.h"
#include "ev-page-action-widget.h"
struct _EvPageActionPrivate
{
EvDocumentModel *doc_model;
GtkTreeModel *model;
};
static void ev_page_action_init (EvPageAction *action);
static void ev_page_action_class_init (EvPageActionClass *class);
enum
{
ACTIVATE_LINK,
N_SIGNALS
};
static guint signals[N_SIGNALS] = {0, };
G_DEFINE_TYPE (EvPageAction, ev_page_action, GTK_TYPE_ACTION)
#define EV_PAGE_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_PAGE_ACTION, EvPageActionPrivate))
enum {
PROP_0,
PROP_MODEL
};
static GtkWidget *
create_tool_item (GtkAction *action)
{
GtkWidget *proxy;
proxy = g_object_new (EV_TYPE_PAGE_ACTION_WIDGET, NULL);
return proxy;
}
static void
update_model (EvPageAction *page, GParamSpec *pspec, EvPageActionWidget *proxy)
{
ev_page_action_widget_update_links_model (proxy, page->priv->model);
}
static void
activate_link_cb (EvPageActionWidget *proxy, EvLink *link, EvPageAction *action)
{
g_signal_emit (action, signals[ACTIVATE_LINK], 0, link);
}
static void
connect_proxy (GtkAction *action, GtkWidget *proxy)
{
EvPageAction *page = EV_PAGE_ACTION (action);
if (GTK_IS_TOOL_ITEM (proxy)) {
ev_page_action_widget_set_model (EV_PAGE_ACTION_WIDGET (proxy),
page->priv->doc_model);
g_signal_connect (proxy, "activate_link",
G_CALLBACK (activate_link_cb),
action);
g_signal_connect_object (action, "notify::model",
G_CALLBACK (update_model),
proxy, 0);
}
GTK_ACTION_CLASS (ev_page_action_parent_class)->connect_proxy (action, proxy);
}
static void
ev_page_action_dispose (GObject *object)
{
EvPageAction *page = EV_PAGE_ACTION (object);
if (page->priv->model) {
g_object_unref (page->priv->model);
page->priv->model = NULL;
}
page->priv->doc_model = NULL;
G_OBJECT_CLASS (ev_page_action_parent_class)->dispose (object);
}
static void
ev_page_action_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EvPageAction *page = EV_PAGE_ACTION (object);
switch (prop_id)
{
case PROP_MODEL:
ev_page_action_set_links_model (page, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
ev_page_action_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EvPageAction *page = EV_PAGE_ACTION (object);
switch (prop_id)
{
case PROP_MODEL:
g_value_set_object (value, page->priv->model);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
void
ev_page_action_set_model (EvPageAction *page,
EvDocumentModel *model)
{
g_return_if_fail (EV_IS_PAGE_ACTION (page));
g_return_if_fail (EV_IS_DOCUMENT_MODEL (model));
if (page->priv->doc_model == model)
return;
page->priv->doc_model = model;
}
void
ev_page_action_set_links_model (EvPageAction *page,
GtkTreeModel *links_model)
{
g_return_if_fail (EV_IS_PAGE_ACTION (page));
g_return_if_fail (GTK_IS_TREE_MODEL (links_model));
if (page->priv->model == links_model)
return;
if (page->priv->model)
g_object_unref (page->priv->model);
page->priv->model = g_object_ref (links_model);
g_object_notify (G_OBJECT (page), "model");
}
void
ev_page_action_grab_focus (EvPageAction *page_action)
{
GSList *proxies;
proxies = gtk_action_get_proxies (GTK_ACTION (page_action));
for (; proxies != NULL; proxies = proxies->next) {
EvPageActionWidget *proxy;
proxy = EV_PAGE_ACTION_WIDGET (proxies->data);
if (gtk_widget_get_mapped (GTK_WIDGET (proxy)))
ev_page_action_widget_grab_focus (proxy);
}
}
static void
ev_page_action_init (EvPageAction *page)
{
page->priv = EV_PAGE_ACTION_GET_PRIVATE (page);
}
static void
ev_page_action_class_init (EvPageActionClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkActionClass *action_class = GTK_ACTION_CLASS (class);
object_class->dispose = ev_page_action_dispose;
object_class->set_property = ev_page_action_set_property;
object_class->get_property = ev_page_action_get_property;
action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
action_class->create_tool_item = create_tool_item;
action_class->connect_proxy = connect_proxy;
signals[ACTIVATE_LINK] = g_signal_new ("activate_link",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (EvPageActionClass, activate_link),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_OBJECT);
g_object_class_install_property (object_class,
PROP_MODEL,
g_param_spec_object ("model",
"Model",
"Current Links Model",
GTK_TYPE_TREE_MODEL,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private (object_class, sizeof (EvPageActionPrivate));
}
/*
* Copyright (C) 2003, 2004 Marco Pesenti Gritti
* Copyright (C) 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.
*
*/
#ifndef EV_PAGE_ACTION_H
#define EV_PAGE_ACTION_H
#include <gtk/gtk.h>
#include <evince-document.h>
#include <evince-view.h>
G_BEGIN_DECLS
#define EV_TYPE_PAGE_ACTION (ev_page_action_get_type ())
#define EV_PAGE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_PAGE_ACTION, EvPageAction))
#define EV_PAGE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_PAGE_ACTION, EvPageActionClass))
#define EV_IS_PAGE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_PAGE_ACTION))
#define EV_IS_PAGE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EV_TYPE_PAGE_ACTION))
#define EV_PAGE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EV_TYPE_PAGE_ACTION, EvPageActionClass))
typedef struct _EvPageAction EvPageAction;
typedef struct _EvPageActionPrivate EvPageActionPrivate;
typedef struct _EvPageActionClass EvPageActionClass;
struct _EvPageAction
{
GtkAction parent;
/*< private >*/
EvPageActionPrivate *priv;
};
struct _EvPageActionClass
{
GtkActionClass parent_class;
void (* activate_link) (EvPageAction *page_action,
EvLink *link);
};
GType ev_page_action_get_type (void) G_GNUC_CONST;
void ev_page_action_set_model (EvPageAction *page_action,
EvDocumentModel *model);
void ev_page_action_set_links_model (EvPageAction *page_action,
GtkTreeModel *links_model);
void ev_page_action_grab_focus (EvPageAction *page_action);
G_END_DECLS
#endif
sources = files(
'ev-page-action.c',
'ev-page-action-widget.c',
'ev-search-box.c',
)
......
......@@ -26,7 +26,6 @@ data/org.gnome.Evince-previewer.desktop.in.in
libdocument/ev-attachment.c
libdocument/ev-document-factory.c
libdocument/ev-file-helpers.c
libmisc/ev-page-action.c
libmisc/ev-page-action-widget.c
libmisc/ev-search-box.c
libview/ev-jobs.c
......@@ -63,4 +62,4 @@ shell/ev-window.c
shell/ev-window-title.c
shell/ev-zoom-action.c
shell/help-overlay.ui
shell/main.c
shell/main.c
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment