Example #1
0
File: error3.C Project: 0day-ci/gcc
void MainWindow::update_status(Result result) {
    switch (result) {
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("green")); // { dg-error "" }
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("red")); // { dg-error "" }
        status_label.set_text("Out of memory");
    }
}
Example #2
0
static void fillText(Glib::RefPtr<Gtk::Builder> &builder)
{
	//Denne funktion ændrer de labels der viser timerne
	//Kaldes når der sker en ændring i ugevælgeren

	//Specificerer startugen i ugevælgermenuen og henter valget af uge
	int startWeek = 17;
	int weekNr = box->get_active_row_number() + startWeek;

	//Tidselement, bruges til at lave datoerne fra ugenummer
	time_t timeElement = ConnectionHelper::getWeek(weekNr);
	struct tm* timeInfo = localtime(&timeElement);

	//navnet på klassen som eleven går er den sidste del af loginnavnet.
	std::string user = connection1.UserName();
	char Class = user[4];

	//Giver hash_maps værdi baseret på funktioner. De bruges til at få dataen modtaget fra serven til at se mere læselig ud
	std::hash_map<int, std::string> weekDays = ConnectionHelper::mapper();
	std::hash_map<std::string, std::string> teachers = ConnectionHelper::teacherMapper(Class);
	std::hash_map<std::string, std::string> classTranslations = ConnectionHelper::transMapper();

	//Hovededelen af funktionen, den giver labelsene værdi én efter én, baseret på serveren.
	for(int i = 1; i < 8; i++)
	{
		//Element der indeholder den nuværende dato, for at kunne sende den med til serveren.
		std::string dateElement = ConnectionHelper::toMySQLDate(timeInfo->tm_mon+1, timeInfo->tm_mday);

		//Den vector der indeholder al dataen modtaget fra MySQL serveren.
		std::vector<std::string> currentDay = connection1.getDay(user, dateElement);

		for(int j = 1; j < 5; j++)
		{
			//De labels der viser dataen har navn efter ugedagen og hvilket nummer time det er.
			//Eks: den første time mandag hedder "mon1", den trejde torsdag hedder "thu3" ol.
			std::string widgetName = weekDays[i] + ConnectionHelper::intToString(j);

			//Henter labelen ned i en pointer.
			Gtk::Label *texts = 0;
			builder->get_widget(widgetName, texts);

			//Definerer stringen der bliver loadet over i labelen.
			std::string label = classTranslations[currentDay[j-1]];
			label.append("\n");
			label.append(teachers[currentDay[j-1]]);
			label.append("\n");
			if(currentDay[j-1] == "" || currentDay[j-1] == "NULL")
				label.append("");
			else
				label.append("14");

			//Sætter teksten i labelen, baseret på pointeren
			texts->set_justify(Gtk::JUSTIFY_CENTER);
			texts->set_text(label);
		}
		//Tilføjer en dag til tidselementet, og geninitialiserer dataen i elementet (Så der ikke bliver 32 dage på en måned, og lign)
		timeInfo->tm_mday++;
		mktime(timeInfo);
	}
}
Example #3
0
void on_mousemove(void* user, double i)
{
	EQControl* c = (EQControl*)user;
	double freq = scale_freq(i / c->datalen) * srate / 2.0;
	Gtk::Label* l;
	b->get_widget("label1", l);
	l->set_text(CONCAT((UInt)freq << " Hz").c_str());
}
Example #4
0
 void outputFileChooserDialogOKButtonClicked()
 {
     Gtk::Label* outputFileDisplayLabel;
     builder->get_widget("outputFileDisplayLabel", outputFileDisplayLabel);
     outputFilePath = outputFileChooserDialog->get_filename();
     outputFileChooserDialog->hide();
     outputFileDisplayLabel->set_text(outputFilePath);
 }
Example #5
0
 void MainWindow::constructScale(Gtk::Container &parentContainer, Gtk::Scale &scale, Gtk::Label &label, const std::string &name) {
   label.set_text(name + ":");
   parentContainer.add(label);
   scale.set_adjustment(Gtk::Adjustment::create(1.0, -10000.0, 150000.0, 10.0, 1.0));
   scale.set_digits(4);
   scale.set_size_request(100);
   scale.signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::on_scale_value_changed));
   parentContainer.add(scale);
 }
