All pastes #331143 Raw Edit

Mine

public text v1 · immutable
#331143 ·published 2007-01-28 16:25 UTC
rendered paste body
<?php

class CC_Phototagedit extends GtkDialog{

	protected $cat_combo;
	protected $tag_input;

	public function __construct(){
		$hbox = new gtkhbox();
		$vbox1 = new gtkvbox();
		$label1 = new Gtklabel('Catagorys :');
		$model = new GtkListStore(Gtk::TYPE_STRING);
		$this->cat_combo->set_model($model);
		$this->cat_combo = new GtkCellRendererText();
		$this->cat_combo->pack_start($cellRenderer);
		$this->cat_combo->set_attributes($cellRenderer, 'text', 0);
		// $cats = db func
		foreach($cats as $cat) {
			$model->append(array($cat));
		}
		$vbox1->pack_start($label1);
		$vbox1->pack_start($this->cat_combo);
		$vbox2 = new gtkvbox();
		$label2 = new gtklabel("Tag :");
		$this->tag_input = new gtkentry();
		$vbox2->pack_start($label2);
		$vbox2->pack_start($this->tag_input);
		$vbox3 = new gtkvbox();
		$but_add = new GtkButton('Add tag');
		$but_cancel = new GtkButton('Cancel');
		$vbox3->pack_start($but_add);
		$vbox3->pack_start($but_cancel);
		$hbox->pack_start($vbox1);
		$hbox->pack_start($vbox2);
		$hbox->pack_start($vbox3);
		$this->add($hbox);
		$but_add->connect_simple('clicked',array($this,'on_add'));
		$but_cancel->connect_simple('clicked',array($this,'on_quit'));
	}

	public function on_add(){
		$model = $this->cat_combo->get_model();
    	$cat = $model->get_value($combobox->get_active_iter(), 0);
    	$tag = $this->tag_input->get_text();
    	// add tag db code
	}
	
	public function on_quit(){
		$this->destroy();
	}

}

?>