From de9f68b9afd9b618a763f73b2110aefb00801fe5 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emilou@emilou-desktop.(none)> Date: Fri, 12 Jun 2009 17:39:55 -0400 Subject: [PATCH] [#961] Instanciate only once the searchbar icons --- .../src/contacts/searchbar.c | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/sflphone-client-gnome/src/contacts/searchbar.c b/sflphone-client-gnome/src/contacts/searchbar.c index f9cf62c909..764516345a 100644 --- a/sflphone-client-gnome/src/contacts/searchbar.c +++ b/sflphone-client-gnome/src/contacts/searchbar.c @@ -23,14 +23,17 @@ #include <searchbar.h> #include <calltree.h> -const GdkColor BLACK_COLOR = { 0, 0, 0, 0 }; -const GdkColor GRAY_COLOR = { 0, 30000, 30000, 30000 }; - GtkWidget * searchbox; - static GtkWidget *menu = NULL; +/** + * Searchbar icons + */ +GdkPixbuf *incoming_pixbuf = NULL; +GdkPixbuf *outgoing_pixbuf = NULL; +GdkPixbuf *missed_pixbuf = NULL; + void searchbar_entry_changed (GtkEntry* entry, gchar* arg1 UNUSED, gpointer data UNUSED) { if (active_calltree == contacts) { @@ -49,8 +52,8 @@ static void search_all (GtkWidget *item, GtkEntry *entry) gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND); gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - "Search all\n" - "Click here to change the search type"); + _("Search all\n" + "Click here to change the search type")); history_search (HistorySearchType); } @@ -59,11 +62,10 @@ static void search_by_missed (GtkWidget *item, GtkEntry *entry) { HistorySearchType = SEARCH_MISSED; - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/missed.svg", NULL); - gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, pixbuf); + gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, missed_pixbuf); gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - "Search by missed call\n" - "Click here to change the search type"); + _("Search by missed call\n" + "Click here to change the search type")); history_search (HistorySearchType); } @@ -72,11 +74,10 @@ static void search_by_incoming (GtkWidget *item, GtkEntry *entry) { HistorySearchType = SEARCH_INCOMING; - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/incoming.svg", NULL); - gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, pixbuf); + gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, incoming_pixbuf); gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - "Search by incoming call\n" - "Click here to change the search type"); + _("Search by incoming call\n" + "Click here to change the search type")); history_search (HistorySearchType); } @@ -85,11 +86,10 @@ static void search_by_outgoing (GtkWidget *item, GtkEntry *entry) { HistorySearchType = SEARCH_OUTGOING; - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/outgoing.svg", NULL); - gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, pixbuf); + gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, outgoing_pixbuf); gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, - "Search by outgoing call\n" - "Click here to change the search type"); + _("Search by outgoing call\n" + "Click here to change the search type")); history_search (HistorySearchType); } @@ -153,6 +153,10 @@ GtkWidget* history_searchbar_new (void) searchbox = gtk_entry_new(); gtk_entry_set_icon_from_stock (GTK_ENTRY (searchbox), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); + missed_pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/missed.svg", NULL); + incoming_pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/incoming.svg", NULL); + outgoing_pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/outgoing.svg", NULL); + // Set the clean insensitive text_changed_cb (GTK_ENTRY (searchbox), NULL); -- GitLab