From 4f352374bb8cd8fe758733790d64a750ec9721ef Mon Sep 17 00:00:00 2001 From: "Andrew rugby471@gmail.com" <> Date: Sat, 19 Mar 2011 19:14:33 +0000 Subject: Fix issue with text of overlay Remove more GNOMEVFS code Add in proper no result message (bzr r10092.1.15) --- src/ui/dialog/ocaldialogs.cpp | 54 ++++++++++++++++--------------------------- src/ui/dialog/ocaldialogs.h | 3 ++- 2 files changed, 22 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index e5f714d08..070e0ba29 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -324,10 +324,10 @@ LogoDrawingArea::LogoDrawingArea() : Gtk::DrawingArea() draw_logo = false; } signal_expose_event().connect(sigc::mem_fun(*this, &LogoDrawingArea::_on_expose_event)); - signal_style_changed().connect(sigc::mem_fun(*this, &LogoDrawingArea::_on_style_set)); + signal_realize().connect(sigc::mem_fun(*this, &LogoDrawingArea::_on_realize)); } -void LogoDrawingArea::_on_style_set(const Glib::RefPtr& previous_style) +void LogoDrawingArea::_on_realize() { Gdk::Color color = get_style()->get_mid(get_state()); layout = this->create_pango_layout(""); @@ -414,8 +414,6 @@ void SearchResultList::on_cursor_changed() std::vector posArray(1); posArray = pathlist[0].get_indices(); -#ifdef WITH_GNOME_VFS - gnome_vfs_init(); GnomeVFSHandle *from_handle = NULL; GnomeVFSHandle *to_handle = NULL; GnomeVFSFileSize bytes_read; @@ -426,8 +424,8 @@ void SearchResultList::on_cursor_changed() // FIXME: this would be better as a per-user OCAL cache of files // instead of filling /tmp with downloads. - // - // create file path + + // Create file path const std::string tmptemplate = "ocal-"; std::string tmpname; int fd = Inkscape::IO::file_open_tmp(tmpname, tmptemplate); @@ -501,7 +499,6 @@ void SearchResultList::on_cursor_changed() } myPreview->showImage(myFilename); myLabel->set_text(get_text(posArray[0], RESULTS_COLUMN_TITLE)); -#endif return; fail: unlink(myFilename.c_str()); @@ -604,31 +601,6 @@ void SearchResultList::populate_from_xml(xmlNode * a_node) } } - -#ifdef WITH_GNOME_VFS -/** - * Read callback for xmlReadIO(), used below - */ -static int vfs_read_callback (GnomeVFSHandle *handle, char* buf, int nb) -{ - GnomeVFSFileSize ndone; - GnomeVFSResult result; - - result = gnome_vfs_read (handle, buf, nb, &ndone); - - if (result == GNOME_VFS_OK) { - return (int)ndone; - } else { - if (result != GNOME_VFS_ERROR_EOF) { - sp_ui_error_dialog(_("Error while reading the Open Clip Art RSS feed")); - g_warning("%s\n", gnome_vfs_result_to_string(result)); - } - return -1; - } -} -#endif - - /** * Callback for user input into entry_search */ @@ -689,6 +661,7 @@ void ImportDialog::on_xml_file_read(const Glib::RefPtr& result if (list_results->size() == 0) { notebook_content->set_current_page(NOTEBOOK_PAGE_NOT_FOUND); + update_label_no_search_results(); } else { // Populate the MARKUP column with the title & description of the clipart for (guint i = 0; i <= list_results->size() - 1; i++) { @@ -707,6 +680,20 @@ void ImportDialog::on_xml_file_read(const Glib::RefPtr& result xmlCleanupParser(); } + +void ImportDialog::update_label_no_search_results() +{ + const char* keywords = entry_search->get_text().c_str(); + Gdk::Color grey = entry_search->get_style()->get_text_aa(entry_search->get_state()); + + char* markup = g_markup_printf_escaped( + "%s%s%s\n%s", + _("No clipart named "), keywords, _(" was found."), grey.to_string().c_str(), + _("Please make sure all keywords are spelled correctly, or try again with different keywords.")); + + label_not_found->set_markup(markup); +} + /** * Constructor. Not called directly. Use the factory. */ @@ -794,8 +781,7 @@ ImportDialog::~ImportDialog() /** * Show this dialog modally. Return true if user hits [OK] */ -bool -ImportDialog::show() +bool ImportDialog::show() { set_modal (TRUE); //Window sp_transientize((GtkWidget *)gobj()); //Make transient diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 859451c39..7293ab4ac 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -281,7 +281,7 @@ public: LogoDrawingArea(); private: bool _on_expose_event(GdkEventExpose* event); - void _on_style_set(const Glib::RefPtr& previous_style); + void _on_realize(); bool draw_logo; Cairo::RefPtr logo_mask; Glib::RefPtr layout; @@ -383,6 +383,7 @@ private: Glib::ustring xml_uri; char xml_buffer[8192]; + void update_label_no_search_results(); void on_entry_search_activated(); void on_xml_file_read(const Glib::RefPtr& result); void on_xml_stream_read(const Glib::RefPtr& result); -- cgit v1.2.3