[seahorse] ui: add icons and clear action to the filter entry
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] ui: add icons and clear action to the filter entry
- Date: Fri, 8 Oct 2010 16:26:34 +0000 (UTC)
commit eee80ac605b06ec4885f32b214ee5d13767d631b
Author: Diego Escalante Urrelo <descalante igalia com>
Date: Tue Mar 30 02:33:02 2010 -0500
ui: add icons and clear action to the filter entry
This patch adds the stock search and clear icons to the filter entry in the
main window. It also implements the clear entry text action when clicking on
the clear icon.
Bug #614332
src/seahorse-key-manager.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/seahorse-key-manager.c b/src/seahorse-key-manager.c
index 49420a4..53d7d0b 100644
--- a/src/seahorse-key-manager.c
+++ b/src/seahorse-key-manager.c
@@ -380,6 +380,12 @@ on_first_timer (SeahorseKeyManager* self)
return FALSE;
}
+static void
+on_clear_clicked (GtkEntry* entry, GtkEntryIconPosition icon_pos, GdkEvent* event, gpointer user_data)
+{
+ gtk_entry_set_text (entry, "");
+}
+
static void
on_filter_changed (GtkEntry* entry, SeahorseKeyManager* self)
{
@@ -839,7 +845,6 @@ seahorse_key_manager_set_selected (SeahorseViewer* base, SeahorseObject* value)
g_object_notify (G_OBJECT (self), "selected");
}
-
static GObject*
seahorse_key_manager_constructor (GType type, guint n_props, GObjectConstructParam *props)
{
@@ -938,6 +943,23 @@ seahorse_key_manager_constructor (GType type, guint n_props, GObjectConstructPar
}
}
}
+
+ gtk_entry_set_icon_from_icon_name (self->pv->filter_entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ GTK_STOCK_FIND);
+ gtk_entry_set_icon_from_icon_name (self->pv->filter_entry,
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_CLEAR);
+
+ gtk_entry_set_icon_activatable (self->pv->filter_entry,
+ GTK_ENTRY_ICON_PRIMARY, FALSE);
+ gtk_entry_set_icon_activatable (self->pv->filter_entry,
+ GTK_ENTRY_ICON_SECONDARY, TRUE);
+
+ gtk_entry_set_width_chars (self->pv->filter_entry, 30);
+
+ g_signal_connect (self->pv->filter_entry, "icon-release",
+ G_CALLBACK (on_clear_clicked), NULL);
/* For the filtering */
g_signal_connect_object (GTK_EDITABLE (self->pv->filter_entry), "changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]