Example #6
0
 DialogWin() {
   Gtk::FileChooserDialog diag( "ファイル選択", Gtk::FILE_CHOOSER_ACTION_OPEN );
   // 開く、キャンセルボタン
   diag.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
   diag.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   switch( diag.run() ){
   case Gtk::RESPONSE_OK:
     m_label.set_text( diag.get_filename() );
     strncpy(WaveFileName, (diag.get_filename()).c_str(), (diag.get_filename()).size());
     break;
   case Gtk::RESPONSE_CANCEL:
     m_label.set_text( "Cancel" );
     //strncpy(WaveFileName, m_filename.c_str(), m_filename.size());
     break;
   }
   add( m_label );
   show_all_children();
   resize( 200, 100 );  
 };
Example #7
0
void Gobby::PreferencesDialog::Security::set_file_error(Gtk::Label& label,
                                                        const GError* error)
{
	if(error != NULL)
	{
		label.set_text(Glib::ustring::compose(
			_("Error reading file: %1"), error->message));
		label.show();
	}
	else
	{
		label.hide();
	}
}
Example #8
0
int DialogBoxFactory::showCloseProjectDialog(bool HasToBeSaved)
{
  Gtk::Dialog Dialog(_("Close project?"));

  Gtk::Label Label;

  Gtk::HBox MainBox;
  Gtk::Image Image(Gtk::Stock::DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG);
  MainBox.pack_start(Image, Gtk::PACK_SHRINK, 10);
  MainBox.pack_start(Label, Gtk::PACK_SHRINK, 10);

  Dialog.get_vbox()->pack_start(MainBox, false, false, 10);

  Dialog.add_button(Gtk::Stock::CANCEL, 0);

  if (HasToBeSaved)
  {
    Label.set_text(_("Do you want to save this project before closing?"));
    Dialog.add_button(_("Close project without saving"), 1);
    Dialog.add_button(_("Save and close project"), 2);
    Dialog.set_default_response(2);
  } else
  {
    Label.set_text(_("Are you sure you want to close this project?"));
    Dialog.add_button(Gtk::Stock::OK, 1);
    Dialog.set_default_response(1);
  }

  Dialog.show_all_children();

  int Res = Dialog.run();

  if (Res == Gtk::RESPONSE_DELETE_EVENT)
    Res = 0;

  return Res;
}
Example #9
0
void listView() {
	///Hide/show items for viewing the board list
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(true);
	boardlist->show();
	
	gtk_widget_destroy(GTK_WIDGET(pWebKitView));
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(false);
	threadview->hide();
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton3", boardback);
	boardback->set_visible(false);
	boardback->hide();
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text("Boards");
	
	Gtk::ToolItem *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(false);
	refresh1->hide();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(false);
	refresh2->hide();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(false);

	Gtk::Grid *post_grid;
	builder->get_widget("grid1", post_grid);
	post_grid->set_visible(false);
	post_grid->hide();
	
	Gtk::ToggleToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(false);
	post_but->hide();
	post_but->set_active(false);
}
Example #10
0
void DamageWindow::on_show()
{
	Gtk::Dialog::on_show();
	
	f_spinConnection = f_spinButton->signal_value_changed().connect( sigc::mem_fun( *this, &DamageWindow::OnValueChanged ) );
	
	Gtk::SpinButton* sp;
	f_table.GetItem( DamageHealth, sp );
	set_focus( *sp );

	Gtk::Label* charLabel;
	Gtk::Label* hpLabel;
	Gtk::Label* tempHpLabel;
	f_table.GetItem( Name     , charLabel   );
	f_table.GetItem( HitPoints, hpLabel     );
	f_table.GetItem( TempHP   , tempHpLabel );

	if( f_character == 0 )
	{
		charLabel  ->set_text( gettext("Multiple Characters Selected!") );
		hpLabel    ->set_text( " " );
		tempHpLabel->set_text( " " );
	}
	else
	{
		charLabel->set_text( f_character->name().c_str() );

		const int BUFLEN = 128;
		char buf[BUFLEN+1];
		snprintf( buf, BUFLEN, "<b>%d</b>", f_character->hitpoints() );
		hpLabel->set_markup( buf );
		//
		snprintf( buf, BUFLEN, "<b>%d</b>", f_character->tempHP() );
		tempHpLabel->set_markup( buf );
	}
}
Example #11
0
void VRGuiVectorEntry::init(string placeholder, string label,  sigc::slot<void, OSG::Vec3f&> sig) {
    Gtk::Fixed* ph;
    VRGuiBuilder()->get_widget(placeholder.c_str(), ph);
    Gtk::Container* frame = ph->get_parent();
    frame->remove(*ph);

    Gtk::HBox* hb = new Gtk::HBox();
    frame->add(*hb);

    Gtk::Label* lbl = new Gtk::Label();
    lbl->set_text(label.c_str());
    lbl->set_size_request(50, -1);

    ex = new Gtk::Entry();
    ey = new Gtk::Entry();
    ez = new Gtk::Entry();
    ex->set_has_frame(false);
    ey->set_has_frame(false);
    ez->set_has_frame(false);
    ex->set_size_request(50, -1);
    ey->set_size_request(50, -1);
    ez->set_size_request(50, -1);

    Gtk::VSeparator *s1, *s2, *s3;
    s1 = new Gtk::VSeparator();
    s2 = new Gtk::VSeparator();
    s3 = new Gtk::VSeparator();

    hb->pack_start(*lbl, false, false, 2);
    hb->pack_start(*s1, false, false, 0);
    hb->pack_start(*ex, false, false, 0);
    hb->pack_start(*s2, false, false, 0);
    hb->pack_start(*ey, false, false, 0);
    hb->pack_start(*s3, false, false, 0);
    hb->pack_start(*ez, false, false, 0);
    frame->show_all();

    sigc::slot<bool,GdkEventFocus*> sif = sigc::bind(&VRGuiVectorEntry::proxy, sig, ex, ey, ez);
    ex->signal_focus_out_event().connect( sif );
    ey->signal_focus_out_event().connect( sif );
    ez->signal_focus_out_event().connect( sif );

    sigc::slot<bool> sia_b = sigc::bind<GdkEventFocus*>(&VRGuiVectorEntry::proxy, 0, sig, ex, ey, ez);
    sigc::slot<void> sia = sigc::hide_return( sia_b );
    ex->signal_activate().connect(sia);
    ey->signal_activate().connect(sia);
    ez->signal_activate().connect(sia);
}
Example #12
0
 void update_temp (double value)
 {
   gchar *tmp = g_strdup_printf ("%3g", value);
   m_temp->set_text(tmp);
 }
