Initial import of ephy (rev# 7126) from svn
[ephy-soc.git] / embed / .svn / text-base / ephy-embed-find.c.svn-base
blob45e88a0b3e0d6741ea7793088a9e52d34fbc1044
1 /*
2  *  Copyright © 2005 Christian Persch
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2, or (at your option)
7  *  any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  *  $Id$
19  */
21 #include "config.h"
23 #include "ephy-embed-find.h"
25 void
26 ephy_embed_find_set_embed (EphyEmbedFind *find,
27                            EphyEmbed *embed)
29         EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find);
30         iface->set_embed (find, embed);
33 /**
34  * ephy_embed_find_set_properties:
35  * @find: an #EphyEmbedFind
36  * @case_sensitive: %TRUE for "case sensitive" to be set
37  *
38  * Sets the properties of @find
39  **/
40 void
41 ephy_embed_find_set_properties (EphyEmbedFind *find,
42                                 const char *search_string,
43                                 gboolean case_sensitive)
45         EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find);
46         iface->set_properties (find, search_string, case_sensitive);
49 /**
50  * ephy_embed_find_find:
51  * @embed: an #EphyEmbedFind
52  * @search_string: the text to search for
53  * @links_only: whether to only search the text in links
54  *
55  * Return value: whether a match was found
56  **/
57 EphyEmbedFindResult
58 ephy_embed_find_find (EphyEmbedFind *find,
59                       const char *search_string,
60                       gboolean links_only)
62         EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find);
63         return iface->find (find, search_string, links_only);
66 /**
67  * ephy_embed_find_find_again:
68  * @embed: an #EphyEmbedFind
69  * @forward %TRUE to search forwards in the document
70  * @links_only: whether to only search the text in links
71  *
72  * Return value: whether a match was found
73  **/
74 EphyEmbedFindResult
75 ephy_embed_find_find_again (EphyEmbedFind *find,
76                             gboolean forward,
77                             gboolean links_only)
79         EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find);
80         return iface->find_again (find, forward, links_only);
83 void
84 ephy_embed_find_set_selection (EphyEmbedFind *find,
85                                gboolean attention)
87         EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find);
88         iface->set_selection (find, attention);
91 /**
92  * ephy_embed_find_activate_link:
93  * @embed: an #EphyEmbedFind
94  * @mask:
95  * 
96  * Activates the currently focused link, if there is any.
97  * 
98  * Return value: %TRUE if a link was activated
99  **/
100 gboolean
101 ephy_embed_find_activate_link (EphyEmbedFind *find,
102                                GdkModifierType mask)
104         EphyEmbedFindIface *iface = EPHY_EMBED_FIND_GET_IFACE (find);
105         return iface->activate_link (find, mask);
108 GType
109 ephy_embed_find_get_type (void)
111         static GType type = 0;
113         if (G_UNLIKELY (type == 0))
114         {
115                 const GTypeInfo our_info =
116                 {
117                         sizeof (EphyEmbedFindIface),
118                         NULL,
119                         NULL,
120                 };
122                 type = g_type_register_static (G_TYPE_INTERFACE,
123                                                "EphyEmbedFind",
124                                                &our_info, (GTypeFlags) 0);
125         }
127         return type;