Esempio n. 1
0
HGTalkWindow::HGTalkWindow()
{
	int w, h;

	// set default size
	// height = screen height * 80%, width = height * 45%
	h = (int)Gdk::Screen::get_default()->get_height() * 0.80;
	w = (int)h * 0.45;
	set_default_size(w, h);

	set_title(HGTALK_WINDOW_TITLE);
	set_position(Gtk::WIN_POS_CENTER);
	set_icon_from_file(HGTALK_ICON_48);
	set_border_width(2);
	set_keep_above(TRUE);

	HGTalkLoginBox * pHGTalkLoginBox = 
		Gtk::manage(new HGTalkLoginBox);
	add(*pHGTalkLoginBox);

	signal_login_ok.connect(sigc::mem_fun(this, &HGTalkWindow::on_login_ok));
	signal_show_hide.connect(sigc::mem_fun(this, &HGTalkWindow::on_show_hide));

	show_all();
}
Esempio n. 2
0
/**
 Constructor.
 */
DialogoRemoto::DialogoRemoto(const string &titulo, ListadoImagenes &li)
{
	listimag = &li;
	numImagSelec = -1;

	set_title(titulo);
	set_icon_from_file(Utiles::getIconoFile("carpeta.png"));
}
/**
 Constructor, establece el tamaño de la ventana, nombre y icono.
 */
InterfazLauncher::InterfazLauncher()
{
	set_title("Govocitos Updater");
	set_default_size(500, 80);
	set_icon_from_file(UtilesLauncher::getIconoFile("logoGovocitos.png"));

	dialogoSelecAct = new DialogoSeleccionAct();
	
	add(*dialogoSelecAct);
}
Esempio n. 4
0
PopWindow::PopWindow(Glib::ustring lab, Glib::ustring msg)
: frame(lab)
{
	set_title("L2::" + lab);
	try {
		set_icon_from_file("src/jping.png");
	} catch (Glib::FileError e) {
		try {
			set_icon_from_file("/usr/local/share/linjap/jping.png");

		} catch (Glib::FileError e) {
		  //set_icon_from_file("/usr/share/linjap/jping.png");
		}
	}
	label.set_text(msg);
	frame.add(label);
	add(frame);
	label.show();
	frame.show();
}
Esempio n. 5
0
SettingsManager::SettingsManager():on_change_settings(this, CBT_CHANGE_SETTINGS) {
	set_title("Settings manager");
	menu.set_size_request(160, 200);

	pFixed.add(props);
	pFixed.signal_size_allocate().connect(sigc::mem_fun(*this, &SettingsManager::props_on_size_allocate));
	pFixed.signal_button_press_event().connect(sigc::mem_fun(props, &PropEditor::on_button_press_event));
	pFixed.signal_button_release_event().connect(sigc::mem_fun(props, &PropEditor::on_button_release_event));
	pFixed.signal_motion_notify_event().connect(sigc::mem_fun(props, &PropEditor::on_motion_notify_event));
	pScroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
	pScroll.add(pFixed);
//	pScroll.set_size_request(300, 200);

	info.set_size_request(100, 40);
	info.set_editable(false);
	info.set_wrap_mode(WRAP_WORD);

	hpaned.pack1(menu, false, false);
	hpaned.pack2(vpaned, true, true);
	vpaned.pack1(pScroll, true, true);
	vpaned.pack2(info, false, false);

	hpaned.show_all();
	get_vbox()->pack_start(hpaned, true, true);

	menuStore = Gtk::ListStore::create(menuColumns);
	menu.set_model(menuStore);
	menu.append_column("icon", menuColumns.icon);
	menu.append_column("name", menuColumns.name);
	menu.set_headers_visible(false);
	menu.signal_cursor_changed().connect(sigc::mem_fun(*this, &SettingsManager::on_show_ep_row_activated));

	add_button(Gtk::Stock::ADD, 4);
	add_button(Gtk::Stock::OPEN, 3);
	add_button(Gtk::Stock::SAVE, 2);
	add_button(Gtk::Stock::OK, 1);

	set_icon_from_file(dataDir + ICONS_PATH + "tools.png");

	void *id = mdb.begin_read_settings(0);
	ParamInfo param;
	while(mdb.read_settings(id, param)) {
		Gtk::TreeRow row = *(menuStore->append());
		row[menuColumns.name] = param.title;
		row[menuColumns.info] = param.info;
		row[menuColumns.icon] = Gdk::Pixbuf::create_from_file(dataDir + ICONS_PATH + param.list + ".png");
		row[menuColumns.id] = param.id;
	}
	mdb.end_read(id);

	props.on_change_property += this;
	props.on_select_property += this;
}
/**
 Constructor.
 */