Example #13
0
void Window::vUpdateGameSlots()
{
    if (m_eCartridge == CartridgeNone) {
        std::string sDateTime = _("----/--/-- --:--:--");

        for (int i = 0; i < 10; i++) {
            char csPrefix[10];
            snprintf(csPrefix, sizeof(csPrefix), "%2d ", i + 1);

            Gtk::Label* poLabel;
            poLabel = dynamic_cast<Gtk::Label*>(m_apoLoadGameItem[i]->get_child());
            poLabel->set_text(csPrefix + sDateTime);
            m_apoLoadGameItem[i]->set_sensitive(false);

            poLabel = dynamic_cast<Gtk::Label*>(m_apoSaveGameItem[i]->get_child());
            poLabel->set_text(csPrefix + sDateTime);
            m_apoSaveGameItem[i]->set_sensitive(false);

            m_astGameSlot[i].m_bEmpty = true;
        }
    } else {
        std::string sFileBase;
        std::string sDir = m_poDirConfig->sGetKey("saves");
        if (sDir == "") {
            sDir = m_sUserDataDir;
        }

        sFileBase = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile));

        const char* csDateFormat = _("%Y/%m/%d %H:%M:%S");

        for (int i = 0; i < 10; i++) {
            char csPrefix[10];
            snprintf(csPrefix, sizeof(csPrefix), "%2d ", i + 1);

            char csSlot[10];
            snprintf(csSlot, sizeof(csSlot), "%d", i + 1);
            m_astGameSlot[i].m_sFile = sFileBase + csSlot + ".sgm";

            std::string sDateTime;
            struct stat stStat;
            if (stat(m_astGameSlot[i].m_sFile.c_str(), &stStat) == -1) {
                sDateTime = _("----/--/-- --:--:--");
                m_astGameSlot[i].m_bEmpty = true;
            } else {
                char csDateTime[30];
                strftime(csDateTime, sizeof(csDateTime), csDateFormat,
                    localtime(&stStat.st_mtime));
                sDateTime = csDateTime;
                m_astGameSlot[i].m_bEmpty = false;
                m_astGameSlot[i].m_uiTime = stStat.st_mtime;
            }

            Gtk::Label* poLabel;
            poLabel = dynamic_cast<Gtk::Label*>(m_apoLoadGameItem[i]->get_child());
            poLabel->set_text(csPrefix + sDateTime);
            m_apoLoadGameItem[i]->set_sensitive(!m_astGameSlot[i].m_bEmpty);

            poLabel = dynamic_cast<Gtk::Label*>(m_apoSaveGameItem[i]->get_child());
            poLabel->set_text(csPrefix + sDateTime);
            m_apoSaveGameItem[i]->set_sensitive();
        }
    }
}
 void setValueText(Glib::ustring ValueText)
 {
   mp_Value->set_text(ValueText);
 }
