Revision
60
Author
emsmith
Date
2006-12-04 10:04:13 -0800 (Mon, 04 Dec 2006)

Log Message

GtkToolButton holds a GtkButton - that's where events have to be set - popup context menu now works anywhere on the toolbar, even buttons

Modified Paths

Diff

Modified: desktop/trunk/lib/actions.class.php (59 => 60)


--- desktop/trunk/lib/actions.class.php	2006-12-04 15:35:36 UTC (rev 59)
+++ desktop/trunk/lib/actions.class.php	2006-12-04 18:04:13 UTC (rev 60)
@@ -113,6 +113,7 @@
 		$tips = CC_Tooltips::instance();
 		$action = $this->get_action($group, $action);
 		$widget = $action->create_tool_item();
+		$widget->set_use_underline(TRUE);
 		$tips->set_tip($widget, $action->get_property('tooltip'));
 		return $widget;
 	}

Modified: desktop/trunk/lib/toolbar.class.php (59 => 60)


--- desktop/trunk/lib/toolbar.class.php	2006-12-04 15:35:36 UTC (rev 59)
+++ desktop/trunk/lib/toolbar.class.php	2006-12-04 18:04:13 UTC (rev 60)
@@ -148,7 +148,7 @@
 
 		$menu->show_all();
 
-		$this->connect('popup-context-menu', array($this, 'popup'));
+		$this->connect_simple('popup-context-menu', array($this, 'popup'));
 
 		// populate toolbar
 		foreach($toolitems as $item)
@@ -156,15 +156,14 @@
 			if($item === 'separator')
 			{
 				$this->insert($item = new GtkSeparatorToolItem(), -1);
-				//$item->set_events($item->get_events() | Gdk::BUTTON_PRESS_MASK);
-				//$item->connect('popup-menu', array($this, 'popup'));
 			}
 			else
 			{
 				list($group, $name) = explode(':', $item);
 				$this->insert($item = $actions->create_tool_item($group, $name), -1);
-				//$item->set_events($item->get_events() | Gdk::BUTTON_PRESS_MASK);
-				$item->connect('popup-menu', array($this, 'popup'));
+				$item->child->set_events($item->get_events() | Gdk::BUTTON_PRESS_MASK);
+				$item->child->connect('button-press-event', array($this, 'doPopup'));
+				$item->child->connect_simple('popup-menu', array($this, 'popup'));
 			}
 		}
 		return;
@@ -180,6 +179,24 @@
 	public function popup()
 	{
 		$this->menu->popup();
+		return TRUE;
+	}
+
+	/**
+	 * public function doPopup
+	 *
+	 * pops up a popup menu on right click
+	 *
+	 * @param object $window GtkWindow
+	 * @param object $event GdkEvent
+	 * @return void
+	 */
+	public function doPopup($window, $event)
+	{
+		if($event->button == 3)
+		{
+			$this->popup();
+		}
 		return;
 	}