[epiphany/wip/bookmarks: 313/315] Remove obsolete EphyBookmarks
- From: Iulian Radu <iulianradu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/bookmarks: 313/315] Remove obsolete EphyBookmarks
- Date: Tue, 27 Sep 2016 17:40:32 +0000 (UTC)
commit 8afbb4589159931d6e15959b1eb207ad732c1e20
Author: Iulian Radu <iulian radu67 gmail com>
Date: Tue Sep 27 19:27:03 2016 +0300
Remove obsolete EphyBookmarks
src/Makefile.am | 7 +-
src/bookmarks/Makefile.am | 101 --
src/bookmarks/ephy-bookmarks.c | 1578 -------------------------
src/bookmarks/ephy-bookmarks.h | 134 ---
src/ephy-location-controller.c | 194 +---
src/ephy-main.c | 2 +
src/ephy-shell.c | 17 -
src/ephy-shell.h | 3 -
src/ephy-window.c | 1 +
src/prefs-dialog.c | 40 -
src/resources/bookmark-properties.ui | 158 ---
src/resources/epiphany-bookmark-editor-ui.xml | 58 -
src/window-commands.c | 24 -
src/window-commands.h | 3 -
tests/ephy-bookmarks-test.c | 128 --
15 files changed, 5 insertions(+), 2443 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index dd99690..f617a2f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = bookmarks . search-provider profile-migrator
+SUBDIRS = . search-provider profile-migrator
pkglib_LTLIBRARIES = libephymain.la
@@ -81,7 +81,6 @@ libephymain_la_CPPFLAGS = \
-I$(top_srcdir)/lib/egg \
-I$(top_srcdir)/lib/history \
-I$(top_srcdir)/lib/widgets \
- -I$(top_srcdir)/src/bookmarks \
-I$(top_srcdir)/gvdb \
-DLOADER_DIR=\""$(pkglibdir)/$(EPIPHANY_MAJOR)/loaders"\" \
-DDATADIR=\""$(pkgdatadir)"\" \
@@ -104,7 +103,6 @@ libephymain_la_LDFLAGS = \
$(WARN_LDFLAGS) -avoid-version -no-undefined
libephymain_la_LIBADD = \
- $(top_builddir)/src/bookmarks/libephybookmarks.la \
$(top_builddir)/embed/libephyembed.la \
$(top_builddir)/lib/widgets/libephywidgets.la \
$(top_builddir)/lib/libephymisc.la \
@@ -122,7 +120,6 @@ libephymain_la_LIBADD = \
RESOURCE_FILES = \
resources/about.css \
- resources/bookmark-properties.ui \
resources/channel-insecure-symbolic.png \
resources/computer-fail-symbolic.png \
resources/clear-data-dialog.ui \
@@ -130,7 +127,6 @@ RESOURCE_FILES = \
resources/encoding-dialog.ui \
resources/encoding-row.ui \
resources/epiphany-application-menu.ui \
- resources/epiphany-bookmark-editor-ui.xml \
resources/epiphany.css \
resources/error.html \
resources/gtk/menus.ui \
@@ -180,7 +176,6 @@ epiphany_CPPFLAGS = \
-I$(top_srcdir)/lib/history \
-I$(top_srcdir)/lib/widgets \
-I$(top_builddir)/lib/widgets \
- -I$(top_srcdir)/src/bookmarks \
-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
-DLOCALEDIR=\"$(localedir)\" \
$(GLIB_CFLAGS) \
diff --git a/src/ephy-location-controller.c b/src/ephy-location-controller.c
index 8474033..44f5917 100644
--- a/src/ephy-location-controller.c
+++ b/src/ephy-location-controller.c
@@ -47,10 +47,7 @@ struct _EphyLocationController {
EphyWindow *window;
EphyTitleWidget *title_widget;
- GList *actions;
char *address;
- EphyNode *smart_bmks;
- EphyBookmarks *bookmarks;
guint editable : 1;
gboolean sync_address_is_blocked;
};
@@ -87,38 +84,6 @@ match_func (GtkEntryCompletion *completion,
}
static void
-action_activated_cb (GtkEntryCompletion *completion,
- gint index,
- EphyLocationController *controller)
-{
- GtkWidget *entry;
- char *content;
-
- entry = gtk_entry_completion_get_entry (completion);
- content = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
- if (content) {
- EphyNode *node;
- const char *smart_url;
- char *url;
-
- node = (EphyNode *)g_list_nth_data (controller->actions, index);
- smart_url = ephy_node_get_property_string
- (node, EPHY_NODE_BMK_PROP_LOCATION);
- g_return_if_fail (smart_url != NULL);
-
- url = ephy_bookmarks_resolve_address
- (controller->bookmarks, smart_url, content);
- g_free (content);
- if (url == NULL) return;
-
- ephy_link_open (EPHY_LINK (controller), url, NULL,
- ephy_link_flags_from_current_event () | EPHY_LINK_TYPED);
-
- g_free (url);
- }
-}
-
-static void
entry_drag_data_received_cb (GtkWidget *widget,
GdkDragContext *context,
gint x, gint y,
@@ -171,7 +136,6 @@ static void
entry_activate_cb (GtkEntry *entry,
EphyLocationController *controller)
{
- EphyBookmarks *bookmarks;
const char *content;
char *address;
char *effective_address;
@@ -184,11 +148,7 @@ entry_activate_cb (GtkEntry *entry,
content = gtk_entry_get_text (entry);
if (content == NULL || content[0] == '\0') return;
- bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
-
- address = ephy_bookmarks_resolve_address (bookmarks, content, NULL);
- g_return_if_fail (address != NULL);
-
+ address = g_strdup (content);
effective_address = ephy_embed_utils_normalize_or_autosearch_address (g_strstrip (address));
g_free (address);
#if 0
@@ -280,47 +240,6 @@ get_title_cb (EphyLocationEntry *entry,
return g_strdup (ephy_embed_get_title (embed));
}
-static void
-remove_completion_actions (EphyLocationController *controller,
- EphyLocationEntry *lentry)
-{
- GtkEntryCompletion *completion;
- GList *l;
-
- completion = gtk_entry_get_completion (GTK_ENTRY (lentry));
-
- for (l = controller->actions; l != NULL; l = l->next) {
- gtk_entry_completion_delete_action (completion, 0);
- }
-
- g_signal_handlers_disconnect_by_func
- (completion, G_CALLBACK (action_activated_cb), controller);
-}
-
-static void
-add_completion_actions (EphyLocationController *controller,
- EphyLocationEntry *lentry)
-{
- GtkEntryCompletion *completion;
- GList *l;
-
- completion = gtk_entry_get_completion (GTK_ENTRY (lentry));
-
- for (l = controller->actions; l != NULL; l = l->next) {
- EphyNode *bmk = l->data;
- const char *title;
- int index;
-
- index = g_list_position (controller->actions, l);
- title = ephy_node_get_property_string
- (bmk, EPHY_NODE_BMK_PROP_TITLE);
- gtk_entry_completion_insert_action_text (completion, index, (char *)title);
- }
-
- g_signal_connect (completion, "action_activated",
- G_CALLBACK (action_activated_cb), controller);
-}
-
static gboolean
focus_in_event_cb (GtkWidget *entry,
GdkEventFocus *event,
@@ -402,8 +321,6 @@ ephy_location_controller_constructed (GObject *object)
controller->title_widget,
NULL);
- add_completion_actions (controller, EPHY_LOCATION_ENTRY (controller->title_widget));
-
g_object_bind_property (controller, "editable",
controller->title_widget, "editable",
G_BINDING_SYNC_CREATE);
@@ -560,120 +477,12 @@ ephy_location_controller_class_init (EphyLocationControllerClass *class)
g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
}
-static int
-compare_actions (gconstpointer a,
- gconstpointer b)
-{
- EphyNode *node_a = (EphyNode *)a;
- EphyNode *node_b = (EphyNode *)b;
- const char *title1, *title2;
- int retval;
-
- title1 = ephy_node_get_property_string (node_a, EPHY_NODE_BMK_PROP_TITLE);
- title2 = ephy_node_get_property_string (node_b, EPHY_NODE_BMK_PROP_TITLE);
-
- if (title1 == NULL) {
- retval = -1;
- } else if (title2 == NULL) {
- retval = 1;
- } else {
- char *str_a, *str_b;
-
- str_a = g_utf8_casefold (title1, -1);
- str_b = g_utf8_casefold (title2, -1);
- retval = g_utf8_collate (str_a, str_b);
- g_free (str_a);
- g_free (str_b);
- }
-
- return retval;
-}
-
-static void
-init_actions_list (EphyLocationController *controller)
-{
- GPtrArray *children;
- guint i;
-
- children = ephy_node_get_children (controller->smart_bmks);
- for (i = 0; i < children->len; i++) {
- EphyNode *kid;
-
- kid = g_ptr_array_index (children, i);
-
- controller->actions = g_list_prepend
- (controller->actions, kid);
- }
-
- controller->actions =
- g_list_sort (controller->actions, (GCompareFunc)compare_actions);
-}
-
-static void
-update_actions_list (EphyLocationController *controller)
-{
- if (!EPHY_IS_LOCATION_ENTRY (controller->title_widget))
- return;
-
- remove_completion_actions (controller, EPHY_LOCATION_ENTRY (controller->title_widget));
-
- g_list_free (controller->actions);
- controller->actions = NULL;
- init_actions_list (controller);
-
- add_completion_actions (controller, EPHY_LOCATION_ENTRY (controller->title_widget));
-}
-
-static void
-actions_child_removed_cb (EphyNode *node,
- EphyNode *child,
- guint old_index,
- EphyLocationController *controller)
-{
- update_actions_list (controller);
-}
-
-static void
-actions_child_added_cb (EphyNode *node,
- EphyNode *child,
- EphyLocationController *controller)
-{
- update_actions_list (controller);
-}
-
-static void
-actions_child_changed_cb (EphyNode *node,
- EphyNode *child,
- guint property_id,
- EphyLocationController *controller)
-{
- update_actions_list (controller);
-}
-
static void
ephy_location_controller_init (EphyLocationController *controller)
{
controller->address = g_strdup ("");
controller->editable = TRUE;
- controller->bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
- controller->smart_bmks = ephy_bookmarks_get_smart_bookmarks
- (controller->bookmarks);
controller->sync_address_is_blocked = FALSE;
-
- init_actions_list (controller);
-
- ephy_node_signal_connect_object (controller->smart_bmks,
- EPHY_NODE_CHILD_ADDED,
- (EphyNodeCallback)actions_child_added_cb,
- G_OBJECT (controller));
- ephy_node_signal_connect_object (controller->smart_bmks,
- EPHY_NODE_CHILD_REMOVED,
- (EphyNodeCallback)actions_child_removed_cb,
- G_OBJECT (controller));
- ephy_node_signal_connect_object (controller->smart_bmks,
- EPHY_NODE_CHILD_CHANGED,
- (EphyNodeCallback)actions_child_changed_cb,
- G_OBJECT (controller));
}
static void
@@ -681,7 +490,6 @@ ephy_location_controller_finalize (GObject *object)
{
EphyLocationController *controller = EPHY_LOCATION_CONTROLLER (object);
- g_list_free (controller->actions);
g_free (controller->address);
G_OBJECT_CLASS (ephy_location_controller_parent_class)->finalize (object);
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 1ddaf78..667064d 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -35,8 +35,10 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libnotify/notify.h>
+#include <libxml/xmlreader.h>
#include <libxml/xmlversion.h>
#include <string.h>
+#include <stdlib.h>
static gboolean open_in_new_tab = FALSE;
static gboolean open_in_new_window = FALSE;
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 161bbd3..3d7d590 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -52,7 +52,6 @@ struct _EphyShell {
EphySession *session;
GList *windows;
GObject *lockdown;
- EphyBookmarks *bookmarks;
EphyBookmarksManager *bookmarks_manager;
GNetworkMonitor *network_monitor;
GtkWidget *history_window;
@@ -582,7 +581,6 @@ ephy_shell_dispose (GObject *object)
g_clear_object (&shell->lockdown);
g_clear_pointer (&shell->history_window, gtk_widget_destroy);
g_clear_object (&shell->prefs_dialog);
- g_clear_object (&shell->bookmarks);
g_clear_object (&shell->network_monitor);
g_slist_free_full (shell->open_uris_idle_ids, remove_open_uris_idle_cb);
@@ -730,21 +728,6 @@ ephy_shell_get_session (EphyShell *shell)
}
/**
- * ephy_shell_get_bookmarks:
- *
- * Return value: (transfer none):
- **/
-EphyBookmarks *
-ephy_shell_get_bookmarks (EphyShell *shell)
-{
- if (shell->bookmarks == NULL) {
- shell->bookmarks = ephy_bookmarks_new ();
- }
-
- return shell->bookmarks;
-}
-
-/**
* ephy_shell_get_bookmarks_manager:
* @shell: the #EphyShell
*
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 25f0117..97c6206 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -20,7 +20,6 @@
#pragma once
-#include "ephy-bookmarks.h"
#include "ephy-bookmarks-manager.h"
#include "ephy-embed-shell.h"
#include "ephy-embed.h"
@@ -98,8 +97,6 @@ EphySession *ephy_shell_get_session (EphyShell *shell);
GNetworkMonitor *ephy_shell_get_net_monitor (EphyShell *shell);
-EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *shell);
-
GtkWidget *ephy_shell_get_bookmarks_editor (EphyShell *shell);
EphyBookmarksManager *ephy_shell_get_bookmarks_manager (EphyShell *shell);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index c27602b..c06b9e0 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -58,6 +58,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libsoup/soup.h>
+#include <stdlib.h>
#include <webkit2/webkit2.h>
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 0c73f26..0d8b23a 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -21,7 +21,6 @@
#include "config.h"
#include "prefs-dialog.h"
-#include "ephy-bookmarks.h"
#include "ephy-debug.h"
#include "ephy-embed-container.h"
#include "ephy-embed-prefs.h"
@@ -931,44 +930,6 @@ search_engine_combo_add_default_engines (GtkListStore *store)
}
}
-static void
-search_engine_combo_add_smart_bookmarks (GtkListStore *store)
-{
- guint i;
- EphyBookmarks *bookmarks;
- EphyNode *smart_bookmarks_parent_node;
- GPtrArray *smart_bookmarks;
-
- bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
- smart_bookmarks_parent_node = ephy_bookmarks_get_smart_bookmarks (bookmarks);
- smart_bookmarks = ephy_node_get_children (smart_bookmarks_parent_node);
-
- if (!smart_bookmarks)
- return;
-
- for (i = 0; i < smart_bookmarks->len; ++i) {
- EphyNode *bookmark;
- const char *bookmark_name;
- const char *bookmark_url;
-
- bookmark = g_ptr_array_index (smart_bookmarks, i);
- bookmark_name = ephy_node_get_property_string (bookmark, EPHY_NODE_BMK_PROP_TITLE);
- bookmark_url = ephy_node_get_property_string (bookmark, EPHY_NODE_BMK_PROP_LOCATION);
-
- if (!bookmark_name || !bookmark_url)
- continue;
-
- if (strcmp (bookmark_name, DEFAULT_SMART_BOOKMARK_TEXT) == 0)
- continue;
-
- gtk_list_store_insert_with_values (store, NULL, -1,
- SEARCH_ENGINE_COL_NAME, bookmark_name,
- SEARCH_ENGINE_COL_STOCK_URL, bookmark_url,
- SEARCH_ENGINE_COL_URL, bookmark_url,
- -1);
- }
-}
-
/* Has the user manually set the engine to something not in the combo?
* If so, add that URL as an extra item in the combo. */
static void
@@ -1021,7 +982,6 @@ create_search_engine_combo (GtkComboBox *combo)
store = GTK_LIST_STORE (gtk_combo_box_get_model (combo));
search_engine_combo_add_default_engines (store);
- search_engine_combo_add_smart_bookmarks (store);
search_engine_combo_add_current_engine (store);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), SEARCH_ENGINE_COL_NAME,
diff --git a/src/window-commands.c b/src/window-commands.c
index b199e8a..f4d98b8 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1697,30 +1697,6 @@ window_cmd_go_location (GSimpleAction *action,
}
void
-window_cmd_load_location (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- const char *location;
-
- location = ephy_window_get_location (EPHY_WINDOW (user_data));
-
- if (location) {
- EphyBookmarks *bookmarks;
- char *address;
-
- bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
-
- address = ephy_bookmarks_resolve_address (bookmarks, location, NULL);
- g_return_if_fail (address != NULL);
-
- ephy_link_open (EPHY_LINK (user_data), address,
- ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (user_data)),
- ephy_link_flags_from_current_event ());
- }
-}
-
-void
window_cmd_go_home (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
diff --git a/src/window-commands.h b/src/window-commands.h
index 0ad03a7..73b1c06 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -144,9 +144,6 @@ void window_cmd_go_location (GSimpleAction *action,
void window_cmd_go_home (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
-void window_cmd_load_location (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data);
void window_cmd_change_browse_with_caret_state (GSimpleAction *action,
GVariant *state,
gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]