gtk_tree_view_collapse_all(GTK_TREE_VIEW(priv->treeview));
}
-
-static void cm_filter_entry_clear_icon_released_cb(GtkIconEntry *e, gint pos, gint btn, gpointer data)
-{
- if (pos == GTK_ICON_ENTRY_SECONDARY)
- gtk_entry_set_text(GTK_ENTRY(e), "");
-}
-
-
static void cm_tree_selection_changed_cb(GtkTreeSelection *selection, CookieManagerPage *cmp)
{
GList *rows;
gtk_container_add(GTK_CONTAINER(tree_swin), treeview);
gtk_widget_show(tree_swin);
- priv->filter_entry = gtk_icon_entry_new();
- gtk_entry_set_placeholder_text (GTK_ENTRY (priv->filter_entry), _("Search Cookies by Name or Domain"));
- gtk_entry_set_icon_from_stock (GTK_ENTRY (priv->filter_entry),
- GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
- sokoke_entry_set_clear_button_visible (GTK_ENTRY (priv->filter_entry), TRUE);
+ priv->filter_entry = sokoke_search_entry_new (_("Search Cookies by Name or Domain"));
gtk_widget_show(priv->filter_entry);
- g_signal_connect(priv->filter_entry, "icon-release",
- G_CALLBACK(cm_filter_entry_clear_icon_released_cb), NULL);
g_signal_connect(priv->filter_entry, "changed", G_CALLBACK(cm_filter_entry_changed_cb), self);
g_signal_connect(priv->filter_entry, "activate", G_CALLBACK(cm_filter_entry_changed_cb), self);
GtkWidget* alignment;
toolitem = GTK_WIDGET (gtk_tool_item_new ());
- entry = gtk_icon_entry_new ();
- sokoke_entry_set_clear_button_visible (GTK_ENTRY (entry), TRUE);
+ entry = sokoke_search_entry_new (NULL);
gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, TRUE);
alignment = gtk_alignment_new (0, 0.5, 1, 0.1);
gtk_widget_grab_focus (GTK_WIDGET (entry));
}
-void
-sokoke_entry_set_clear_button_visible (GtkEntry* entry,
- gboolean visible)
+GtkWidget*
+sokoke_search_entry_new (const gchar* placeholder_text)
{
- g_return_if_fail (GTK_IS_ENTRY (entry));
-
- gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_SECONDARY, TRUE);
- if (visible)
+ GtkWidget* entry = gtk_entry_new ();
+ gtk_entry_set_placeholder_text (GTK_ENTRY (entry), placeholder_text);
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
+ gtk_icon_entry_set_icon_highlight (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_SECONDARY, TRUE);
{
g_object_connect (entry,
"signal::icon-release",
G_CALLBACK (sokoke_entry_focus_out_event_cb), entry,
"signal::changed",
G_CALLBACK (sokoke_entry_changed_cb), entry, NULL);
- sokoke_entry_changed_cb ((GtkEditable*)entry, entry);
- }
- else
- {
- g_object_disconnect (entry,
- "any_signal::icon-release",
- G_CALLBACK (sokoke_entry_icon_released_cb), NULL,
- "any_signal::focus-in-event",
- G_CALLBACK (sokoke_entry_focus_out_event_cb), entry,
- "any_signal::focus-out-event",
- G_CALLBACK (sokoke_entry_focus_out_event_cb), entry,
- "any_signal::changed",
- G_CALLBACK (sokoke_entry_changed_cb), entry, NULL);
- gtk_icon_entry_set_icon_from_stock (
- GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_SECONDARY, NULL);
+ sokoke_entry_changed_cb ((GtkEditable*)entry, GTK_ENTRY (entry));
}
+ return entry;
}
gchar*
gchar*
midori_download_prepare_tooltip_text (WebKitDownload* download);
-void
-sokoke_entry_set_clear_button_visible (GtkEntry* entry,
- gboolean visible);
+GtkWidget*
+sokoke_search_entry_new (const gchar* placeholder_text);
#endif /* !__SOKOKE_H__ */
midori_bookmarks_filter_timeout_cb, bookmarks);
}
-static void
-midori_bookmarks_filter_entry_clear_cb (GtkEntry* entry,
- gint icon_pos,
- gint button,
- MidoriBookmarks* bookmarks)
-{
- if (icon_pos == GTK_ICON_ENTRY_SECONDARY)
- gtk_entry_set_text (entry, "");
-}
-
static void
midori_bookmarks_init (MidoriBookmarks* bookmarks)
{
GtkTreeSelection* selection;
/* Create the filter entry */
- entry = gtk_icon_entry_new ();
- gtk_entry_set_placeholder_text (GTK_ENTRY (entry), _("Search Bookmarks"));
- gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY,
- GTK_STOCK_FIND);
- sokoke_entry_set_clear_button_visible (GTK_ENTRY (entry), TRUE);
- g_signal_connect (entry, "icon-release",
- G_CALLBACK (midori_bookmarks_filter_entry_clear_cb), bookmarks);
- g_signal_connect (entry, "changed",
+ entry = sokoke_search_entry_new (_("Search Bookmarks"));
+ g_signal_connect_after (entry, "changed",
G_CALLBACK (midori_bookmarks_filter_entry_changed_cb), bookmarks);
box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3);
katze_assign (history->filter, NULL);
}
-static void
-midori_history_filter_entry_clear_cb (GtkEntry* entry,
- gint icon_pos,
- gint button,
- MidoriHistory* history)
-{
- if (icon_pos == GTK_ICON_ENTRY_SECONDARY)
- gtk_entry_set_text (entry, "");
-}
-
static void
midori_history_selection_changed_cb (GtkTreeView* treeview,
MidoriHistory* history)
GtkTreeSelection* selection;
/* Create the filter entry */
- entry = gtk_icon_entry_new ();
- gtk_entry_set_placeholder_text (GTK_ENTRY (entry), _("Search History"));
- gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY,
- GTK_STOCK_FIND);
- sokoke_entry_set_clear_button_visible (GTK_ENTRY (entry), TRUE);
- g_signal_connect (entry, "icon-release",
- G_CALLBACK (midori_history_filter_entry_clear_cb), history);
- g_signal_connect (entry, "changed",
+ entry = sokoke_search_entry_new (_("Search History"));
+ g_signal_connect_after (entry, "changed",
G_CALLBACK (midori_history_filter_entry_changed_cb), history);
box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 3);
return FALSE;
}
-static void
-midori_findbar_entry_clear_icon_released_cb (GtkIconEntry* entry,
- gint icon_pos,
- gint button,
- MidoriFindbar*findbar)
-{
- if (icon_pos == GTK_ICON_ENTRY_SECONDARY)
- {
- midori_findbar_set_icon (findbar, GTK_ICON_ENTRY_PRIMARY, STOCK_EDIT_FIND);
- }
-}
-
static gboolean
midori_findbar_case_sensitive (MidoriFindbar* findbar)
{
/* i18n: A panel at the bottom, to search text in pages */
gtk_label_new_with_mnemonic (_("_Inline Find:")));
gtk_toolbar_insert (GTK_TOOLBAR (findbar), toolitem, -1);
- findbar->find_text = gtk_icon_entry_new ();
- midori_findbar_set_icon (findbar, GTK_ICON_ENTRY_PRIMARY, STOCK_EDIT_FIND);
- sokoke_entry_set_clear_button_visible (GTK_ENTRY (findbar->find_text), TRUE);
- g_signal_connect (findbar->find_text, "icon-release",
- G_CALLBACK (midori_findbar_entry_clear_icon_released_cb), findbar);
+ findbar->find_text = sokoke_search_entry_new (NULL);
g_signal_connect (findbar->find_text, "activate",
G_CALLBACK (midori_findbar_next_activate_cb), findbar);
g_signal_connect (findbar->find_text, "preedit-changed",