DialogoBarraProgres::DialogoBarraProgres(const string &titulo): m_VBox(false, 5),
											m_Alignment(0.5, 0.5, 0, 0),
											m_Button_Close("Cancel")
{	
	cancelarProgreso = false;
	set_resizable();
	set_title(titulo);
	set_icon_from_file(Utiles::getIconoFile("descarga.png"));
	m_VBox.set_border_width(10);
	add(m_VBox);
	m_ProgressBar.set_text("0.0 %");
	m_ProgressBar.set_size_request(280,25);
	m_VBox.pack_start(m_Alignment, Gtk::PACK_SHRINK, 5);
	m_Alignment.add(m_ProgressBar);
	
	//Add a button to exit the program.
	m_VBox.pack_start(m_Button_Close, Gtk::PACK_SHRINK);
	m_Button_Close.signal_clicked().connect(sigc::mem_fun(*this,
		        &DialogoBarraProgres::on_button_close) );
	m_Button_Close.set_flags(Gtk::CAN_DEFAULT);
	m_Button_Close.grab_default();

	resize(300,50);
}
Esempio n. 7
0
MainWindow::MainWindow()
{
  set_title("Handle Project");
  set_icon_from_file("images/HaPr_high_80x100_ver2.gif");
  set_size_request(200, 200);
  set_default_size(500, 300);
  set_position(Gtk::WIN_POS_CENTER);
  signal_hide().connect(sigc::mem_fun(*this, &MainWindow::on_action_file_exit));
  Gtk::VBox *const main_box = new Gtk::VBox(false, 0);
  add(*Gtk::manage(main_box));
  create_menu(main_box);
  std::list<Project> active_projects = get_projects_from_db();
  Glib::ustring str_no_proj, str_late_proj, str_history_proj;
  std::stringstream ss, ss2, ss3;
  no_active = active_projects.size();
  ss << no_active;
  ss >> str_no_proj;
  std::list<Project> hist_projects = get_projects_from_db(HISTORY_PROJECT);
  no_history = hist_projects.size();
  ss3 << no_history;
  ss3 >> str_history_proj;
  no_late = 0;
  for(std::list<Project>::iterator it = active_projects.begin(); it != active_projects.end(); it++)
  {
    if(it->is_late())
      no_late++;
  }
  ss2 << no_late;
  ss2 >> str_late_proj;
  
  treeview = new Gtk::TreeView();
  Gtk::manage(treeview);
  scrollview.add(*treeview);
  scrollview.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  treeviewhist = new Gtk::TreeView();
  Gtk::manage(treeviewhist);
  Gtk::ScrolledWindow *scrollhistory = new Gtk::ScrolledWindow();
  Gtk::manage(scrollhistory);
  scrollhistory->add(*treeviewhist);
  scrollhistory->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  tabview = new Gtk::Notebook();
  Gtk::manage(tabview);
  tabview->append_page(scrollview, _("_Active projects"), true);
  tabview->append_page(*scrollhistory, _("P_roject history"), true);
  main_box->pack_start(*tabview);

  //Table for active projects.
  Gtk::TreeModel::ColumnRecord *col_record = new Gtk::TreeModel::ColumnRecord();
  col_id = new Gtk::TreeModelColumn<time_t>();
  col_no = new Gtk::TreeModelColumn<std::string>();
  col_name = new Gtk::TreeModelColumn<std::string>();
  col_desc = new Gtk::TreeModelColumn<std::string>();
  col_leader_name = new Gtk::TreeModelColumn<std::string>();
  col_leader_surname = new Gtk::TreeModelColumn<std::string>();
  col_start_date = new Gtk::TreeModelColumn<std::string>();
  col_end_date = new Gtk::TreeModelColumn<std::string>();

  col_record->add(*col_id);
  col_record->add(*col_no);
  col_record->add(*col_name);
  col_record->add(*col_desc);
  col_record->add(*col_leader_name);
  col_record->add(*col_leader_surname);
  col_record->add(*col_start_date);
  col_record->add(*col_end_date);

  ref_tree_model = Gtk::ListStore::create(*col_record);
  treeview->set_model(ref_tree_model);

  int j = 0;
  Gtk::TreeModel::Row row;
  for(std::list<Project>::iterator it = active_projects.begin(); it != active_projects.end(); it++)
  {
    row = *(ref_tree_model->append());
    row[*col_id] = it->get_id();
    row[*col_no] = it->get_project_no();
    row[*col_name] = it->get_project_name();
    row[*col_desc] = it->get_description();
    row[*col_leader_name] = it->get_project_leader_name();
    row[*col_leader_surname] = it->get_project_leader_surname();
    row[*col_start_date] = it->get_start_date_str_eu();
    row[*col_end_date] = it->get_end_date_str_eu();
    j++;
  }

  treeview->append_column(_("Number"), *col_no);
  treeview->append_column(_("Name"), *col_name);
  treeview->append_column(_("Description"), *col_desc);
  treeview->append_column(_("Leader name"), *col_leader_name);
  treeview->append_column(_("Leader surmane"), *col_leader_surname);
  treeview->append_column(_("Start date"), *col_start_date);
  treeview->append_column(_("End date"), *col_end_date);
  treeview->set_headers_clickable(true);
  treeview->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);

  for(int i=0; i < 7; i++)
  {
    Gtk::TreeView::Column *pColumn = treeview->get_column(i);
    pColumn->set_resizable(true);
    pColumn->set_sort_column(i+1);
  }

  //Table for history.
  Gtk::TreeModel::ColumnRecord *col_record_hist = new Gtk::TreeModel::ColumnRecord();
  col_id_hist = new Gtk::TreeModelColumn<time_t>();
  col_no_hist = new Gtk::TreeModelColumn<std::string>();
  col_desc_hist = new Gtk::TreeModelColumn<std::string>();
  col_name_hist = new Gtk::TreeModelColumn<std::string>();
  col_leader_name_hist = new Gtk::TreeModelColumn<std::string>();
  col_leader_surname_hist = new Gtk::TreeModelColumn<std::string>();
  col_start_date_hist = new Gtk::TreeModelColumn<std::string>();
  col_end_date_hist = new Gtk::TreeModelColumn<std::string>();

  col_record_hist->add(*col_id_hist);
  col_record_hist->add(*col_no_hist);
  col_record_hist->add(*col_name_hist);
  col_record_hist->add(*col_desc_hist);
  col_record_hist->add(*col_leader_name_hist);
  col_record_hist->add(*col_leader_surname_hist);
  col_record_hist->add(*col_start_date_hist);
  col_record_hist->add(*col_end_date_hist);

  ref_tree_model_hist = Gtk::ListStore::create(*col_record_hist);
  treeviewhist->set_model(ref_tree_model_hist);

  Gtk::TreeModel::Row row_hist;
  for(std::list<Project>::iterator it = hist_projects.begin(); it != hist_projects.end(); it++)
  {
    row_hist = *(ref_tree_model_hist->append());
    row_hist[*col_id_hist] = it->get_id();
    row_hist[*col_no_hist] = it->get_project_no();
    row_hist[*col_name_hist] = it->get_project_name();
    row_hist[*col_desc_hist] = it->get_description();
    row_hist[*col_leader_name_hist] = it->get_project_leader_name();
    row_hist[*col_leader_surname_hist] = it->get_project_leader_surname();
    row_hist[*col_start_date_hist] = it->get_start_date_str_eu();
    row_hist[*col_end_date_hist] = it->get_end_date_str_eu();
    j++;
  }

  treeviewhist->append_column(_("Number"), *col_no_hist);
  treeviewhist->append_column(_("Name"), *col_name_hist);
  treeviewhist->append_column(_("Description"), *col_desc_hist);
  treeviewhist->append_column(_("Leader name"), *col_leader_name_hist);
  treeviewhist->append_column(_("Leader surmane"), *col_leader_surname_hist);
  treeviewhist->append_column(_("Start date"), *col_start_date_hist);
  treeviewhist->append_column(_("End date"), *col_end_date_hist);
  treeviewhist->set_headers_clickable(true);
  treeviewhist->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);

  for(int i=0; i < 7; i++)
  {
    Gtk::TreeView::Column *pColumn_hist = treeviewhist->get_column(i);
    pColumn_hist->set_resizable(true);
    pColumn_hist->set_sort_column(i+1);
  }

  Gtk::HBox *const status_box = new Gtk::HBox(false, 0);
  Gtk::manage(status_box);
  active_label = new Gtk::Label(_("Number of active projects: ") +  str_no_proj);
  late_label = new Gtk::Label(_("Number of late projects: ") + str_late_proj);
  history_label = new Gtk::Label(_("Number of projects in history: ") + str_history_proj);
  Gtk::manage(active_label);
  Gtk::manage(late_label);
  Gtk::manage(history_label);
  
  status_box->pack_start(*active_label);
  status_box->pack_start(*late_label);
  status_box->pack_start(*history_label);

  main_box->pack_start(*status_box, Gtk::PACK_SHRINK);
  show_all_children();
}
Esempio n. 8
0
ActivityDialog::ActivityDialog(ActivitiesWindow *parent, Activity *activity)
  : parent(parent), activity(activity)
{
  set_icon_from_file("images/act100x80.gif");
  if(activity)
  {
    Gtk::Dialog(_("Edit activity"), parent);
    set_title(_("Edit activity"));
    std::stringstream ss;
    ss << activity->get_id();
    number_entry.set_text(ss.str());
    name_entry.set_text(activity->get_name());
    
    Glib::RefPtr<Gtk::TextBuffer> text_buffer = desc_area.get_buffer();
    text_buffer->set_text(activity->get_description());
    start_date_entry.set_text(activity->get_start_date_str_eu());
    end_date_entry.set_text(activity->get_end_date_str_eu());
    check_button_finished.set_active(activity->is_finished());
  }
  else
  {
    Gtk::Dialog(_("Edit activity"), parent);
    set_title(_("New activity"));
  }
  set_transient_for(*parent);

  add_button(Gtk::Stock::CANCEL, 2);
  if(activity)
    add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
  else
    add_button(_("Create activity"), Gtk::RESPONSE_OK);

  Gtk::Box *cont_area = get_vbox();
  Gtk::Table main_table(10, 3);
  main_table.set_row_spacings(10);
  cont_area->pack_start(main_table);

  Gtk::Label main_label;
  if(activity)
    main_label.set_text(_("Edit properties for activity:"));
  else
    main_label.set_text(_("Enter properties for new activity:"));
  main_table.attach(main_label, 0, 3, 0, 1);

  Gtk::Label no_label(_("Activity number:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  main_table.attach(no_label, 0, 3, 1, 2);
  main_table.attach(number_entry, 0, 3, 2, 3);

  Gtk::Label name_label(_("Activity name:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  main_table.attach(name_label, 0, 3, 3, 4);
  main_table.attach(name_entry, 0, 3, 4, 5);

  Gtk::Label desc_label(_("Description:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  main_table.attach(desc_label, 0, 3, 5, 6);
  Gtk::ScrolledWindow desc_scroll;
  desc_scroll.add(desc_area);
  desc_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  main_table.attach(desc_scroll, 0, 3, 6, 7);

  Gtk::Label start_date_label(_("Start date:"), Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
  start_date_entry.set_max_length(10);
  start_date_entry.set_width_chars(14);
  Gtk::Button start_cal_button(_("Calendar"));
  start_cal_button.signal_clicked().connect(sigc::mem_fun(*this, &ActivityDialog::on_click_start_calendar));
  main_table.attach(start_date_label, 0, 1, 7, 8);
  main_table.attach(start_date_entry, 1, 2, 7, 8);
  main_table.attach(start_cal_button, 2, 3, 7, 8, Gtk::SHRINK, Gtk::SHRINK);

  Gtk::Label end_date_label(_("End date:"), Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
  end_date_entry.set_max_length(10);
  end_date_entry.set_width_chars(14);
  Gtk::Button end_cal_button(_("Calendar"));
  end_cal_button.signal_clicked().connect(sigc::mem_fun(*this, &ActivityDialog::on_click_end_calendar));
  main_table.attach(end_date_label, 0, 1, 8, 9);
  main_table.attach(end_date_entry, 1, 2, 8, 9);
  main_table.attach(end_cal_button, 2, 3, 8, 9, Gtk::SHRINK, Gtk::SHRINK);

  check_button_finished.set_label(_("Activity finished"));
  main_table.attach(check_button_finished, 1, 3, 9, 10);

  show_all_children();
  while(true)
  {
    int result = run();
    if(result == Gtk::RESPONSE_OK)
    {
      Glib::ustring error_msg;
      if(name_entry.get_text().size() == 0)
	error_msg = _("Activity must have a name.\n");
      if(start_date_entry.get_text().size() == 0)
	error_msg += _("Activity must have a start date.\n");
      if(end_date_entry.get_text().size() == 0)
	error_msg += _("Activity must have an end date.");
      if(error_msg.size() > 0)
      {
	  Gtk::MessageDialog message(error_msg, false, Gtk::MESSAGE_ERROR);
	  message.set_icon_from_file("images/HaPr_high_80x100_ver2.gif");
	  message.run();
      }
      else
      {
	Activity newa;
	newa.set_number(number_entry.get_text());
	newa.set_name(name_entry.get_text());
	Glib::RefPtr<Gtk::TextBuffer> desc_buffer = desc_area.get_buffer();
	newa.set_description(desc_buffer->get_text());
	newa.set_start_date(start_date_entry.get_text());
	newa.set_end_date(end_date_entry.get_text());
	newa.set_finished(check_button_finished.get_active());

	if(activity)
	  newa.set_id(activity->get_id());

	parent->add_edit_activity(&newa);
	break;
      }
    }
    else
      break;
  }
}