I#1916 - Allow to search in "Describe Filters"
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1916
This commit is contained in:
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
struct _ESearchBarPrivate {
|
struct _ESearchBarPrivate {
|
||||||
EWebView *web_view;
|
EWebView *web_view;
|
||||||
|
GtkWidget *hide_button;
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
GtkWidget *case_sensitive_button;
|
GtkWidget *case_sensitive_button;
|
||||||
GtkWidget *wrapped_next_box;
|
GtkWidget *wrapped_next_box;
|
||||||
@ -47,12 +48,14 @@ struct _ESearchBarPrivate {
|
|||||||
gchar *active_search;
|
gchar *active_search;
|
||||||
|
|
||||||
gboolean search_forward;
|
gboolean search_forward;
|
||||||
|
gboolean can_hide;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_ACTIVE_SEARCH,
|
PROP_ACTIVE_SEARCH,
|
||||||
PROP_CASE_SENSITIVE,
|
PROP_CASE_SENSITIVE,
|
||||||
|
PROP_CAN_HIDE,
|
||||||
PROP_TEXT,
|
PROP_TEXT,
|
||||||
PROP_WEB_VIEW
|
PROP_WEB_VIEW
|
||||||
};
|
};
|
||||||
@ -307,6 +310,12 @@ search_bar_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
|
case PROP_CAN_HIDE:
|
||||||
|
e_search_bar_set_can_hide (
|
||||||
|
E_SEARCH_BAR (object),
|
||||||
|
g_value_get_boolean (value));
|
||||||
|
return;
|
||||||
|
|
||||||
case PROP_CASE_SENSITIVE:
|
case PROP_CASE_SENSITIVE:
|
||||||
e_search_bar_set_case_sensitive (
|
e_search_bar_set_case_sensitive (
|
||||||
E_SEARCH_BAR (object),
|
E_SEARCH_BAR (object),
|
||||||
@ -342,6 +351,12 @@ search_bar_get_property (GObject *object,
|
|||||||
E_SEARCH_BAR (object)));
|
E_SEARCH_BAR (object)));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case PROP_CAN_HIDE:
|
||||||
|
g_value_set_boolean (
|
||||||
|
value, e_search_bar_get_can_hide (
|
||||||
|
E_SEARCH_BAR (object)));
|
||||||
|
return;
|
||||||
|
|
||||||
case PROP_CASE_SENSITIVE:
|
case PROP_CASE_SENSITIVE:
|
||||||
g_value_set_boolean (
|
g_value_set_boolean (
|
||||||
value, e_search_bar_get_case_sensitive (
|
value, e_search_bar_get_case_sensitive (
|
||||||
@ -378,6 +393,7 @@ search_bar_dispose (GObject *object)
|
|||||||
priv->web_view = NULL;
|
priv->web_view = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_clear_object (&priv->hide_button);
|
||||||
g_clear_object (&priv->entry);
|
g_clear_object (&priv->entry);
|
||||||
g_clear_object (&priv->case_sensitive_button);
|
g_clear_object (&priv->case_sensitive_button);
|
||||||
g_clear_object (&priv->prev_button);
|
g_clear_object (&priv->prev_button);
|
||||||
@ -459,7 +475,8 @@ search_bar_key_press_event (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkWidgetClass *widget_class;
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
if (event->keyval == GDK_KEY_Escape) {
|
if (event->keyval == GDK_KEY_Escape &&
|
||||||
|
e_search_bar_get_can_hide (E_SEARCH_BAR (widget))) {
|
||||||
gtk_widget_hide (widget);
|
gtk_widget_hide (widget);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -518,6 +535,16 @@ e_search_bar_class_init (ESearchBarClass *class)
|
|||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READABLE));
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
|
g_object_class_install_property (
|
||||||
|
object_class,
|
||||||
|
PROP_CAN_HIDE,
|
||||||
|
g_param_spec_boolean (
|
||||||
|
"can-hide",
|
||||||
|
"Can Hide",
|
||||||
|
NULL,
|
||||||
|
TRUE,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (
|
g_object_class_install_property (
|
||||||
object_class,
|
object_class,
|
||||||
PROP_CASE_SENSITIVE,
|
PROP_CASE_SENSITIVE,
|
||||||
@ -576,6 +603,7 @@ e_search_bar_init (ESearchBar *search_bar)
|
|||||||
GtkWidget *container;
|
GtkWidget *container;
|
||||||
|
|
||||||
search_bar->priv = E_SEARCH_BAR_GET_PRIVATE (search_bar);
|
search_bar->priv = E_SEARCH_BAR_GET_PRIVATE (search_bar);
|
||||||
|
search_bar->priv->can_hide = TRUE;
|
||||||
|
|
||||||
gtk_box_set_spacing (GTK_BOX (search_bar), 12);
|
gtk_box_set_spacing (GTK_BOX (search_bar), 12);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (search_bar), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (search_bar), 6);
|
||||||
@ -596,6 +624,7 @@ e_search_bar_init (ESearchBar *search_bar)
|
|||||||
gtk_button_set_relief (GTK_BUTTON (widget), GTK_RELIEF_NONE);
|
gtk_button_set_relief (GTK_BUTTON (widget), GTK_RELIEF_NONE);
|
||||||
gtk_widget_set_tooltip_text (widget, _("Close the find bar"));
|
gtk_widget_set_tooltip_text (widget, _("Close the find bar"));
|
||||||
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
|
||||||
|
search_bar->priv->hide_button = g_object_ref (widget);
|
||||||
gtk_widget_show (widget);
|
gtk_widget_show (widget);
|
||||||
|
|
||||||
g_signal_connect_swapped (
|
g_signal_connect_swapped (
|
||||||
@ -825,3 +854,29 @@ e_search_bar_set_text (ESearchBar *search_bar,
|
|||||||
/* This will trigger a "notify::text" signal. */
|
/* This will trigger a "notify::text" signal. */
|
||||||
gtk_entry_set_text (entry, text);
|
gtk_entry_set_text (entry, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
e_search_bar_get_can_hide (ESearchBar *search_bar)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), FALSE);
|
||||||
|
|
||||||
|
return search_bar->priv->can_hide;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_search_bar_set_can_hide (ESearchBar *search_bar,
|
||||||
|
gboolean can_hide)
|
||||||
|
{
|
||||||
|
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
|
||||||
|
|
||||||
|
if (!search_bar->priv->can_hide == !can_hide)
|
||||||
|
return;
|
||||||
|
|
||||||
|
search_bar->priv->can_hide = can_hide;
|
||||||
|
|
||||||
|
gtk_widget_set_visible (search_bar->priv->hide_button, can_hide);
|
||||||
|
if (!can_hide)
|
||||||
|
gtk_widget_show (GTK_WIDGET (search_bar));
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (search_bar), "can-hide");
|
||||||
|
}
|
||||||
|
@ -79,6 +79,9 @@ void e_search_bar_set_case_sensitive (ESearchBar *search_bar,
|
|||||||
gchar * e_search_bar_get_text (ESearchBar *search_bar);
|
gchar * e_search_bar_get_text (ESearchBar *search_bar);
|
||||||
void e_search_bar_set_text (ESearchBar *search_bar,
|
void e_search_bar_set_text (ESearchBar *search_bar,
|
||||||
const gchar *text);
|
const gchar *text);
|
||||||
|
gboolean e_search_bar_get_can_hide (ESearchBar *search_bar);
|
||||||
|
void e_search_bar_set_can_hide (ESearchBar *search_bar,
|
||||||
|
gboolean can_hide);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ static void
|
|||||||
emfe_show_html (GtkWindow *parent,
|
emfe_show_html (GtkWindow *parent,
|
||||||
const gchar *html)
|
const gchar *html)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog, *widget, *container;
|
GtkWidget *dialog, *widget, *container, *searchbar;
|
||||||
|
|
||||||
dialog = gtk_dialog_new_with_buttons (_("Description of Filters"), parent,
|
dialog = gtk_dialog_new_with_buttons (_("Description of Filters"), parent,
|
||||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
@ -71,6 +71,14 @@ emfe_show_html (GtkWindow *parent,
|
|||||||
NULL);
|
NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (container), widget);
|
gtk_container_add (GTK_CONTAINER (container), widget);
|
||||||
|
|
||||||
|
container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||||
|
searchbar = e_search_bar_new (E_WEB_VIEW (widget));
|
||||||
|
g_object_set (G_OBJECT (searchbar),
|
||||||
|
"can-hide", FALSE,
|
||||||
|
"visible", TRUE,
|
||||||
|
NULL);
|
||||||
|
gtk_container_add (GTK_CONTAINER (container), searchbar);
|
||||||
|
|
||||||
e_web_view_load_string (E_WEB_VIEW (widget), html);
|
e_web_view_load_string (E_WEB_VIEW (widget), html);
|
||||||
|
|
||||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||||
|
Reference in New Issue
Block a user