Example #15
0
void threadView() {
	///Hide or show widgets for viewing a thread
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(false);
	boardlist->hide();
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(true);
	threadview->show();
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton4", boardback);
	boardback->set_visible(true);
	boardback->show();
	
	Gtk::ToolItem *listback = 0;
	builder->get_widget("toolbutton3", listback);
	listback->set_visible(false);
	listback->hide();
	
	Gtk::Button* button;
	builder->get_widget("button2", button);
	button->signal_clicked().connect(sigc::ptr_fun(&on_thread_back_clicked));
	button->set_visible(true);
	button->show();
	
	Gtk::ScrolledWindow *threadlist = 0;
	builder->get_widget("scrolledwindow2", threadlist);
	threadlist->set_visible(false);
	threadlist->hide();
	
	Gtk::ScrolledWindow *postlist = 0;
	builder->get_widget("scrolledwindow4", postlist);
	postlist->set_visible(true);
	postlist->show();
	postlist->get_vadjustment()->set_value(0);
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text("#"+THREAD+" - "+BOARD+" - "+LONGBOARD);
	
	Gtk::ToolItem *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(false);
	refresh1->hide();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(true);
	refresh2->show();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(true);
	
	Gtk::ToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(true);
	post_but->show();
}
Example #16
0
void boardView(bool destroy=true) {
	///Show/hide widgets for viewing all of the threads on a board
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(false);
	boardlist->hide();
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(true);
	threadview->show();
	
	if(INIT) { //To be run only the first time a board is viewed
		Gtk::Window *window = 0;
		builder->get_widget("window1", window);
		int w = 0;
		int h = 0;
		window->get_size(w, h);
		threadview->set_position((1-2/(1+sqrt(5)))*w);
		
		Gtk::TextView *view = 0;
		builder->get_widget("textview1", view);
		GtkSpellChecker* spell = gtk_spell_checker_new ();
		gtk_spell_checker_set_language (spell, setlocale(LC_ALL,NULL), NULL);
		gtk_spell_checker_attach (spell, GTK_TEXT_VIEW (view->gobj()));
		
		INIT = false;
	}
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton3", boardback);
	boardback->set_visible(true);
	boardback->show();
	
	Gtk::ToolItem *threadback = 0;
	builder->get_widget("toolbutton4", threadback);
	threadback->set_visible(false);
	threadback->hide();
	
	Gtk::Button* button;
	builder->get_widget("button1", button);
	button->signal_clicked().connect(sigc::ptr_fun(&on_board_back_clicked));
	button->set_visible(true);
	button->show();
	
	Gtk::ScrolledWindow *threadlist = 0;
	builder->get_widget("scrolledwindow2", threadlist);
	threadlist->set_visible(true);
	threadlist->show();
	
	Gtk::ScrolledWindow *postlist = 0;
	builder->get_widget("scrolledwindow4", postlist);
	postlist->set_visible(false);
	postlist->hide();
	
	Gtk::ScrolledWindow *webview = 0;
	builder->get_widget("scrolledwindow3", webview);
	webview->set_visible(true);
	webview->show();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton5", refresh);
	refresh->set_visible(true);
	refresh->show();
	
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text(BOARD+" - "+LONGBOARD);
	
	Gtk::ToolButton *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(true);
	refresh1->show();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(false);
	refresh2->hide();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(false);
	
	Gtk::ToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(true);
	post_but->show();
}
//------------------------------------------------------------------------------
void DbMySQLTableEditorFKPage::update_fk_details()
{
  ::bec::FKConstraintListBE        *fk_be         = _be->get_fks();
  fk_be->refresh();

  ::bec::FKConstraintColumnsListBE *fk_columns_be = fk_be->get_columns();
  fk_columns_be->refresh();
  
  std::string text;
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::OnUpdate, text);
  set_selected_combo_item(_fk_update_combo, text);

  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::OnDelete, text);
  set_selected_combo_item(_fk_delete_combo, text);
  
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::Comment, text);
  Gtk::TextView *fk_comment(0);
  _xml->get_widget("fk_comment", fk_comment);
  fk_comment->get_buffer()->set_text(text);

  Gtk::Label *label;
  _xml->get_widget("fk_index_name", label);
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::Index, text);
  else
    text = "";
  label->set_text(text);

  ssize_t model_only= 0;
  if (_fk_node.is_valid())
    fk_be->get_field(_fk_node, ::bec::FKConstraintListBE::ModelOnly, model_only);
  _fk_model_only->set_active(model_only!=0);

  // Update columns
  _fk_columns_tv->unset_model();
  if ( fk_columns_be->count() >= 1 && _fk_node.is_valid() && _fk_node.back() < _be->get_fks()->real_count())
  {
    _fk_columns_tv->remove_all_columns();
  
    _fk_columns_model = ListModelWrapper::create(fk_columns_be, _fk_columns_tv, "FKColumnsModel");
    
    _fk_columns_model->model().append_check_column(bec::FKConstraintColumnsListBE::Enabled, "", EDITABLE);
    _fk_columns_model->model().append_string_column(bec::FKConstraintColumnsListBE::Column, "Column", RO, NO_ICON);
    const std::vector<std::string> list;
    _fk_columns_model->model().append_combo_column(::bec::FKConstraintColumnsListBE::RefColumn
                                                   ,"Referenced Column"
                                                   ,model_from_string_list(list)
                                                   ,EDITABLE
                                                   ,true);

    _fk_columns_tv->set_model(_fk_columns_model);
    
    // Connect signal so we can fill referenced columns combobox cell with correct values
    _fkcol_cell_edit_conn.disconnect();
    Gtk::CellRendererCombo* rend = static_cast<Gtk::CellRendererCombo*>(_fk_columns_tv->get_column_cell_renderer(2));
    if ( rend )
    {
    _fkcol_cell_edit_conn = rend->signal_editing_started().
                             connect(sigc::mem_fun(this, &DbMySQLTableEditorFKPage::fkcol_cell_editing_started)
                            );
    }
    else
        g_message("REND is 0!");

    _fk_update_combo->set_sensitive(true);
    _fk_delete_combo->set_sensitive(true);
    fk_comment->set_sensitive(true);
    _fk_model_only->set_sensitive(true);
  }
  else
  {
    _fk_update_combo->set_sensitive(false);
    _fk_delete_combo->set_sensitive(false);
    fk_comment->set_sensitive(false);
    _fk_model_only->set_sensitive(false);
  }
}
void dialog::operate(Image* imag,int i,Gtk::Image *m_image1,int imagestatus1,Gtk::Label* pixlabel)
{
    label=pixlabel;
    im=imag;
    imagestatus=imagestatus1;
    if(imagestatus)
    {
        m_image=m_image1;
    }
    set_default_size(500, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    add(*vbox);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    vbox->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label());
    grid->attach(*label,0,0,2,1);
    Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
    grid->attach(*bvalue, 2, 0, 2, 1);

    Gtk::Button *rotatec = Gtk::manage(new Gtk::Button("Rotate Clockwise 90"));
    Gtk::Button *rotatea = Gtk::manage(new Gtk::Button("Rotate AntiClockwise 90"));
    rotatec->signal_clicked().connect(sigc::mem_fun(*this,&dialog::on_click_rotatec_button));
    rotatea->signal_clicked().connect(sigc::mem_fun(*this,&dialog::on_click_rotatea_button));

    switch(i)
    {
        case 1: set_title("Give Brightness Value between -255 and 255");
                label->set_text("Brightness Value Change By : ");
                bvalue->set_text("10");
                bvalue->set_max_length(4);
                break;
        case 2: set_title("Give index value for blur between 1 and 20");
                label->set_text("Index value of blur :                    ");
                bvalue->set_text("10");
                bvalue->set_max_length(2);
                break;
        case 3: set_title("Give Rotation Angle Value between -360 and 360");
                label->set_text("Rotate Image By (in degrees) :                                   ");
                bvalue->set_text("30");
                bvalue->set_max_length(9);
                grid->attach(*rotatec, 1 ,1, 1, 1);
                grid->attach(*rotatea, 0 ,1, 1, 1);
                break;
        case 4: set_title("Give number of colours between 4 and 16");
                label->set_text("No. of colours in poster :          ");
                bvalue->set_text("4");
                bvalue->set_max_length(2);
                break;
    }
    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok_click), bvalue,i));
    grid->attach(*bok, 2, 2, 1, 1);

    show_all_children();
}
Example #19
0
void profile_selection::set_accounts(const std::vector<std::string>& accounts) {
    utils::debug::scope_log log(DBG_LVL_1("gtox"), {});
    m_accounts = accounts;

    Glib::ustring tox_name;
    Glib::ustring tox_status;
    toxmm::contactAddrPublic tox_addr;

    for (auto acc : accounts) {
        int tox_error = 0;
        bool can_write = false;

        //TRY TO LOAD TOX DATA
        try {
            toxmm::core::try_load(acc, tox_name, tox_status, tox_addr, can_write);
            if (tox_name.empty()) {
                tox_name = tox_addr;
            }
        } catch (toxmm::exception exception) {
            if (exception.type() == typeid(TOX_ERR_NEW)) {
                switch (exception.what_id()) {
                    case TOX_ERR_NEW_LOAD_BAD_FORMAT:
                        tox_error = 1;
                        break;
                    case TOX_ERR_NEW_LOAD_ENCRYPTED:
                        tox_error = 2;
                        break;
                    default:
                        tox_error = 3;
                        break;
                }
            } else {
                tox_error = 3;
            }
        } catch (std::exception exp) {
            std::cerr << "Couldn't load profile \"" + acc + "\"" << std::endl;
            std::cerr << exp.what() << std::endl;
            tox_error = 3;
        } catch (...) {
            std::cerr << "Couldn't load profile \"" + acc + "\"" << std::endl;
            std::cerr << "Unexpected error" << std::endl;
            tox_error = 3;
        }

        utils::debug::scope_log log(DBG_LVL_2("gtox"), {});
        utils::builder builder = Gtk::Builder::create_from_resource("/org/gtox/ui/list_item_profile.ui");
        Gtk::ListBoxRow* row = nullptr;
        builder->get_widget("pofile_list_item", row);
        if (row) {
            Gtk::Label* name = nullptr;
            Gtk::Label* status = nullptr;
            Gtk::Label* path = nullptr;
            builder.get_widget("name", name);
            builder.get_widget("status", status);
            builder.get_widget("path", path);
            builder.get_widget_derived<widget::avatar>("avatar", tox_addr);

            path->set_text(acc);
            row->set_sensitive(false);
            switch (tox_error) {
                case 0:
                    name->set_text(tox_name);
                    status->set_text(tox_status);
                    if (can_write) {
                        row->set_sensitive(true);
                    }
                    break;
                case 1:
                    name->set_text(_("Corrupted profile"));
                    status->set_text(_("Profile couldn't be loaded"));
                    break;
                case 2:
                    name->set_text(_("Encrypted profile"));
                    status->set_text(_("Profile couldn't be loaded"));
                    break;
                default:
                    name->set_text(_("Profile not loaded for an unknown reason"));
                    status->set_text(_("Profile couldn't be loaded"));
                    break;
            }

            //reveale profil
            Gtk::Revealer* revealer;
            builder.get_widget("revealer", revealer);
            revealer->set_reveal_child(true);

            row->show();
            m_profile_list->add(*row);
        }
    }

    m_revealer->set_reveal_child(false);
}