diff options
author | Xan Lopez <xan@igalia.com> | 2012-01-17 03:11:40 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-01-17 03:11:40 +0800 |
commit | 52cdd6df6cb561a48032358b3eedce16cfa2c9fb (patch) | |
tree | 1170c07244b9a2fba83251880900f8894887ae27 /src | |
parent | 1150405cc1bc50d6c258cb723a76ae90d8945f73 (diff) | |
download | gsoc2013-epiphany-52cdd6df6cb561a48032358b3eedce16cfa2c9fb.tar gsoc2013-epiphany-52cdd6df6cb561a48032358b3eedce16cfa2c9fb.tar.gz gsoc2013-epiphany-52cdd6df6cb561a48032358b3eedce16cfa2c9fb.tar.bz2 gsoc2013-epiphany-52cdd6df6cb561a48032358b3eedce16cfa2c9fb.tar.lz gsoc2013-epiphany-52cdd6df6cb561a48032358b3eedce16cfa2c9fb.tar.xz gsoc2013-epiphany-52cdd6df6cb561a48032358b3eedce16cfa2c9fb.tar.zst gsoc2013-epiphany-52cdd6df6cb561a48032358b3eedce16cfa2c9fb.zip |
Refactor GtkActions with attached EphyWindows
Make a GtkAction subclass that only holds an EphyWindow and nothing
else, and use it throughout. Allows us to kill some duplicated code.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/ephy-combined-stop-reload-action.c | 23 | ||||
-rw-r--r-- | src/ephy-link-action.c | 3 | ||||
-rw-r--r-- | src/ephy-link-action.h | 6 | ||||
-rw-r--r-- | src/ephy-navigation-action.c | 114 | ||||
-rw-r--r-- | src/ephy-navigation-action.h | 65 | ||||
-rw-r--r-- | src/ephy-navigation-history-action.c | 4 | ||||
-rw-r--r-- | src/ephy-navigation-history-action.h | 6 | ||||
-rw-r--r-- | src/ephy-page-menu-action.c | 4 | ||||
-rw-r--r-- | src/ephy-page-menu-action.h | 6 | ||||
-rw-r--r-- | src/ephy-toolbar.c | 6 | ||||
-rw-r--r-- | src/ephy-window-action.c | 102 | ||||
-rw-r--r-- | src/ephy-window-action.h | 62 |
13 files changed, 190 insertions, 215 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index f89a0219f..24d47ae7d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,11 +25,11 @@ NOINST_H_FILES = \ ephy-link-action.h \ ephy-lockdown.h \ ephy-location-action.h \ - ephy-navigation-action.h \ ephy-navigation-history-action.h \ ephy-page-menu-action.h \ ephy-password-info.h \ ephy-toolbar.h \ + ephy-window-action.h \ languages.h \ pdm-dialog.h \ popup-commands.h \ @@ -64,7 +64,6 @@ libephymain_la_SOURCES = \ ephy-link-action.c \ ephy-location-action.c \ ephy-lockdown.c \ - ephy-navigation-action.c \ ephy-navigation-history-action.c \ ephy-notebook.c \ ephy-page-menu-action.c \ @@ -73,6 +72,7 @@ libephymain_la_SOURCES = \ ephy-shell.c \ ephy-toolbar.c \ ephy-window.c \ + ephy-window-action.c \ pdm-dialog.c \ popup-commands.c \ prefs-dialog.c \ diff --git a/src/ephy-combined-stop-reload-action.c b/src/ephy-combined-stop-reload-action.c index 0789a2822..0e85cd106 100644 --- a/src/ephy-combined-stop-reload-action.c +++ b/src/ephy-combined-stop-reload-action.c @@ -22,12 +22,12 @@ #include "config.h" #include "ephy-combined-stop-reload-action.h" -#include "ephy-window.h" +#include "ephy-window-action.h" #include "window-commands.h" #include <glib/gi18n.h> -G_DEFINE_TYPE (EphyCombinedStopReloadAction, ephy_combined_stop_reload_action, GTK_TYPE_ACTION) +G_DEFINE_TYPE (EphyCombinedStopReloadAction, ephy_combined_stop_reload_action, EPHY_TYPE_WINDOW_ACTION) #define COMBINED_STOP_RELOAD_ACTION_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), EPHY_TYPE_COMBINED_STOP_RELOAD_ACTION, EphyCombinedStopReloadActionPrivate)) @@ -35,7 +35,6 @@ G_DEFINE_TYPE (EphyCombinedStopReloadAction, ephy_combined_stop_reload_action, G struct _EphyCombinedStopReloadActionPrivate { gboolean loading; - EphyWindow *window; gulong action_handler_id; }; @@ -55,8 +54,7 @@ typedef enum { enum { PROP_0, - PROP_LOADING, - PROP_WINDOW + PROP_LOADING }; void @@ -86,7 +84,7 @@ ephy_combined_stop_reload_action_set_loading (EphyCombinedStopReloadAction *acti priv->action_handler_id = g_signal_connect (action, "activate", combined_stop_reload_action_entries[action_enum].callback, - priv->window); + ephy_window_action_get_window (EPHY_WINDOW_ACTION (action))); priv->loading = loading; } @@ -104,9 +102,6 @@ ephy_combined_stop_reload_action_get_property (GObject *object, case PROP_LOADING: g_value_set_boolean (value, action->priv->loading); break; - case PROP_WINDOW: - g_value_set_object (value, action->priv->window); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } @@ -126,9 +121,6 @@ ephy_combined_stop_reload_action_set_property (GObject *object, ephy_combined_stop_reload_action_set_loading (action, g_value_get_boolean (value)); break; - case PROP_WINDOW: - action->priv->window = EPHY_WINDOW (g_value_get_object (value)); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } @@ -149,13 +141,6 @@ ephy_combined_stop_reload_action_class_init (EphyCombinedStopReloadActionClass * g_param_spec_boolean ("loading", NULL, NULL, FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - - g_object_class_install_property (object_class, - PROP_WINDOW, - g_param_spec_object ("window", NULL, NULL, - EPHY_TYPE_WINDOW, - G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - } static void diff --git a/src/ephy-link-action.c b/src/ephy-link-action.c index 804aae7c4..665975a0b 100644 --- a/src/ephy-link-action.c +++ b/src/ephy-link-action.c @@ -25,10 +25,11 @@ #include "ephy-debug.h" #include "ephy-gui.h" #include "ephy-link.h" +#include "ephy-window-action.h" #include <gtk/gtk.h> -G_DEFINE_TYPE_WITH_CODE (EphyLinkAction, ephy_link_action, GTK_TYPE_ACTION, +G_DEFINE_TYPE_WITH_CODE (EphyLinkAction, ephy_link_action, EPHY_TYPE_WINDOW_ACTION, G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK, NULL)) diff --git a/src/ephy-link-action.h b/src/ephy-link-action.h index a6b4419cc..b2113bd4e 100644 --- a/src/ephy-link-action.h +++ b/src/ephy-link-action.h @@ -24,6 +24,8 @@ #ifndef EPHY_LINK_ACTION_H #define EPHY_LINK_ACTION_H +#include "ephy-window-action.h" + #include <gtk/gtk.h> G_BEGIN_DECLS @@ -51,14 +53,14 @@ typedef struct _EphyLinkActionGroupClass EphyLinkActionGroupClass; struct _EphyLinkAction { - GtkAction parent_instance; + EphyWindowAction parent_instance; EphyLinkActionPrivate *priv; }; struct _EphyLinkActionClass { - GtkActionClass parent_class; + EphyWindowActionClass parent_class; }; struct _EphyLinkActionGroup diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c deleted file mode 100644 index 438e6cf51..000000000 --- a/src/ephy-navigation-action.c +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright © 2003, 2004 Marco Pesenti Gritti - * Copyright © 2003, 2004 Christian Persch - * Copyright © 2008 Jan Alonzo - * Copyright © 2009, 2011 Igalia S.L. - * - * 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-navigation-action.h" - -#include "ephy-middle-clickable-tool-button.h" -#include "ephy-window.h" - -#include <gtk/gtk.h> - -#define EPHY_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionPrivate)) - -struct _EphyNavigationActionPrivate -{ - EphyWindow *window; -}; - -enum -{ - PROP_0, - PROP_WINDOW -}; - -static void ephy_navigation_action_init (EphyNavigationAction *action); -static void ephy_navigation_action_class_init (EphyNavigationActionClass *class); - -G_DEFINE_TYPE (EphyNavigationAction, ephy_navigation_action, EPHY_TYPE_LINK_ACTION) - -static void -ephy_navigation_action_init (EphyNavigationAction *action) -{ - action->priv = EPHY_NAVIGATION_ACTION_GET_PRIVATE (action); -} - -static void -ephy_navigation_action_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EphyNavigationAction *nav = EPHY_NAVIGATION_ACTION (object); - - switch (prop_id) - { - case PROP_WINDOW: - nav->priv->window = EPHY_WINDOW (g_value_get_object (value)); - break; - } -} - -static void -ephy_navigation_action_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EphyNavigationAction *nav = EPHY_NAVIGATION_ACTION (object); - - switch (prop_id) - { - case PROP_WINDOW: - g_value_set_object (value, nav->priv->window); - break; - } -} - -static void -ephy_navigation_action_class_init (EphyNavigationActionClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - object_class->set_property = ephy_navigation_action_set_property; - object_class->get_property = ephy_navigation_action_get_property; - - action_class->toolbar_item_type = EPHY_TYPE_MIDDLE_CLICKABLE_TOOL_BUTTON; - - g_object_class_install_property (object_class, - PROP_WINDOW, - g_param_spec_object ("window", NULL, NULL, - G_TYPE_OBJECT, - G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - - g_type_class_add_private (object_class, sizeof (EphyNavigationActionPrivate)); -} - -EphyWindow * -_ephy_navigation_action_get_window (EphyNavigationAction *action) -{ - g_return_val_if_fail (EPHY_IS_NAVIGATION_ACTION (action), NULL); - - return action->priv->window; -} diff --git a/src/ephy-navigation-action.h b/src/ephy-navigation-action.h deleted file mode 100644 index 30c4b17b3..000000000 --- a/src/ephy-navigation-action.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_NAVIGATION_ACTION_H -#define EPHY_NAVIGATION_ACTION_H - -#include "ephy-link-action.h" -#include "ephy-window.h" - -G_BEGIN_DECLS - -#define EPHY_TYPE_NAVIGATION_ACTION (ephy_navigation_action_get_type ()) -#define EPHY_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationAction)) -#define EPHY_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionClass)) -#define EPHY_IS_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_NAVIGATION_ACTION)) -#define EPHY_IS_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_NAVIGATION_ACTION)) -#define EPHY_NAVIGATION_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionClass)) - -typedef struct _EphyNavigationAction EphyNavigationAction; -typedef struct _EphyNavigationActionPrivate EphyNavigationActionPrivate; -typedef struct _EphyNavigationActionClass EphyNavigationActionClass; - -struct _EphyNavigationAction -{ - EphyLinkAction parent; - - /*< private >*/ - EphyNavigationActionPrivate *priv; -}; - -struct _EphyNavigationActionClass -{ - EphyLinkActionClass parent_class; -}; - -GType ephy_navigation_action_get_type (void); - -/*< Protected >*/ - -EphyWindow *_ephy_navigation_action_get_window (EphyNavigationAction *action); - -G_END_DECLS - -#endif diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c index cac0735cf..1fdf937aa 100644 --- a/src/ephy-navigation-history-action.c +++ b/src/ephy-navigation-history-action.c @@ -56,7 +56,7 @@ enum { static void ephy_navigation_history_action_init (EphyNavigationHistoryAction *action); static void ephy_navigation_history_action_class_init (EphyNavigationHistoryActionClass *klass); -G_DEFINE_TYPE (EphyNavigationHistoryAction, ephy_navigation_history_action, EPHY_TYPE_NAVIGATION_ACTION) +G_DEFINE_TYPE (EphyNavigationHistoryAction, ephy_navigation_history_action, EPHY_TYPE_LINK_ACTION) static void ephy_history_cleared_cb (EphyHistory *history, @@ -74,7 +74,7 @@ action_activate (GtkAction *action) WebKitWebView *web_view; history_action = EPHY_NAVIGATION_HISTORY_ACTION (action); - window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + window = ephy_window_action_get_window (EPHY_WINDOW_ACTION (action)); embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); g_return_if_fail (embed != NULL); diff --git a/src/ephy-navigation-history-action.h b/src/ephy-navigation-history-action.h index 6388b4da3..d455e86d2 100644 --- a/src/ephy-navigation-history-action.h +++ b/src/ephy-navigation-history-action.h @@ -26,7 +26,7 @@ #ifndef EPHY_NAVIGATION_HISTORY_ACTION_H #define EPHY_NAVIGATION_HISTORY_ACTION_H -#include "ephy-navigation-action.h" +#include "ephy-link-action.h" G_BEGIN_DECLS @@ -49,7 +49,7 @@ typedef struct _EphyNavigationHistoryActionClass EphyNavigationHistoryActionClas struct _EphyNavigationHistoryAction { - EphyNavigationAction parent; + EphyLinkAction parent; /*< private >*/ EphyNavigationHistoryActionPrivate *priv; @@ -57,7 +57,7 @@ struct _EphyNavigationHistoryAction struct _EphyNavigationHistoryActionClass { - EphyNavigationActionClass parent_class; + EphyLinkActionClass parent_class; }; GType ephy_navigation_history_action_get_type (void); diff --git a/src/ephy-page-menu-action.c b/src/ephy-page-menu-action.c index 2342512ae..dad11c4cb 100644 --- a/src/ephy-page-menu-action.c +++ b/src/ephy-page-menu-action.c @@ -21,7 +21,7 @@ #include "config.h" #include "ephy-page-menu-action.h" -G_DEFINE_TYPE (EphyPageMenuAction, ephy_page_menu_action, EPHY_TYPE_NAVIGATION_ACTION); +G_DEFINE_TYPE (EphyPageMenuAction, ephy_page_menu_action, EPHY_TYPE_WINDOW_ACTION); static void menu_position_func (GtkMenu *menu, @@ -66,7 +66,7 @@ ephy_page_menu_action_activate (GtkAction *action) guint activate_button = 1; guint32 activate_time = 0; - window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + window = ephy_window_action_get_window (EPHY_WINDOW_ACTION (action)); manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); menu = gtk_ui_manager_get_widget (manager, "/ui/PagePopup"); diff --git a/src/ephy-page-menu-action.h b/src/ephy-page-menu-action.h index c7239b655..c510f944b 100644 --- a/src/ephy-page-menu-action.h +++ b/src/ephy-page-menu-action.h @@ -21,7 +21,7 @@ #ifndef __EPHY_PAGE_MENU_ACTION_H__ #define __EPHY_PAGE_MENU_ACTION_H__ -#include "ephy-navigation-action.h" +#include "ephy-window-action.h" #include <gtk/gtk.h> @@ -38,11 +38,11 @@ typedef struct _EphyPageMenuAction EphyPageMenuAction; typedef struct _EphyPageMenuActionClass EphyPageMenuActionClass; struct _EphyPageMenuActionClass { - EphyNavigationActionClass parent_class; + EphyWindowActionClass parent_class; }; struct _EphyPageMenuAction { - EphyNavigationAction parent_instance; + EphyWindowAction parent_instance; }; GType ephy_page_menu_action_get_type (void) G_GNUC_CONST; diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c index b167f06d8..2e1b1199e 100644 --- a/src/ephy-toolbar.c +++ b/src/ephy-toolbar.c @@ -21,6 +21,8 @@ #include "config.h" #include "ephy-toolbar.h" +#include "ephy-middle-clickable-button.h" + G_DEFINE_TYPE (EphyToolbar, ephy_toolbar, GTK_TYPE_TOOLBAR) #define EPHY_TOOLBAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EPHY_TYPE_TOOLBAR, EphyToolbarPrivate)) @@ -90,7 +92,7 @@ ephy_toolbar_constructed (GObject *object) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); /* Back */ - tool_button = gtk_button_new (); + tool_button = ephy_middle_clickable_button_new (); /* FIXME: apparently we need an image inside the button for the action * icon to appear. */ gtk_button_set_image (GTK_BUTTON (tool_button), gtk_image_new ()); @@ -101,7 +103,7 @@ ephy_toolbar_constructed (GObject *object) gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (tool_button)); /* Forward */ - tool_button = gtk_button_new (); + tool_button = ephy_middle_clickable_button_new (); /* FIXME: apparently we need an image inside the button for the action * icon to appear. */ gtk_button_set_image (GTK_BUTTON (tool_button), gtk_image_new ()); diff --git a/src/ephy-window-action.c b/src/ephy-window-action.c new file mode 100644 index 000000000..f04d7e5a3 --- /dev/null +++ b/src/ephy-window-action.c @@ -0,0 +1,102 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Copyright © 2012 Igalia S.L. + * + * 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-window-action.h" + +#include <gtk/gtk.h> + +#define EPHY_WINDOW_ACTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EPHY_TYPE_WINDOW_ACTION, EphyWindowActionPrivate)) + +struct _EphyWindowActionPrivate { + EphyWindow *window; +}; + +enum { + PROP_0, + PROP_WINDOW +}; + +G_DEFINE_TYPE (EphyWindowAction, ephy_window_action, GTK_TYPE_ACTION) + +static void +ephy_window_action_init (EphyWindowAction *action) +{ + action->priv = EPHY_WINDOW_ACTION_GET_PRIVATE (action); +} + +static void +ephy_window_action_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + EphyWindowAction *action = EPHY_WINDOW_ACTION (object); + + switch (property_id) { + case PROP_WINDOW: + action->priv->window = EPHY_WINDOW (g_value_get_object (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +ephy_window_action_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + EphyWindowAction *action = EPHY_WINDOW_ACTION (object); + + switch (property_id) { + case PROP_WINDOW: + g_value_set_object (value, action->priv->window); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +ephy_window_action_class_init (EphyWindowActionClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + object_class->set_property = ephy_window_action_set_property; + object_class->get_property = ephy_window_action_get_property; + + g_object_class_install_property (object_class, + PROP_WINDOW, + g_param_spec_object ("window", NULL, NULL, + G_TYPE_OBJECT, + G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); + + g_type_class_add_private (object_class, sizeof (EphyWindowActionPrivate)); +} + +EphyWindow * +ephy_window_action_get_window (EphyWindowAction *action) +{ + g_return_val_if_fail (EPHY_IS_WINDOW_ACTION (action), NULL); + + return action->priv->window; +} diff --git a/src/ephy-window-action.h b/src/ephy-window-action.h new file mode 100644 index 000000000..388bdfaeb --- /dev/null +++ b/src/ephy-window-action.h @@ -0,0 +1,62 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * Copyright © 2012 Igalia S.L. + * + * 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_WINDOW_ACTION_H +#define EPHY_WINDOW_ACTION_H + +#include "ephy-window.h" + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define EPHY_TYPE_WINDOW_ACTION (ephy_window_action_get_type ()) +#define EPHY_WINDOW_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_WINDOW_ACTION, EphyWindowAction)) +#define EPHY_WINDOW_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_WINDOW_ACTION, EphyWindowActionClass)) +#define EPHY_IS_WINDOW_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_WINDOW_ACTION)) +#define EPHY_IS_WINDOW_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_WINDOW_ACTION)) +#define EPHY_WINDOW_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_WINDOW_ACTION, EphyWindowActionClass)) + +typedef struct _EphyWindowAction EphyWindowAction; +typedef struct _EphyWindowActionPrivate EphyWindowActionPrivate; +typedef struct _EphyWindowActionClass EphyWindowActionClass; + +struct _EphyWindowAction { + GtkAction parent; + + /*< private >*/ + EphyWindowActionPrivate *priv; +}; + +struct _EphyWindowActionClass { + GtkActionClass parent_class; +}; + +GType ephy_window_action_get_type (void); + +EphyWindow *ephy_window_action_get_window (EphyWindowAction *action); + +G_END_DECLS + +#endif |