1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  *  Copyright © 2017 Cedric Le Moigne <cedlemo@gmx.com>
4  *
5  *  This file is part of Epiphany.
6  *
7  *  Epiphany is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  Epiphany is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with Epiphany.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #pragma once
22 
23 #include <gio/gio.h>
24 #include <glib-object.h>
25 #include <glib/gi18n.h>
26 
27 G_BEGIN_DECLS
28 
29 /* TRANSLATORS: Please modify the main address of duckduckgo in order to match
30  * the version used in your country. For example for the french version :
31  * replace the ".com" with ".fr" :  "https://duckduckgo.fr/?q=%s&amp;t=epiphany"
32 */
33 #define EPHY_SEARCH_ENGINE_DEFAULT_ADDRESS _("https://duckduckgo.com/?q=%s&amp;t=epiphany")
34 
35 #define EPHY_TYPE_SEARCH_ENGINE_MANAGER (ephy_search_engine_manager_get_type ())
36 
37 G_DECLARE_FINAL_TYPE (EphySearchEngineManager, ephy_search_engine_manager, EPHY, SEARCH_ENGINE_MANAGER, GObject)
38 
39 EphySearchEngineManager     *ephy_search_engine_manager_new                      (void);
40 const char                  *ephy_search_engine_manager_get_address              (EphySearchEngineManager *manager,
41                                                                                   const char              *name);
42 const char                  *ephy_search_engine_manager_get_default_search_address
43                                                                                  (EphySearchEngineManager *manager);
44 const char                  *ephy_search_engine_manager_get_bang                 (EphySearchEngineManager *manager,
45                                                                                   const char              *name);
46 char                        *ephy_search_engine_manager_get_default_engine       (EphySearchEngineManager *manager);
47 gboolean                     ephy_search_engine_manager_set_default_engine       (EphySearchEngineManager *manager,
48                                                                                   const char              *name);
49 char                       **ephy_search_engine_manager_get_names                (EphySearchEngineManager *manager);
50 gboolean                     ephy_search_engine_manager_engine_exists            (EphySearchEngineManager *manager,
51                                                                                   const char              *name);
52 char                       **ephy_search_engine_manager_get_bangs                (EphySearchEngineManager *manager);
53 void                         ephy_search_engine_manager_add_engine               (EphySearchEngineManager *manager,
54                                                                                   const char              *name,
55                                                                                   const char              *address,
56                                                                                   const char              *bang);
57 void                         ephy_search_engine_manager_delete_engine            (EphySearchEngineManager *manager,
58                                                                                   const char              *name);
59 gboolean                     ephy_search_engine_manager_rename                   (EphySearchEngineManager *manager,
60                                                                                   const char              *old_name,
61                                                                                   const char              *new_name);
62 void                         ephy_search_engine_manager_modify_engine            (EphySearchEngineManager *manager,
63                                                                                   const char              *name,
64                                                                                   const char              *address,
65                                                                                   const char              *bang);
66 const char                  *ephy_search_engine_manager_engine_from_bang         (EphySearchEngineManager *manager,
67                                                                                   const char              *bang);
68 char                        *ephy_search_engine_manager_build_search_address     (EphySearchEngineManager *manager,
69                                                                                   const char              *name,
70                                                                                   const char              *search);
71 char                        *ephy_search_engine_manager_parse_bang_search        (EphySearchEngineManager *manager,
72                                                                                   const char              *search);
73 
74 G_END_DECLS
75