diff options
author | Yetizone <andreii.lisita@gmail.com> | 2020-08-10 03:39:04 +0300 |
---|---|---|
committer | Yetizone <andreii.lisita@gmail.com> | 2020-08-10 04:12:56 +0300 |
commit | a2b5a96a4decb073c4d4752127c1ddef3cad9639 (patch) | |
tree | ce835470ad279f78bb16d7bd7e9bd18c5d7c58bf | |
parent | 1a6a365573d5cbe60e81a434eb8af6deef7905bd (diff) | |
download | epiphany-a2b5a96a4decb073c4d4752127c1ddef3cad9639.tar.gz |
Remove unused EphyDataDialog
-rw-r--r-- | src/meson.build | 1 | ||||
-rw-r--r-- | src/preferences/ephy-data-dialog.c | 723 | ||||
-rw-r--r-- | src/preferences/ephy-data-dialog.h | 68 | ||||
-rw-r--r-- | src/resources/epiphany.gresource.xml | 1 | ||||
-rw-r--r-- | src/resources/gtk/data-dialog.ui | 382 |
5 files changed, 0 insertions, 1175 deletions
diff --git a/src/meson.build b/src/meson.build index 3dca82f25..c25d88eff 100644 --- a/src/meson.build +++ b/src/meson.build @@ -45,7 +45,6 @@ libephymain_sources = [ 'ephy-window.c', 'popup-commands.c', 'preferences/clear-data-view.c', - 'preferences/ephy-data-dialog.c', 'preferences/ephy-data-view.c', 'preferences/ephy-prefs-dialog.c', 'preferences/ephy-search-engine-dialog.c', diff --git a/src/preferences/ephy-data-dialog.c b/src/preferences/ephy-data-dialog.c deleted file mode 100644 index 581af8d03..000000000 --- a/src/preferences/ephy-data-dialog.c +++ /dev/null @@ -1,723 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * Copyright © 2019 Purism SPC - * - * This file is part of Epiphany. - * - * Epiphany 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 3 of the License, or - * (at your option) any later version. - * - * Epiphany 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 Epiphany. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "config.h" -#include "ephy-data-dialog.h" - -#include <ctype.h> -#include <glib/gi18n.h> - -typedef struct { - GtkWidget *box; - GtkWidget *header_bars_stack; - GtkWidget *window_header_bar; - GtkWidget *selection_header_bar; - GtkWidget *child; - GtkWidget *clear_all_button; - GtkWidget *search_bar; - GtkWidget *search_entry; - GtkWidget *search_button; - GtkWidget *data_presentation_stack; - GtkWidget *empty_title_label; - GtkWidget *empty_description_label; - GtkWidget *spinner; - GtkWidget *action_bars_stack; - GtkWidget *regular_action_bar; - GtkWidget *selection_action_bar; - GtkWidget *selection_actions_box; - GtkWidget *selection_delete_button; - - gboolean is_loading : 1; - gboolean has_data : 1; - gboolean has_search_results : 1; - gboolean can_clear : 1; - gboolean selection_active : 1; - char *search_text; -} EphyDataDialogPrivate; - -G_DEFINE_TYPE_WITH_PRIVATE (EphyDataDialog, ephy_data_dialog, HDY_TYPE_WINDOW) - -enum { - PROP_0, - PROP_CLEAR_ALL_ACTION_NAME, - PROP_CLEAR_ALL_ACTION_TARGET, - PROP_CLEAR_ALL_DESCRIPTION, - PROP_SEARCH_DESCRIPTION, - PROP_EMPTY_TITLE, - PROP_EMPTY_DESCRIPTION, - PROP_SEARCH_TEXT, - PROP_IS_LOADING, - PROP_HAS_DATA, - PROP_HAS_SEARCH_RESULTS, - PROP_CAN_CLEAR, - PROP_SELECTION_ACTIVE, - LAST_PROP, -}; - -static GParamSpec *obj_properties[LAST_PROP]; - -enum { - CLEAR_ALL_CLICKED, - SELECTION_DELETE_CLICKED, - LAST_SIGNAL, -}; - -static gint signals[LAST_SIGNAL] = { 0 }; - -static void -update (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - GtkStack *data_stack = GTK_STACK (priv->data_presentation_stack); - GtkStack *header_bars_stack = GTK_STACK (priv->header_bars_stack); - GtkStack *action_bars_stack = GTK_STACK (priv->action_bars_stack); - gboolean has_data = priv->has_data && priv->child && gtk_widget_get_visible (priv->child); - - if (priv->is_loading) { - gtk_stack_set_visible_child_name (data_stack, "loading"); - gtk_spinner_start (GTK_SPINNER (priv->spinner)); - } else { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_button))) { - if (has_data && priv->has_search_results) - gtk_stack_set_visible_child (data_stack, priv->child); - else - gtk_stack_set_visible_child_name (data_stack, "no-results"); - } else { - if (has_data) - gtk_stack_set_visible_child (data_stack, priv->child); - else - gtk_stack_set_visible_child_name (data_stack, "empty"); - } - gtk_spinner_stop (GTK_SPINNER (priv->spinner)); - } - - if (priv->selection_active) { - gtk_stack_set_visible_child (header_bars_stack, priv->selection_header_bar); - gtk_stack_set_visible_child (action_bars_stack, priv->selection_action_bar); - } else { - gtk_stack_set_visible_child (header_bars_stack, priv->window_header_bar); - gtk_stack_set_visible_child (action_bars_stack, priv->regular_action_bar); - } - - gtk_widget_set_sensitive (priv->clear_all_button, has_data && priv->can_clear); - gtk_widget_set_sensitive (priv->search_button, has_data); -} - -static void -on_clear_all_button_clicked (EphyDataDialog *self) -{ - g_signal_emit (self, signals[CLEAR_ALL_CLICKED], 0); -} - -static void -on_selection_button_clicked (GtkButton *button, - EphyDataDialog *self) -{ - ephy_data_dialog_set_selection_active (self, TRUE); -} - -static void -on_selection_cancel_button_clicked (GtkButton *button, - EphyDataDialog *self) -{ - ephy_data_dialog_set_selection_active (self, FALSE); -} - -static void -on_selection_delete_button_clicked (GtkButton *button, - EphyDataDialog *self) -{ - g_signal_emit (self, signals[SELECTION_DELETE_CLICKED], 0); - ephy_data_dialog_set_selection_active (self, FALSE); -} - -static void -on_search_entry_changed (GtkSearchEntry *entry, - EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - const char *text; - - text = gtk_entry_get_text (GTK_ENTRY (entry)); - g_free (priv->search_text); - priv->search_text = g_strdup (text); - - g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_SEARCH_TEXT]); -} - -static gboolean -on_key_press_event (EphyDataDialog *self, - GdkEvent *event, - gpointer user_data) -{ - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - GdkEventKey *key = (GdkEventKey *)event; - gint result; - - result = hdy_search_bar_handle_event (HDY_SEARCH_BAR (priv->search_bar), event); - - if (result == GDK_EVENT_STOP) - return result; - - if (key->keyval == GDK_KEY_Escape) { - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_button))) - gtk_widget_destroy (GTK_WIDGET (self)); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search_button), FALSE); - } else if (isprint (key->keyval)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search_button), TRUE); - - return result; -} - -static void -ephy_data_dialog_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EphyDataDialog *self = EPHY_DATA_DIALOG (object); - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - - switch (prop_id) { - case PROP_CLEAR_ALL_ACTION_NAME: - gtk_actionable_set_action_name (GTK_ACTIONABLE (priv->clear_all_button), g_value_get_string (value)); - break; - case PROP_CLEAR_ALL_ACTION_TARGET: - gtk_actionable_set_action_target_value (GTK_ACTIONABLE (priv->clear_all_button), g_value_get_variant (value)); - break; - case PROP_CLEAR_ALL_DESCRIPTION: - ephy_data_dialog_set_clear_all_description (self, g_value_get_string (value)); - break; - case PROP_SEARCH_DESCRIPTION: - gtk_entry_set_placeholder_text (GTK_ENTRY (priv->search_entry), g_value_get_string (value)); - atk_object_set_description (gtk_widget_get_accessible (GTK_WIDGET (self)), g_value_get_string (value)); - break; - case PROP_EMPTY_TITLE: - gtk_label_set_text (GTK_LABEL (priv->empty_title_label), g_value_get_string (value)); - break; - case PROP_EMPTY_DESCRIPTION: - gtk_label_set_text (GTK_LABEL (priv->empty_description_label), g_value_get_string (value)); - break; - case PROP_IS_LOADING: - ephy_data_dialog_set_is_loading (self, g_value_get_boolean (value)); - break; - case PROP_HAS_DATA: - ephy_data_dialog_set_has_data (self, g_value_get_boolean (value)); - break; - case PROP_HAS_SEARCH_RESULTS: - ephy_data_dialog_set_has_search_results (self, g_value_get_boolean (value)); - break; - case PROP_CAN_CLEAR: - ephy_data_dialog_set_can_clear (self, g_value_get_boolean (value)); - break; - case PROP_SELECTION_ACTIVE: - ephy_data_dialog_set_selection_active (self, g_value_get_boolean (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -ephy_data_dialog_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EphyDataDialog *self = EPHY_DATA_DIALOG (object); - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - - switch (prop_id) { - case PROP_CLEAR_ALL_ACTION_NAME: - g_value_set_string (value, gtk_actionable_get_action_name (GTK_ACTIONABLE (priv->clear_all_button))); - break; - case PROP_CLEAR_ALL_ACTION_TARGET: - g_value_set_variant (value, gtk_actionable_get_action_target_value (GTK_ACTIONABLE (priv->clear_all_button))); - break; - case PROP_CLEAR_ALL_DESCRIPTION: - g_value_set_string (value, ephy_data_dialog_get_clear_all_description (self)); - break; - case PROP_SEARCH_DESCRIPTION: - g_value_set_string (value, gtk_entry_get_placeholder_text (GTK_ENTRY (priv->search_entry))); - break; - case PROP_EMPTY_TITLE: - g_value_set_string (value, gtk_label_get_text (GTK_LABEL (priv->empty_title_label))); - break; - case PROP_EMPTY_DESCRIPTION: - g_value_set_string (value, gtk_label_get_text (GTK_LABEL (priv->empty_description_label))); - break; - case PROP_SEARCH_TEXT: - g_value_set_string (value, ephy_data_dialog_get_search_text (self)); - break; - case PROP_IS_LOADING: - g_value_set_boolean (value, ephy_data_dialog_get_is_loading (self)); - break; - case PROP_HAS_DATA: - g_value_set_boolean (value, ephy_data_dialog_get_has_data (self)); - break; - case PROP_HAS_SEARCH_RESULTS: - g_value_set_boolean (value, ephy_data_dialog_get_has_search_results (self)); - break; - case PROP_CAN_CLEAR: - g_value_set_boolean (value, ephy_data_dialog_get_can_clear (self)); - break; - case PROP_SELECTION_ACTIVE: - g_value_set_boolean (value, ephy_data_dialog_get_selection_active (self)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -ephy_data_dialog_finalize (GObject *object) -{ - EphyDataDialog *self = EPHY_DATA_DIALOG (object); - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - - g_free (priv->search_text); - - G_OBJECT_CLASS (ephy_data_dialog_parent_class)->finalize (object); -} - -static void -ephy_data_dialog_add (GtkContainer *container, - GtkWidget *child) -{ - EphyDataDialog *self = EPHY_DATA_DIALOG (container); - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - GtkStack *data_stack = GTK_STACK (priv->data_presentation_stack); - - if (!priv->box) { - GTK_CONTAINER_CLASS (ephy_data_dialog_parent_class)->add (container, child); - return; - } - - g_assert (!priv->child); - - priv->child = child; - gtk_container_add (GTK_CONTAINER (data_stack), child); - - update (self); -} - -static void -ephy_data_dialog_class_init (EphyDataDialogClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - - object_class->set_property = ephy_data_dialog_set_property; - object_class->get_property = ephy_data_dialog_get_property; - object_class->finalize = ephy_data_dialog_finalize; - - container_class->add = ephy_data_dialog_add; - - obj_properties[PROP_CLEAR_ALL_ACTION_NAME] = - g_param_spec_string ("clear-all-action-name", - "'Clear all' action name", - "The name of the action associated to the 'Clear all' button", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_CLEAR_ALL_ACTION_TARGET] = - g_param_spec_variant ("clear-all-action-target", - "'Clear all' action target value", - "The parameter for 'Clear all' action invocations", - G_VARIANT_TYPE_ANY, NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_CLEAR_ALL_DESCRIPTION] = - g_param_spec_string ("clear-all-description", - "'Clear all' description", - "The description of the 'Clear all' action", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_SEARCH_DESCRIPTION] = - g_param_spec_string ("search-description", - "'Search' description", - "The description of the 'Search' action", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_EMPTY_TITLE] = - g_param_spec_string ("empty-title", - "'Empty' title", - "The title of the 'Empty' state page", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_EMPTY_DESCRIPTION] = - g_param_spec_string ("empty-description", - "'Empty' description", - "The description of the 'Empty' state page", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_SEARCH_TEXT] = - g_param_spec_string ("search-text", - "Search text", - "The text of the search entry", - NULL, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_IS_LOADING] = - g_param_spec_boolean ("is-loading", - "Is loading", - "Whether the dialog is loading its data", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_HAS_DATA] = - g_param_spec_boolean ("has-data", - "Has data", - "Whether the dialog has data", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_HAS_SEARCH_RESULTS] = - g_param_spec_boolean ("has-search-results", - "Has search results", - "Whether the dialog has search results", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_CAN_CLEAR] = - g_param_spec_boolean ("can-clear", - "Can clear", - "Whether the data can be cleared", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - obj_properties[PROP_SELECTION_ACTIVE] = - g_param_spec_boolean ("selection-active", - "Selection active", - "Is selection active?", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - g_object_class_install_properties (object_class, LAST_PROP, obj_properties); - - signals[SELECTION_DELETE_CLICKED] = - g_signal_new ("selection-delete-clicked", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, - 0, - G_TYPE_NONE); - - /** - * EphyLocationEntry::user-changed: - * @entry: the object on which the signal is emitted - * - * Emitted when the user changes the contents of the internal #GtkEntry - * - */ - signals[CLEAR_ALL_CLICKED] = - g_signal_new ("clear-all-clicked", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, - 0, - G_TYPE_NONE); - - gtk_widget_class_set_template_from_resource (widget_class, - "/org/gnome/epiphany/gtk/data-dialog.ui"); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, box); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, header_bars_stack); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, window_header_bar); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, selection_header_bar); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, clear_all_button); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, empty_title_label); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, empty_description_label); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, search_bar); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, search_button); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, search_entry); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, spinner); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, data_presentation_stack); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, action_bars_stack); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, regular_action_bar); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, selection_action_bar); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, selection_actions_box); - gtk_widget_class_bind_template_child_private (widget_class, EphyDataDialog, selection_delete_button); - - gtk_widget_class_bind_template_callback (widget_class, on_key_press_event); - gtk_widget_class_bind_template_callback (widget_class, on_clear_all_button_clicked); - gtk_widget_class_bind_template_callback (widget_class, on_selection_button_clicked); - gtk_widget_class_bind_template_callback (widget_class, on_selection_cancel_button_clicked); - gtk_widget_class_bind_template_callback (widget_class, on_selection_delete_button_clicked); - gtk_widget_class_bind_template_callback (widget_class, on_search_entry_changed); -} - -static void -ephy_data_dialog_init (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - - gtk_widget_init_template (GTK_WIDGET (self)); - - hdy_search_bar_connect_entry (HDY_SEARCH_BAR (priv->search_bar), GTK_ENTRY (priv->search_entry)); - - update (self); -} - -const gchar * -ephy_data_dialog_get_clear_all_description (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - return gtk_widget_get_tooltip_text (GTK_WIDGET (priv->clear_all_button)); -} - -void -ephy_data_dialog_set_clear_all_description (EphyDataDialog *self, - const gchar *description) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - if (g_strcmp0 (gtk_widget_get_tooltip_text (GTK_WIDGET (priv->clear_all_button)), description) == 0) - return; - - gtk_widget_set_tooltip_text (GTK_WIDGET (priv->clear_all_button), description); - - g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_CLEAR_ALL_DESCRIPTION]); -} - -gboolean -ephy_data_dialog_get_is_loading (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - return priv->is_loading; -} - -void -ephy_data_dialog_set_is_loading (EphyDataDialog *self, - gboolean is_loading) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - is_loading = !!is_loading; - - if (priv->is_loading == is_loading) - return; - - priv->is_loading = is_loading; - - update (self); - - g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_IS_LOADING]); -} - -gboolean -ephy_data_dialog_get_has_data (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - return priv->has_data; -} - -void -ephy_data_dialog_set_has_data (EphyDataDialog *self, - gboolean has_data) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - has_data = !!has_data; - - if (priv->has_data == has_data) - return; - - priv->has_data = has_data; - - update (self); - - g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_HAS_DATA]); -} - -gboolean -ephy_data_dialog_get_has_search_results (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - return priv->has_search_results; -} - -void -ephy_data_dialog_set_has_search_results (EphyDataDialog *self, - gboolean has_search_results) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - has_search_results = !!has_search_results; - - if (priv->has_search_results == has_search_results) - return; - - priv->has_search_results = has_search_results; - - update (self); - - g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_HAS_SEARCH_RESULTS]); -} - -gboolean -ephy_data_dialog_get_can_clear (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - return priv->can_clear; -} - -void -ephy_data_dialog_set_can_clear (EphyDataDialog *self, - gboolean can_clear) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - can_clear = !!can_clear; - - if (priv->can_clear == can_clear) - return; - - priv->can_clear = can_clear; - - update (self); - - g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_CAN_CLEAR]); -} - -gboolean -ephy_data_dialog_get_selection_active (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - return priv->selection_active; -} - -void -ephy_data_dialog_set_selection_active (EphyDataDialog *self, - gboolean selection_active) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - if (priv->selection_active == selection_active) - return; - - priv->selection_active = selection_active; - - update (self); - - g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_SELECTION_ACTIVE]); -} - -void -ephy_data_dialog_set_selection_actions_sensitive (EphyDataDialog *self, - gboolean actions_sensitive) -{ - EphyDataDialogPrivate *priv; - GtkContainer *selection_actions_box; - g_autoptr (GList) selection_actions_widgets = NULL; - GList *iter; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - selection_actions_box = GTK_CONTAINER (priv->selection_actions_box); - selection_actions_widgets = gtk_container_get_children (selection_actions_box); - - for (iter = selection_actions_widgets; iter != NULL; iter = g_list_next (iter)) { - GtkWidget *action_widget = iter->data; - - gtk_widget_set_sensitive (action_widget, actions_sensitive); - } -} - -void -ephy_data_dialog_add_selection_action (EphyDataDialog *self, - GtkWidget *action_widget) -{ - EphyDataDialogPrivate *priv = ephy_data_dialog_get_instance_private (self); - - gtk_container_add (GTK_CONTAINER (priv->selection_actions_box), action_widget); -} - -const gchar * -ephy_data_dialog_get_search_text (EphyDataDialog *self) -{ - EphyDataDialogPrivate *priv; - - g_assert (EPHY_IS_DATA_DIALOG (self)); - - priv = ephy_data_dialog_get_instance_private (self); - - return priv->search_text; -} diff --git a/src/preferences/ephy-data-dialog.h b/src/preferences/ephy-data-dialog.h deleted file mode 100644 index aafb351d2..000000000 --- a/src/preferences/ephy-data-dialog.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * Copyright © 2019 Purism SPC - * - * This file is part of Epiphany. - * - * Epiphany 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 3 of the License, or - * (at your option) any later version. - * - * Epiphany 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 Epiphany. If not, see <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include <handy.h> - -G_BEGIN_DECLS - -#define EPHY_TYPE_DATA_DIALOG (ephy_data_dialog_get_type ()) - -G_DECLARE_DERIVABLE_TYPE (EphyDataDialog, ephy_data_dialog, EPHY, DATA_DIALOG, HdyWindow) - -struct _EphyDataDialogClass -{ - HdyWindowClass parent_class; -}; - -const gchar *ephy_data_dialog_get_clear_all_description (EphyDataDialog *self); -void ephy_data_dialog_set_clear_all_description (EphyDataDialog *self, - const gchar *description); - -gboolean ephy_data_dialog_get_is_loading (EphyDataDialog *self); -void ephy_data_dialog_set_is_loading (EphyDataDialog *self, - gboolean is_loading); - -gboolean ephy_data_dialog_get_has_data (EphyDataDialog *self); -void ephy_data_dialog_set_has_data (EphyDataDialog *self, - gboolean has_data); - -gboolean ephy_data_dialog_get_has_search_results (EphyDataDialog *self); -void ephy_data_dialog_set_has_search_results (EphyDataDialog *self, - gboolean has_search_results); - -gboolean ephy_data_dialog_get_can_clear (EphyDataDialog *self); -void ephy_data_dialog_set_can_clear (EphyDataDialog *self, - gboolean can_clear); - -gboolean ephy_data_dialog_get_selection_active (EphyDataDialog *self); -void ephy_data_dialog_set_selection_active (EphyDataDialog *self, - gboolean selection_active); - -void ephy_data_dialog_set_selection_actions_sensitive (EphyDataDialog *self, - gboolean actions_sensitive); - -void ephy_data_dialog_add_selection_action (EphyDataDialog *self, - GtkWidget *action_bar_widget); - -const gchar *ephy_data_dialog_get_search_text (EphyDataDialog *self); - -G_END_DECLS diff --git a/src/resources/epiphany.gresource.xml b/src/resources/epiphany.gresource.xml index c9d040558..b297f3e34 100644 --- a/src/resources/epiphany.gresource.xml +++ b/src/resources/epiphany.gresource.xml @@ -19,7 +19,6 @@ <file preprocess="xml-stripblanks" compressed="true">gtk/bookmark-row.ui</file> <file preprocess="xml-stripblanks" compressed="true">gtk/bookmarks-popover.ui</file> <file preprocess="xml-stripblanks" compressed="true">gtk/clear-data-view.ui</file> - <file preprocess="xml-stripblanks" compressed="true">gtk/data-dialog.ui</file> <file preprocess="xml-stripblanks" compressed="true">gtk/data-view.ui</file> <file preprocess="xml-stripblanks" compressed="true">gtk/encoding-dialog.ui</file> <file preprocess="xml-stripblanks" compressed="true">gtk/encoding-row.ui</file> diff --git a/src/resources/gtk/data-dialog.ui b/src/resources/gtk/data-dialog.ui deleted file mode 100644 index 7503054df..000000000 --- a/src/resources/gtk/data-dialog.ui +++ /dev/null @@ -1,382 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> -<interface> - <requires lib="gtk+" version="3.20"/> - <requires lib="libhandy" version="0.0"/> - <object class="GtkImage" id="clear_all_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">user-trash-symbolic</property> - </object> - <template class="EphyDataDialog" parent="HdyWindow"> - <property name="can_focus">False</property> - <property name="modal">True</property> - <property name="window_position">center-on-parent</property> - <property name="default_width">1000</property> - <property name="default_height">600</property> - <property name="destroy_with_parent">True</property> - <property name="type_hint">dialog</property> - <signal name="key-press-event" handler="on_key_press_event" swapped="no"/> - <child> - <object class="GtkBox" id="box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkStack" id="header_bars_stack"> - <property name="visible">True</property> - <property name="transition-type">GTK_STACK_TRANSITION_TYPE_CROSSFADE</property> - <child> - <object class="HdyHeaderBar" id="window_header_bar"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="show_close_button">True</property> - <property name="title" bind-source="EphyDataDialog" bind-property="title"/> - <child> - <object class="GtkButton" id="selection_button"> - <property name="visible">True</property> - <property name="valign">center</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="on_selection_button_clicked"/> - <style> - <class name="image-button"/> - </style> - <child internal-child="accessible"> - <object class="AtkObject" id="a11y-button3"> - <property name="accessible-name" translatable="yes">Select Items</property> - </object> - </child> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="icon-name">object-select-symbolic</property> - <property name="icon-size">1</property> - </object> - </child> - </object> - <packing> - <property name="pack-type">end</property> - </packing> - </child> - <child> - <object class="GtkToggleButton" id="search_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="always_show_image">True</property> - <property name="active" bind-source="search_bar" bind-property="search-mode-enabled" bind-flags="sync-create|bidirectional"/> - <accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="clicked"/> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">edit-find-symbolic</property> - </object> - </child> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="AtkObject::accessible-name" translatable="yes">Search</property> - </object> - </child> - </object> - <packing> - <property name="pack_type">end</property> - </packing> - </child> - </object> - </child> - <child> - <object class="HdyHeaderBar" id="selection_header_bar"> - <property name="visible">True</property> - <property name="title" bind-source="EphyDataDialog" bind-property="title"/> - <style> - <class name="selection-mode"/> - </style> - <child> - <object class="GtkButton" id="selection_cancel_button"> - <property name="visible">True</property> - <property name="valign">center</property> - <property name="use-underline">True</property> - <property name="label" translatable="yes">_Cancel</property> - <signal name="clicked" handler="on_selection_cancel_button_clicked"/> - <style> - <class name="text-button"/> - </style> - </object> - <packing> - <property name="pack-type">end</property> - </packing> - </child> - <child> - <object class="GtkToggleButton" id="selection_search_button"> - <property name="visible">True</property> - <property name="active" bind-source="search_bar" bind-property="search-mode-enabled" bind-flags="sync-create|bidirectional"/> - <accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="clicked"/> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">edit-find-symbolic</property> - </object> - </child> - <child internal-child="accessible"> - <object class="AtkObject"> - <property name="AtkObject::accessible-name" translatable="yes">Search</property> - </object> - </child> - </object> - <packing> - <property name="pack_type">end</property> - </packing> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="HdySearchBar" id="search_bar"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="hexpand">True</property> - <property name="search_mode_enabled">False</property> - <child> - <object class="HdyClamp"> - <property name="visible">True</property> - <property name="hexpand">True</property> - <property name="maximum_size">400</property> - <property name="tightening_threshold">300</property> - <child> - <object class="GtkSearchEntry" id="search_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="primary_icon_name">edit-find-symbolic</property> - <property name="primary_icon_activatable">False</property> - <property name="primary_icon_sensitive">False</property> - <signal name="search-changed" handler="on_search_entry_changed" swapped="no"/> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - </packing> - </child> - <child> - <object class="GtkStack" id="data_presentation_stack"> - <property name="can_focus">False</property> - <property name="expand">True</property> - <property name="visible">True</property> - <child> - <object class="GtkSpinner" id="spinner"> - <property name="can_focus">False</property> - <property name="visible">True</property> - </object> - <packing> - <property name="name">loading</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow"> - <property name="can_focus">False</property> - <property name="expand">True</property> - <property name="hscrollbar_policy">never</property> - <property name="visible">True</property> - <child> - <object class="GtkBox"> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="orientation">vertical</property> - <property name="valign">center</property> - <property name="vexpand">True</property> - <property name="visible">True</property> - <child> - <object class="GtkImage"> - <property name="can_focus">False</property> - <property name="icon_name">web-browser-symbolic</property> - <property name="icon_size">0</property> - <property name="margin_bottom">18</property> - <property name="pixel_size">128</property> - <property name="valign">center</property> - <property name="visible">True</property> - <style> - <class name="dim-label"/> - </style> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="can_focus">False</property> - <property name="margin_end">12</property> - <property name="margin_start">12</property> - <property name="orientation">vertical</property> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="empty_title_label"> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="justify">center</property> - <property name="margin_bottom">12</property> - <property name="opacity">0.5</property> - <property name="visible">True</property> - <property name="wrap">True</property> - <attributes> - <attribute name="scale" value="2"/> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkLabel" id="empty_description_label"> - <property name="can_focus">False</property> - <property name="justify">center</property> - <property name="margin_bottom">6</property> - <property name="opacity">0.5</property> - <property name="use_markup">True</property> - <property name="visible">True</property> - <property name="wrap">True</property> - </object> - </child> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="name">empty</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow"> - <property name="can_focus">False</property> - <property name="expand">True</property> - <property name="hscrollbar_policy">never</property> - <property name="visible">True</property> - <child> - <object class="GtkBox"> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="orientation">vertical</property> - <property name="valign">center</property> - <property name="vexpand">True</property> - <property name="visible">True</property> - <child> - <object class="GtkImage"> - <property name="can_focus">False</property> - <property name="icon_name">edit-find-symbolic</property> - <property name="icon_size">0</property> - <property name="margin_bottom">18</property> - <property name="pixel_size">128</property> - <property name="valign">center</property> - <property name="visible">True</property> - <style> - <class name="dim-label"/> - </style> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="can_focus">False</property> - <property name="margin_end">12</property> - <property name="margin_start">12</property> - <property name="orientation">vertical</property> - <property name="visible">True</property> - <child> - <object class="GtkLabel"> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="justify">center</property> - <property name="label" translatable="yes">No Results Found</property> - <property name="margin_bottom">12</property> - <property name="opacity">0.5</property> - <property name="visible">True</property> - <property name="wrap">True</property> - <attributes> - <attribute name="scale" value="2"/> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkLabel"> - <property name="can_focus">False</property> - <property name="justify">center</property> - <property name="label" translatable="yes">Try a different search</property> - <property name="margin_bottom">6</property> - <property name="opacity">0.5</property> - <property name="use_markup">True</property> - <property name="visible">True</property> - <property name="wrap">True</property> - </object> - </child> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="name">no-results</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - </packing> - </child> - <child> - <object class="GtkStack" id="action_bars_stack"> - <property name="visible">True</property> - <property name="transition-type">GTK_STACK_TRANSITION_TYPE_CROSSFADE</property> - <child> - <object class="GtkActionBar" id="regular_action_bar"> - <property name="visible">True</property> - <child> - <object class="GtkButton" id="clear_all_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use-underline">True</property> - <property name="label" translatable="yes">_Clear All</property> - <signal name="clicked" handler="on_clear_all_button_clicked" swapped="yes"/> - <accelerator key="Delete" modifiers="GDK_SHIFT_MASK" signal="clicked"/> - <style> - <class name="destructive-action"/> - <class name="image-button"/> - </style> - </object> - </child> - </object> - </child> - <child> - <object class="GtkActionBar" id="selection_action_bar"> - <property name="visible">True</property> - <child> - <object class="GtkBox" id="selection_actions_box"> - <property name="visible">True</property> - <property name="spacing">5</property> - <child> - <object class="GtkButton" id="selection_delete_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="sensitive">False</property> - <property name="use_underline">True</property> - <property name="label" translatable="yes">_Delete</property> - <signal name="clicked" handler="on_selection_delete_button_clicked"/> - <style> - <class name="destructive-action"/> - </style> - </object> - </child> - </object> - </child> - </object> - </child> - </object> - </child> - </object> - </child> - </template> -</interface> |