/** @file * @brief Open Clip Art Library integration dialogs - implementation */ /* Authors: * Bruno Dilly * Other dudes from The Inkscape Organization * Andrew Higginson * * Copyright (C) 2007 Bruno Dilly * * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H # include #endif #include // rename() #include // close() #include // errno #include // strerror() #include "path-prefix.h" #include "ocaldialogs.h" #include "filedialogimpl-gtkmm.h" #include "interface.h" #include "gc-core.h" #include #include "io/sys.h" #include "preferences.h" namespace Inkscape { namespace UI { namespace Dialog { namespace OCAL { //######################################################################## //# F I L E E X P O R T T O O C A L //######################################################################## /** * Callback for fileNameEntry widget */ /* void ExportDialog::fileNameEntryChangedCallback() { if (!fileNameEntry) return; Glib::ustring fileName = fileNameEntry->get_text(); if (!Glib::get_charset()) //If we are not utf8 fileName = Glib::filename_to_utf8(fileName); myFilename = fileName; response(Gtk::RESPONSE_OK); } */ /** * Constructor */ /* ExportDialog::ExportDialog(Gtk::Window &parentWindow, FileDialogType fileTypes, const Glib::ustring &title) : FileDialogBase(title, parentWindow) { */ /* * Start Taking the vertical Box and putting a Label * and a Entry to take the filename * Later put the extension selection and checkbox (?) */ /* Initalize to Autodetect */ /* extension = NULL; */ /* No filename to start out with */ /* myFilename = ""; */ /* Set our dialog type (save, export, etc...)*/ /* dialogType = fileTypes; Gtk::VBox *vbox = get_vbox(); Gtk::Label *fileLabel = new Gtk::Label(_("File")); fileNameEntry = new Gtk::Entry(); fileNameEntry->set_text(myFilename); fileNameEntry->set_max_length(252); // I am giving the extension approach. fileBox.pack_start(*fileLabel); fileBox.pack_start(*fileNameEntry, Gtk::PACK_EXPAND_WIDGET, 3); vbox->pack_start(fileBox); //Let's do some customization fileNameEntry = NULL; Gtk::Container *cont = get_toplevel(); std::vector entries; findEntryWidgets(cont, entries); if (entries.size() >=1 ) { //Catch when user hits [return] on the text field fileNameEntry = entries[0]; fileNameEntry->signal_activate().connect( sigc::mem_fun(*this, &ExportDialog::fileNameEntryChangedCallback) ); } add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); set_default(*add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK)); show_all_children(); } */ /** * Destructor */ /* ExportDialog::~ExportDialog() { } */ /** * Show this dialog modally. Return true if user hits [OK] */ /* bool ExportDialog::show() { set_modal (TRUE); //Window sp_transientize((GtkWidget *)gobj()); //Make transient gint b = run(); //Dialog hide(); if (b == Gtk::RESPONSE_OK) { return TRUE; } else { return FALSE; } } */ /** * Get the file name chosen by the user. Valid after an [OK] */ /* Glib::ustring ExportDialog::get_filename() { myFilename = fileNameEntry->get_text(); if (!Glib::get_charset()) //If we are not utf8 myFilename = Glib::filename_to_utf8(myFilename); return myFilename; } void ExportDialog::change_title(const Glib::ustring& title) { this->set_title(title); } */ //######################################################################## //# F I L E E X P O R T T O O C A L P A S S W O R D //######################################################################## /** * Constructor */ /* ExportPasswordDialog::ExportPasswordDialog(Gtk::Window &parentWindow, const Glib::ustring &title) : FileDialogBase(title, parentWindow) { */ /* * Start Taking the vertical Box and putting 2 Labels * and 2 Entries to take the username and password */ /* No username and password to start out with */ /* myUsername = ""; myPassword = ""; Gtk::VBox *vbox = get_vbox(); Gtk::Label *userLabel = new Gtk::Label(_("Username:")); Gtk::Label *passLabel = new Gtk::Label(_("Password:")); usernameEntry = new Gtk::Entry(); usernameEntry->set_text(myUsername); usernameEntry->set_max_length(255); passwordEntry = new Gtk::Entry(); passwordEntry->set_text(myPassword); passwordEntry->set_max_length(255); passwordEntry->set_invisible_char('*'); passwordEntry->set_visibility(false); passwordEntry->set_activates_default(true); userBox.pack_start(*userLabel); userBox.pack_start(*usernameEntry, Gtk::PACK_EXPAND_WIDGET, 3); vbox->pack_start(userBox); passBox.pack_start(*passLabel); passBox.pack_start(*passwordEntry, Gtk::PACK_EXPAND_WIDGET, 3); vbox->pack_start(passBox); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); set_default(*add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK)); show_all_children(); } */ /** * Destructor */ /* ExportPasswordDialog::~ExportPasswordDialog() { } */ /** * Show this dialog modally. Return true if user hits [OK] */ /* bool ExportPasswordDialog::show() { set_modal (TRUE); //Window sp_transientize((GtkWidget *)gobj()); //Make transient gint b = run(); //Dialog hide(); if (b == Gtk::RESPONSE_OK) { return TRUE; } else { return FALSE; } } */ /** * Get the username. Valid after an [OK] */ /* Glib::ustring ExportPasswordDialog::getUsername() { myUsername = usernameEntry->get_text(); return myUsername; } */ /** * Get the password. Valid after an [OK] */ /* Glib::ustring ExportPasswordDialog::getPassword() { myPassword = passwordEntry->get_text(); return myPassword; } void ExportPasswordDialog::change_title(const Glib::ustring& title) { this->set_title(title); } */ //######################################################################### //### F I L E I M P O R T F R O M O C A L //######################################################################### StatusWidget::StatusWidget() : Gtk::HBox(false, 6) { image = new Gtk::Image(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_MENU); spinner = new Gtk::Spinner(); label = new Gtk::Label(); image->set_no_show_all(true); spinner->set_no_show_all(true); label->set_no_show_all(true); pack_start(*image, false, false); pack_start(*spinner, false, false); pack_start(*label, false, false); } void StatusWidget::clear() { spinner->hide(); image->hide(); label->hide(); } void StatusWidget::set_error(Glib::ustring text) { spinner->hide(); image->show(); label->show(); image->set(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_MENU); label->set_text(text); } void StatusWidget::start_process(Glib::ustring text) { image->hide(); spinner->show(); label->show(); label->set_text(text); spinner->start(); show_all(); } void StatusWidget::end_process() { spinner->stop(); spinner->hide(); label->hide(); clear(); } SearchEntry::SearchEntry() : Gtk::Entry() { signal_changed().connect(sigc::mem_fun(*this, &SearchEntry::_on_changed)); signal_icon_press().connect(sigc::mem_fun(*this, &SearchEntry::_on_icon_pressed)); set_icon_from_stock(Gtk::Stock::FIND, Gtk::ENTRY_ICON_PRIMARY); gtk_entry_set_icon_from_stock(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); } void SearchEntry::_on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* event) { if (icon_position == Gtk::ENTRY_ICON_SECONDARY) { grab_focus(); set_text(""); } else if (icon_position == Gtk::ENTRY_ICON_PRIMARY) { select_region(0, -1); grab_focus(); } } void SearchEntry::_on_changed() { if (get_text().empty()) { gtk_entry_set_icon_from_stock(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); } else { set_icon_from_stock(Gtk::Stock::CLEAR, Gtk::ENTRY_ICON_SECONDARY); } } BaseBox::BaseBox() : Gtk::EventBox() { signal_expose_event().connect(sigc::mem_fun(*this, &BaseBox::_on_expose_event), false); set_visible_window(false); } bool BaseBox::_on_expose_event(GdkEventExpose* event) { Cairo::RefPtr cr = get_window()->create_cairo_context(); // Draw background and shadow int x = get_allocation().get_x(); int y = get_allocation().get_y(); int width = get_allocation().get_width(); int height = get_allocation().get_height(); Gdk::Color background_fill = get_style()->get_base(get_state()); cr->rectangle(x, y, width, height); Gdk::Cairo::set_source_color(cr, background_fill); cr->fill(); get_style()->paint_shadow(get_window(), get_state(), Gtk::SHADOW_IN, Gdk::Rectangle(x, y, width, height), *this, Glib::ustring::ustring("viewport"), x, y, width, height); return false; } LogoArea::LogoArea() : Gtk::EventBox() { // Try to load the OCAL logo, but if the file is not found, degrade gracefully try { std::string logo_path = Glib::build_filename(INKSCAPE_PIXMAPDIR, "OCAL.png"); logo_mask = Cairo::ImageSurface::create_from_png(logo_path); draw_logo = true; } catch( Cairo::logic_error ) { logo_mask = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 1,1); draw_logo = false; } signal_expose_event().connect(sigc::mem_fun(*this, &LogoArea::_on_expose_event)); signal_realize().connect(sigc::mem_fun(*this, &LogoArea::_on_realize)); set_visible_window(false); } void LogoArea::_on_realize() { Gdk::Color color = get_style()->get_mid(get_state()); layout = this->create_pango_layout(""); Glib::ustring markup = Glib::ustring::compose("%2", color.to_string(), _("Powered by")); layout->set_markup(markup); } bool LogoArea::_on_expose_event(GdkEventExpose* event) { if (draw_logo) { int x = get_allocation().get_x(); int y = get_allocation().get_y(); int width = get_allocation().get_width(); int height = get_allocation().get_height(); Cairo::RefPtr cr = get_window()->create_cairo_context(); // Draw logo, we mask [read fill] it with the mid colour from the // user's GTK theme Gdk::Color logo_fill = get_style()->get_mid(get_state()); int x_logo = x + width - 12 - 127; int y_logo = y + height - 12 - 44; Gdk::Cairo::set_source_color(cr, logo_fill); cr->mask(logo_mask, x_logo, y_logo); // Draw text Pango::Rectangle extents = layout->get_pixel_logical_extents(); int text_width = extents.get_width(); int text_height = extents.get_height(); int x_text = x_logo - text_width - 12; int y_text = y + height - text_height - 12; get_style()->paint_layout(get_window(), get_state(), true, Gdk::Rectangle(x, y, width, height), *this, "", x_text, y_text, layout); } return false; } SearchResultList::SearchResultList(guint columns_count, SVGPreview& filesPreview, Gtk::Label& description, Gtk::Button& okButton) : ListViewText(columns_count) { set_headers_visible(false); set_column_title(RESULTS_COLUMN_MARKUP, _("Clipart found")); Gtk::CellRenderer* cr_markup = get_column_cell_renderer(RESULTS_COLUMN_MARKUP); cr_markup->set_property("ellipsize", Pango::ELLIPSIZE_END); get_column(RESULTS_COLUMN_MARKUP)->clear_attributes(*cr_markup); get_column(RESULTS_COLUMN_MARKUP)->add_attribute(*cr_markup, "markup", RESULTS_COLUMN_MARKUP); get_column(RESULTS_COLUMN_TITLE)->set_visible(false); get_column(RESULTS_COLUMN_DESCRIPTION)->set_visible(false); get_column(RESULTS_COLUMN_CREATOR)->set_visible(false); get_column(RESULTS_COLUMN_DATE)->set_visible(false); get_column(RESULTS_COLUMN_FILENAME)->set_visible(false); get_column(RESULTS_COLUMN_URL)->set_visible(false); get_column(RESULTS_COLUMN_THUMBNAIL_URL)->set_visible(false); } void ImportDialog::on_button_import_clicked() { std::vector pathlist; pathlist = list_results->get_selection()->get_selected_rows(); std::vector posArray(1); posArray = pathlist[0].get_indices(); int row = posArray[0]; download_image(row); } void ImportDialog::download_image(int row) { // Get Remote File URL Glib::ustring url = list_results->get_text(row, RESULTS_COLUMN_URL); file_remote = Gio::File::create_for_uri(url.c_str()); // Create local file const std::string tmptemplate = "ocal-"; std::string tmpname; int fd = Inkscape::IO::file_open_tmp(tmpname, tmptemplate); if (fd < 0) { widget_status->set_error(_("Could not create image file")); return; } close(fd); // make sure we don't collide with other users on the same machine filename_image = tmpname; filename_image.append("-"); filename_image.append(list_results->get_text(row, RESULTS_COLUMN_FILENAME)); // rename based on original image's name, retaining extension if (rename(tmpname.c_str(), filename_image.c_str()) < 0) { unlink(tmpname.c_str()); widget_status->set_error(_("Could not create image file")); } file_local = Gio::File::create_for_path(filename_image.c_str()); file_remote->copy_async(file_local, sigc::mem_fun(*this, &ImportDialog::on_thumbnail_image_downloaded), Gio::FILE_COPY_OVERWRITE); } void ImportDialog::on_image_downloaded(const Glib::RefPtr& result) { bool success = file_thumbnail_remote->copy_finish(result); if (success) { m_signal_response.emit(filename_image); } else { filename_image = ""; } } /* * Callback for cursor chage */ void ImportDialog::on_list_results_cursor_changed() { std::vector pathlist; pathlist = list_results->get_selection()->get_selected_rows(); std::vector posArray(1); posArray = pathlist[0].get_indices(); int row = posArray[0]; // FIXME: this would be better as a per-user OCAL cache of files // instead of filling /tmp with downloads. update_preview(row); download_thumbnail_image(row); } void ImportDialog::update_preview(int row) { Glib::ustring title = list_results->get_text(row, RESULTS_COLUMN_TITLE); Glib::ustring description = list_results->get_text(row, RESULTS_COLUMN_DESCRIPTION); Glib::ustring creator = list_results->get_text(row, RESULTS_COLUMN_CREATOR); Glib::ustring date = list_results->get_text(row, RESULTS_COLUMN_DATE); } void ImportDialog::download_thumbnail_image(int row) { // Get Remote File URL Glib::ustring url = list_results->get_text(row, RESULTS_COLUMN_THUMBNAIL_URL); file_thumbnail_remote = Gio::File::create_for_uri(url.c_str()); // Create local file const std::string tmptemplate = "ocal-"; std::string tmpname; int fd = Inkscape::IO::file_open_tmp(tmpname, tmptemplate); if (fd < 0) { widget_status->set_error(_("Could not create thumbnail file")); return; } close(fd); // make sure we don't collide with other users on the same machine filename_thumbnail = tmpname; filename_thumbnail.append("-"); filename_thumbnail.append(list_results->get_text(row, RESULTS_COLUMN_FILENAME)); // rename based on original image's name, retaining extension if (rename(tmpname.c_str(), filename_thumbnail.c_str()) < 0) { unlink(tmpname.c_str()); widget_status->set_error(_("Could not create thumbnail file")); } file_thumbnail_local = Gio::File::create_for_path(filename_thumbnail.c_str()); file_thumbnail_remote->copy_async(file_thumbnail_local, sigc::mem_fun(*this, &ImportDialog::on_thumbnail_image_downloaded), Gio::FILE_COPY_OVERWRITE); } /* * Callback for row activated */ void ImportDialog::on_thumbnail_image_downloaded(const Glib::RefPtr& result) { bool success = file_thumbnail_remote->copy_finish(result); if (success) { preview_files->showImage(filename_thumbnail); } else { widget_status->set_error(_("Could not download thumbnail file")); filename_thumbnail = ""; } } /* * Callback for row activated */ void ImportDialog::on_list_results_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column) { on_list_results_cursor_changed(); button_import->signal_clicked(); } /** * Prints the names of the all the xml elements * that are siblings or children of a given xml node */ void SearchResultList::populate_from_xml(xmlNode * a_node) { xmlNode *cur_node = NULL; guint row_num = 0; for (cur_node = a_node; cur_node; cur_node = cur_node->next) { // Get items information if (strcmp((const char*)cur_node->name, "rss")) // Avoid the root if (cur_node->type == XML_ELEMENT_NODE && !strcmp((const char*)cur_node->parent->name, "item")) { if (!strcmp((const char*)cur_node->name, "title")) { row_num = append_text(""); xmlChar *xml_title = xmlNodeGetContent(cur_node); char* title = (char*) xml_title; set_text(row_num, RESULTS_COLUMN_TITLE, title); xmlFree(title); } else if (!strcmp((const char*)cur_node->name, "pubDate")) { xmlChar *xml_date = xmlNodeGetContent(cur_node); char* date = (char*) xml_date; set_text(row_num, RESULTS_COLUMN_DATE, date); xmlFree(xml_date); } else if (!strcmp((const char*)cur_node->name, "creator")) { xmlChar *xml_creator = xmlNodeGetContent(cur_node); char* creator = (char*) xml_creator; set_text(row_num, RESULTS_COLUMN_CREATOR, creator); xmlFree(xml_creator); } else if (!strcmp((const char*)cur_node->name, "description")) { xmlChar *xml_description = xmlNodeGetContent(cur_node); //char* final_description; char* stripped_description = g_strstrip((char*) xml_description); if (!strcmp(stripped_description, "")) { stripped_description = _("No description"); } //GRegex* regex = g_regex_new(g_regex_escape_string(stripped_description, -1)); //final_description = g_regex_replace_literal(regex, "\n", -1, 0, " "); set_text(row_num, RESULTS_COLUMN_DESCRIPTION, stripped_description); xmlFree(xml_description); } else if (!strcmp((const char*)cur_node->name, "enclosure")) { xmlChar *xml_url = xmlGetProp(cur_node, (xmlChar*) "url"); char* url = (char*) xml_url; char* filename = g_path_get_basename(url); set_text(row_num, RESULTS_COLUMN_URL, url); set_text(row_num, RESULTS_COLUMN_FILENAME, filename); xmlFree(xml_url); } else if (!strcmp((const char*)cur_node->name, "thumbnail")) { xmlChar *xml_thumbnail_url = xmlGetProp(cur_node, (xmlChar*) "url"); char* thumbnail_url = (char*) xml_thumbnail_url; set_text(row_num, RESULTS_COLUMN_THUMBNAIL_URL, thumbnail_url); xmlFree(xml_thumbnail_url); } } populate_from_xml(cur_node->children); } } /** * Callback for user input into entry_search */ void ImportDialog::on_button_search_clicked() { on_entry_search_activated(); } /** * Callback for user input into entry_search */ void ImportDialog::on_entry_search_activated() { widget_status->start_process(_("Searching clipart...")); notebook_content->set_current_page(NOTEBOOK_PAGE_LOGO); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring search_keywords = entry_search->get_text(); // Create the URI to the OCAL RSS feed xml_uri = Glib::ustring::compose("http://%1/media/feed/rss/%2", prefs->getString("/options/ocalurl/str"), search_keywords); // If we are not UTF8 if (!Glib::get_charset()) { xml_uri = Glib::filename_to_utf8(xml_uri); } // Open the rss feed xml_file = Gio::File::create_for_uri(xml_uri); xml_file->load_contents_async(sigc::mem_fun(*this, &ImportDialog::on_xml_file_read)); } void ImportDialog::on_xml_file_read(const Glib::RefPtr& result) { widget_status->end_process(); char* data; gsize length; bool sucess = xml_file->load_contents_finish(result, data, length); if (!sucess) { widget_status->set_error(_("Could not connect to the Open Clip Art Library")); return; } // Create the resulting xml document tree // Initialize libxml and test mistakes between compiled and shared library used LIBXML_TEST_VERSION xmlDoc *doc = NULL; xmlNode *root_element = NULL; doc = xmlReadMemory(data, (int) length, xml_uri.c_str(), NULL, XML_PARSE_RECOVER + XML_PARSE_NOWARNING + XML_PARSE_NOERROR); if (doc == NULL) { // If nothing is returned, no results could be found if (length == 0) { notebook_content->set_current_page(NOTEBOOK_PAGE_NOT_FOUND); update_label_no_search_results(); } else { widget_status->set_error(_("Could not parse search results")); } return; } // Get the root element node root_element = xmlDocGetRootElement(doc); // Clear and populate the list_results list_results->clear_items(); list_results->populate_from_xml(root_element); // Populate the MARKUP column with the title & description of the clipart for (guint i = 0; i <= list_results->size() - 1; i++) { Glib::ustring title = list_results->get_text(i, RESULTS_COLUMN_TITLE); Glib::ustring description = list_results->get_text(i, RESULTS_COLUMN_DESCRIPTION); char* markup = g_markup_printf_escaped("%s\n%s", title.c_str(), description.c_str()); list_results->set_text(i, RESULTS_COLUMN_MARKUP, markup); } notebook_content->set_current_page(NOTEBOOK_PAGE_RESULTS); // free the document xmlFreeDoc(doc); // free the global variables that may have been allocated by the parser xmlCleanupParser(); } void ImportDialog::update_label_no_search_results() { Glib::ustring keywords = Glib::Markup::escape_text(entry_search->get_text()); Gdk::Color grey = entry_search->get_style()->get_text_aa(entry_search->get_state()); Glib::ustring markup = Glib::ustring::compose( "%1 %2 %3\n%5", _("No clipart named"), keywords, _("was found."), grey.to_string(), _("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. */ ImportDialog::ImportDialog(Gtk::Window& parent_window, const Glib::ustring &/*dir*/, FileDialogType file_types, const Glib::ustring &title) : FileDialogBase(title, parent_window) { // Initalize to Autodetect extension = NULL; // No filename to start out with Glib::ustring search_keywords = ""; dialogType = file_types; // Creation Gtk::VBox *vbox = new Gtk::VBox(false, 0); Gtk::HButtonBox *hbuttonbox_bottom = new Gtk::HButtonBox(); Gtk::HBox *hbox_bottom = new Gtk::HBox(false, 12); BaseBox *basebox_logo = new BaseBox(); BaseBox *basebox_no_search_results = new BaseBox(); label_not_found = new Gtk::Label(); label_description = new Gtk::Label(); entry_search = new SearchEntry(); button_search = new Gtk::Button(_("Search")); Gtk::HButtonBox* hbuttonbox_search = new Gtk::HButtonBox(); preview_files = new SVGPreview(); /// Add the buttons in the bottom of the dialog button_cancel = new Gtk::Button(Gtk::Stock::CANCEL); button_import = new Gtk::Button(_("Import")); list_results = new SearchResultList(RESULTS_COLUMN_LENGTH, *preview_files, *label_description, *button_import); drawingarea_logo = new LogoArea(); notebook_content = new Gtk::Notebook(); widget_status = new StatusWidget(); // Packing this->add(*vbox); vbox->pack_start(hbox_tags, false, false); vbox->pack_start(hbox_files, true, true); vbox->pack_start(*hbox_bottom, false, false); basebox_logo->add(*drawingarea_logo); basebox_no_search_results->add(*label_not_found); hbox_bottom->pack_start(*widget_status, true, true); hbox_bottom->pack_start(*hbuttonbox_bottom, true, true); hbuttonbox_bottom->pack_start(*button_cancel, false, false); hbuttonbox_bottom->pack_start(*button_import, false, false); hbuttonbox_search->pack_start(*button_search, false, false); hbox_tags.pack_start(*entry_search, true, true); hbox_tags.pack_start(*hbuttonbox_search, false, false); hbox_files.pack_start(*notebook_content, true, true); hbox_files.pack_start(*preview_files, true, true); notebook_content->insert_page(*basebox_logo, NOTEBOOK_PAGE_LOGO); notebook_content->insert_page(scrolledwindow_list, NOTEBOOK_PAGE_RESULTS); notebook_content->insert_page(*basebox_no_search_results, NOTEBOOK_PAGE_NOT_FOUND); // Properties set_border_width(12); set_default_size(480, 320); vbox->set_spacing(12); hbuttonbox_bottom->set_spacing(6); hbuttonbox_bottom->set_layout(Gtk::BUTTONBOX_END); button_import->set_sensitive(false); entry_search->set_max_length(255); hbox_tags.set_spacing(6); preview_files->showNoPreview(); notebook_content->set_current_page(NOTEBOOK_PAGE_LOGO); /// Add the listview inside a ScrolledWindow scrolledwindow_list.add(*list_results); scrolledwindow_list.set_shadow_type(Gtk::SHADOW_IN); /// Only show the scrollbars when they are necessary scrolledwindow_list.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledwindow_list.set_size_request(310, 230); drawingarea_logo->set_size_request(310, 230); hbox_files.set_spacing(12); label_not_found->set_line_wrap(true); label_not_found->set_line_wrap_mode(Pango::WRAP_WORD); label_not_found->set_justify(Gtk::JUSTIFY_CENTER); label_not_found->set_size_request(260, -1); notebook_content->set_show_tabs(false); notebook_content->set_show_border(false); // Signals entry_search->signal_activate().connect( sigc::mem_fun(*this, &ImportDialog::on_entry_search_activated)); button_import->signal_clicked().connect( sigc::mem_fun(*this, &ImportDialog::on_button_import_clicked)); button_search->signal_clicked().connect( sigc::mem_fun(*this, &ImportDialog::on_button_search_clicked)); list_results->signal_cursor_changed().connect( sigc::mem_fun(*this, &ImportDialog::on_list_results_cursor_changed)); list_results->signal_row_activated().connect( sigc::mem_fun(*this, &ImportDialog::on_list_results_row_activated)); show_all_children(); entry_search->grab_focus(); } /** * Destructor */ ImportDialog::~ImportDialog() { } /** * Get the file extension type that was selected by the user. Valid after an [OK] */ Inkscape::Extension::Extension * ImportDialog::get_selection_type() { return extension; } ImportDialog::type_signal_response ImportDialog::signal_response() { return m_signal_response; } } //namespace OCAL } //namespace Dialog } //namespace UI } //namespace Inkscape /* Local Variables: mode:c++ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :