/** * Loads a search result into the item list and renders * some info text into the HTML view pane. * * @param searchResult valid search result node * @param searchString search text (or NULL) */ static void search_load_results (nodePtr searchResult, const gchar *searchString) { GString *buffer; itemSetPtr itemSet; nodeViewType viewMode; /* Clear feed and item display and load search results */ feed_list_view_select (NULL); itemlist_unload (FALSE); /* Ensure that we are in a useful viewing mode (3 paned) */ viewMode = itemlist_get_view_mode (); if ((NODE_VIEW_MODE_NORMAL != viewMode) && (NODE_VIEW_MODE_WIDE != viewMode)) itemview_set_layout (NODE_VIEW_MODE_NORMAL); itemSet = node_get_itemset (searchResult); itemlist_load_search_result (itemSet); itemset_free (itemSet); buffer = g_string_new (NULL); htmlview_start_output (buffer, NULL, TRUE, FALSE); g_string_append_printf (buffer, "<div class='content'><h2>"); if (searchString) g_string_append_printf (buffer, ngettext("%d Search Result for \"%s\"", "%d Search Results for \"%s\"", searchResult->itemCount), searchResult->itemCount, searchString); else g_string_append_printf (buffer, ngettext("%d Search Result", "%d Search Results", searchResult->itemCount), searchResult->itemCount); g_string_append_printf (buffer, "</h2><p>"); g_string_append_printf (buffer, _("The item list now contains all items matching the " "specified search pattern. If you want to save this search " "result permanently you can click the \"Search Folder\" button in " "the search dialog and Liferea will add a search folder to your " "feed list.")); g_string_append_printf (buffer, "</p></div>"); htmlview_finish_output (buffer); itemview_display_info (buffer->str); g_string_free (buffer, TRUE); }
ItemView * itemview_create (GtkWidget *window) { gint zoom; g_object_new (ITEMVIEW_TYPE, NULL); /* 1. Load preferences */ conf_get_int_value (LAST_ZOOMLEVEL, &zoom); if (zoom == 0) { zoom = 100; conf_set_int_value (LAST_ZOOMLEVEL, zoom); } itemview->priv->zoom = zoom; /* 2. Set initial layout (because no node selected yet) */ itemview_set_layout (NODE_VIEW_MODE_WIDE); return itemview; }