Пример #1
0
int main(int argc, char** argv)
{
  Glib::thread_init();

  try
  {
    Gtk::Main kit(argc, argv);

#ifdef GLIBMM_EXCEPTIONS_ENABLED
    Glib::RefPtr<Gtk::Builder> builder =
      Gtk::Builder::create_from_file(RESDIR"/guis/yuv_viewer/yuv_viewer.ui");
#else
    Glib::RefPtr<Gtk::BuilderError> error;
    Glib::RefPtr<Gtk::Builder> builder =
      Gtk::Builder::create(RESDIR"/guis/yuv_viewer/yuv_viewer.ui", error);
    if (error.get()) {
      throw fawkes::Exception("Failed to load UI file: %s", error->what().c_str());
    }
#endif

    YuvViewerGtkWindow *window = NULL;
    builder->get_widget_derived("wndMain", window);

    kit.run( *window );

    delete window;
  }
  catch (std::exception const& e)
  {
    std::cerr << "Error: " << e.what() << std::endl;
  }

  return 0;
}
Пример #2
0
bool jobManWindow::loadConfBool(Glib::RefPtr<Gnome::Conf::Client> &gConfClient, const Glib::ustring &windowConfPath,
		const Glib::ustring &keyName) {
	Glib::ustring key(windowConfPath);
	Gnome::Conf::Value value;
	bool returnValue = 0;

	key.append(keyName);
	value = gConfClient->get(key);
	if (value.get_type() != Gnome::Conf::VALUE_INVALID) {
		returnValue = value.get_bool();
	} else {
		positionValid = false;
	}
	return returnValue;
}
Пример #3
0
  void PrintNotesNoteAddin::print_button_clicked(const Glib::VariantBase&)
  {
    try {
      m_print_op = Gtk::PrintOperation::create();
      m_print_op->set_job_name(get_note()->get_title());

      Glib::RefPtr<Gtk::PrintSettings> settings = Gtk::PrintSettings::create();

      Glib::ustring dir = Glib::get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
      if (dir.empty()) {
        dir = Glib::get_home_dir();
      }
      Glib::ustring ext;
      if (settings->get(Gtk::PrintSettings::Keys::OUTPUT_FILE_FORMAT) == "ps") {
        ext = ".ps";
      }
      else {
        ext = ".pdf";
      }

      Glib::ustring uri = "file://";
      uri += dir + "/gnotes" + ext;
      settings->set (Gtk::PrintSettings::Keys::OUTPUT_URI, uri);
      m_print_op->set_print_settings (settings);

      m_print_op->signal_begin_print().connect(
        sigc::mem_fun(*this, &PrintNotesNoteAddin::on_begin_print));
      m_print_op->signal_draw_page().connect(
        sigc::mem_fun(*this, &PrintNotesNoteAddin::on_draw_page));
      m_print_op->signal_end_print().connect(
        sigc::mem_fun(*this, &PrintNotesNoteAddin::on_end_print));

      m_print_op->run(Gtk::PRINT_OPERATION_ACTION_PRINT_DIALOG, *get_host_window());
    } 
    catch (const sharp::Exception & e) 
    {
      DBG_OUT("Exception while printing %s: %s", get_note()->get_title().c_str(),
              e.what());
      gnote::utils::HIGMessageDialog dlg(get_host_window(),
                                         GTK_DIALOG_MODAL,
                                         Gtk::MESSAGE_ERROR,
                                         Gtk::BUTTONS_OK,
                                         _("Error printing note"),
                                         e.what());
      dlg.run ();
    }
    m_print_op.clear(); // yeah I really mean clear the pointer.
  }