示例#1
0
 Notebook::Ptr NotebookManager::prompt_create_new_notebook(Gtk::Window *parent,
                                                           const Note::List & notesToAdd)
 {
   // Prompt the user for the name of a new notebook
   CreateNotebookDialog dialog(parent,
                               (GtkDialogFlags)(GTK_DIALOG_MODAL
                                                | GTK_DIALOG_DESTROY_WITH_PARENT));
   
   
   int response = dialog.run ();
   std::string notebookName = dialog.get_notebook_name();
   if (response != Gtk::RESPONSE_OK)
     return Notebook::Ptr();
   
   Notebook::Ptr notebook = obj().get_or_create_notebook (notebookName);
   if (!notebook) {
     DBG_OUT ("Could not create notebook: %s", notebookName.c_str());
   } 
   else {
     DBG_OUT ("Created the notebook: %s (%s)", notebook->get_name().c_str(),
              notebook->get_normalized_name().c_str());
     
     if (!notesToAdd.empty()) {
       // Move all the specified notesToAdd into the new notebook
       for(Note::List::const_iterator iter = notesToAdd.begin();
           iter != notesToAdd.end(); ++iter) {
         obj().move_note_to_notebook (*iter, notebook);
       }
     }
   }
   
   return notebook;
 }
示例#2
0
 void NotebookNoteAddin::update_notebook_button_label(const Notebook::Ptr & notebook)
 {
   std::string labelText = (notebook ? notebook->get_name() : _("Notebook"));
   
   m_label_widget->set_text(labelText);
   m_toolButton->show_all();
 }
示例#3
0
 NotebookNewNoteMenuItem::NotebookNewNoteMenuItem(const Notebook::Ptr & notebook)
   // TRANSLATORS: %1%: boost format placeholder for the notebook name
   : Gtk::ImageMenuItem(str(boost::format(_("New \"%1%\" Note")) % notebook->get_name()))
   , m_notebook(notebook)
 {
   set_image(*manage(new Gtk::Image(IconManager::obj().get_icon(IconManager::NOTE_NEW, 16))));
   signal_activate().connect(sigc::mem_fun(*this, &NotebookNewNoteMenuItem::on_activated));
 }