diff options
Diffstat (limited to 'libdocument')
-rw-r--r-- | libdocument/ev-link-action.c | 102 | ||||
-rw-r--r-- | libdocument/ev-link-action.h | 9 |
2 files changed, 109 insertions, 2 deletions
diff --git a/libdocument/ev-link-action.c b/libdocument/ev-link-action.c index 3a7dfde6..3019e673 100644 --- a/libdocument/ev-link-action.c +++ b/libdocument/ev-link-action.c @@ -29,7 +29,10 @@ enum { PROP_URI, PROP_FILENAME, PROP_PARAMS, - PROP_NAME + PROP_NAME, + PROP_SHOW_LIST, + PROP_HIDE_LIST, + PROP_TOGGLE_LIST }; struct _EvLinkAction { @@ -49,6 +52,9 @@ struct _EvLinkActionPrivate { gchar *filename; gchar *params; gchar *name; + GList *show_list; + GList *hide_list; + GList *toggle_list; }; G_DEFINE_TYPE (EvLinkAction, ev_link_action, G_TYPE_OBJECT) @@ -104,6 +110,30 @@ ev_link_action_get_name (EvLinkAction *self) return self->priv->name; } +GList * +ev_link_action_get_show_list (EvLinkAction *self) +{ + g_return_val_if_fail (EV_IS_LINK_ACTION (self), NULL); + + return self->priv->show_list; +} + +GList * +ev_link_action_get_hide_list (EvLinkAction *self) +{ + g_return_val_if_fail (EV_IS_LINK_ACTION (self), NULL); + + return self->priv->hide_list; +} + +GList * +ev_link_action_get_toggle_list (EvLinkAction *self) +{ + g_return_val_if_fail (EV_IS_LINK_ACTION (self), NULL); + + return self->priv->toggle_list; +} + static void ev_link_action_get_property (GObject *object, guint prop_id, @@ -133,6 +163,15 @@ ev_link_action_get_property (GObject *object, case PROP_NAME: g_value_set_string (value, self->priv->name); break; + case PROP_SHOW_LIST: + g_value_set_pointer (value, self->priv->show_list); + break; + case PROP_HIDE_LIST: + g_value_set_pointer (value, self->priv->hide_list); + break; + case PROP_TOGGLE_LIST: + g_value_set_pointer (value, self->priv->toggle_list); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, @@ -172,6 +211,15 @@ ev_link_action_set_property (GObject *object, g_free (self->priv->name); self->priv->name = g_value_dup_string (value); break; + case PROP_SHOW_LIST: + self->priv->show_list = g_value_get_pointer (value); + break; + case PROP_HIDE_LIST: + self->priv->hide_list = g_value_get_pointer (value); + break; + case PROP_TOGGLE_LIST: + self->priv->toggle_list = g_value_get_pointer (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, @@ -212,6 +260,24 @@ ev_link_action_finalize (GObject *object) priv->name = NULL; } + if (priv->show_list) { + g_list_foreach (priv->show_list, (GFunc)g_object_unref, NULL); + g_list_free (priv->show_list); + priv->show_list = NULL; + } + + if (priv->hide_list) { + g_list_foreach (priv->hide_list, (GFunc)g_object_unref, NULL); + g_list_free (priv->hide_list); + priv->hide_list = NULL; + } + + if (priv->toggle_list) { + g_list_foreach (priv->toggle_list, (GFunc)g_object_unref, NULL); + g_list_free (priv->toggle_list); + priv->toggle_list = NULL; + } + G_OBJECT_CLASS (ev_link_action_parent_class)->finalize (object); } @@ -289,6 +355,27 @@ ev_link_action_class_init (EvLinkActionClass *ev_link_action_class) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (g_object_class, + PROP_SHOW_LIST, + g_param_spec_pointer ("show-list", + "ShowList", + "The list of layers that should be shown", + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (g_object_class, + PROP_HIDE_LIST, + g_param_spec_pointer ("hide-list", + "HideList", + "The list of layers that should be hidden", + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (g_object_class, + PROP_TOGGLE_LIST, + g_param_spec_pointer ("toggle-list", + "ToggleList", + "The list of layers that should be toggled", + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); } EvLinkAction * @@ -339,3 +426,16 @@ ev_link_action_new_named (const gchar *name) "type", EV_LINK_ACTION_TYPE_NAMED, NULL)); } + +EvLinkAction * +ev_link_action_new_layers_state (GList *show_list, + GList *hide_list, + GList *toggle_list) +{ + return EV_LINK_ACTION (g_object_new (EV_TYPE_LINK_ACTION, + "show-list", show_list, + "hide-list", hide_list, + "toggle-list", toggle_list, + "type", EV_LINK_ACTION_TYPE_LAYERS_STATE, + NULL)); +} diff --git a/libdocument/ev-link-action.h b/libdocument/ev-link-action.h index 1d525649..99664e5a 100644 --- a/libdocument/ev-link-action.h +++ b/libdocument/ev-link-action.h @@ -46,7 +46,8 @@ typedef enum { EV_LINK_ACTION_TYPE_GOTO_REMOTE, EV_LINK_ACTION_TYPE_EXTERNAL_URI, EV_LINK_ACTION_TYPE_LAUNCH, - EV_LINK_ACTION_TYPE_NAMED + EV_LINK_ACTION_TYPE_NAMED, + EV_LINK_ACTION_TYPE_LAYERS_STATE /* We'll probably fill this in more as we support the other types of * actions */ } EvLinkActionType; @@ -59,6 +60,9 @@ const gchar *ev_link_action_get_uri (EvLinkAction *self); const gchar *ev_link_action_get_filename (EvLinkAction *self); const gchar *ev_link_action_get_params (EvLinkAction *self); const gchar *ev_link_action_get_name (EvLinkAction *self); +GList *ev_link_action_get_show_list (EvLinkAction *self); +GList *ev_link_action_get_hide_list (EvLinkAction *self); +GList *ev_link_action_get_toggle_list (EvLinkAction *self); EvLinkAction *ev_link_action_new_dest (EvLinkDest *dest); EvLinkAction *ev_link_action_new_remote (EvLinkDest *dest, @@ -67,6 +71,9 @@ EvLinkAction *ev_link_action_new_external_uri (const gchar *uri); EvLinkAction *ev_link_action_new_launch (const gchar *filename, const gchar *params); EvLinkAction *ev_link_action_new_named (const gchar *name); +EvLinkAction *ev_link_action_new_layers_state (GList *show_list, + GList *hide_list, + GList *toggle_list); G_END_DECLS |