Example #1
0
		/** Handels the event when a new file is selected in the treeview. */
		function on_tvFiles_changed(){
			$sel = treeview_getSelection($this->tv_files);
			if (!$sel){
				return null;
			}
			
			$this->glade->get_widget("tex_replace_from")->set_text($sel[0]);
		}
Example #2
0
	/** NOTE: Since iter_parent() is buggy, we need to do it this idiotic way. */
	function treeview_moveUp($tv){
		$tv_model = $tv->get_model();
		
		if (method_exists($tv_model, "foreach")){ //crashes with new version of PHP-GTK.
			global $treeview_loop_iter_parent, $treeview_loop_current_file, $treeview_loop_set;
			$iter_current = $tv->get_selection()->get_selected();
			
			if ($iter_current){
				$treeview_loop_current_file = $tv_model->get_value($iter_current[1], 0);
				$treeview_loop_set = false;
				$treeview_loop_iter_parent = null;
				$tv_model->foreach("treeview_select_parent_loop", $tv);
				
				if (!$treeview_loop_set){
					$iter = $tv_model->get_iter_first();
					if ($iter){
						$tv->get_selection()->select_iter($iter);
						$path = $tv_model->get_path($iter);
						$tv->scroll_to_cell($path);
					}
				}
			}
		}else{
			//a bit slow way to do it - but since foreach() doesnt exeist and iter_parent() is buggy - this is the only way :'-(
			$all = treeview_getAll($tv);
			$sel = treeview_getSelection($tv);
			
			foreach($all AS $key => $values){
				if ($values["values"][0] == $sel[0] && $values["values"][1] == $sel[1]){
					$iter = $parent_iter;
					$tv->get_selection()->select_iter($iter);
					$path = $tv_model->get_path($iter);
					$tv->scroll_to_cell($path);
					return true;
				}
				
				$parent_iter = $values["iter"];
			}
		}
		
		return true;
	}