[gnote] Stop calculating the status icon menu position by thyself.
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Stop calculating the status icon menu position by thyself.
- Date: Sat, 16 May 2009 02:06:05 -0400 (EDT)
commit 31362f323a57bbe65970ee0898ddc5044ce1a8d5
Author: Hubert Figuiere <hub figuiere net>
Date: Sat May 16 02:02:55 2009 -0400
Stop calculating the status icon menu position by thyself.
---
NEWS | 1 +
src/tray.cpp | 39 +++++----------------------------------
src/tray.hpp | 1 -
src/utils.cpp | 13 ++++---------
src/utils.hpp | 1 -
5 files changed, 10 insertions(+), 45 deletions(-)
diff --git a/NEWS b/NEWS
index b220f9c..c39d342 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Fixes:
* '-' in note title was mistakenly doubled in the menu. (Closes #581643)
* Fix crash when entering an URL instead of a host name for the
bugzilla icon in the bugzilla addin (Closes #581080)
+ * Stop calculating the status icon menu position by thyself.
Translations:
diff --git a/src/tray.cpp b/src/tray.cpp
index 9dbae72..a62469a 100644
--- a/src/tray.cpp
+++ b/src/tray.cpp
@@ -419,9 +419,9 @@ namespace gnote {
if(select_first_item) {
m_tray->tray_menu()->select_first(false);
}
- utils::popup_menu(*m_tray->tray_menu(), NULL,
- sigc::bind(sigc::mem_fun(*this, &TrayIcon::get_tray_menu_pos),
- m_tray->tray_menu()));
+
+ popup_menu_at_position(*m_tray->tray_menu(), 0,
+ gtk_get_current_event_time());
}
TrayIcon::~TrayIcon()
@@ -436,44 +436,15 @@ namespace gnote {
show_menu(false);
}
- void TrayIcon::on_popup_menu(guint button, guint32 /*activate_time*/)
+ void TrayIcon::on_popup_menu(guint button, guint32 activate_time)
{
DBG_OUT("popup");
if(button == 3) {
Gtk::Menu *menu = get_right_click_menu();
- utils::popup_menu(*menu, NULL,
- sigc::bind(sigc::mem_fun(*this, &TrayIcon::get_tray_menu_pos), menu));
+ popup_menu_at_position(*menu, button, activate_time);
}
}
-
- void TrayIcon::get_tray_menu_pos(int & x, int &y, bool & push_in, Gtk::Menu * menu)
- {
- push_in = true;
- x = 0;
- y = 0;
-
-// Glib::RefPtr<Gdk::Screen> screen;
- GdkScreen *cscreen = NULL;
- Gdk::Rectangle area;
- GtkOrientation orientation;
-// using the C++ API seems to crash here on the Gdk::Screen.
-// get_geometry (screen, area, orientation);
- gtk_status_icon_get_geometry(gobj(), &cscreen, area.gobj(), &orientation);
- x = area.get_x();
- y = area.get_y();
-
- Gtk::Requisition menu_req;
- menu->size_request (menu_req);
- if (y + menu_req.height >= gdk_screen_get_height(cscreen)/*screen->get_height()*/) {
- y -= menu_req.height;
- }
- else {
- y += area.get_height();
- }
- DBG_OUT("x = %d, y = %d, push_in = %d", x, y, push_in);
- }
-
Gtk::Menu * TrayIcon::get_right_click_menu()
{
DBG_OUT("get right click menu");
diff --git a/src/tray.hpp b/src/tray.hpp
index c13a5ca..67227f5 100644
--- a/src/tray.hpp
+++ b/src/tray.hpp
@@ -105,7 +105,6 @@ public:
void show_menu(bool select_first_item);
- void get_tray_menu_pos(int & x, int &y, bool & push_in, Gtk::Menu *);
Gtk::Menu * get_right_click_menu();
void on_activate();
diff --git a/src/utils.cpp b/src/utils.cpp
index aaeaea4..6dd96d1 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -88,18 +88,13 @@ namespace gnote {
}
}
- void popup_menu(Gtk::Menu &menu, const GdkEventButton * ev)
- {
- popup_menu(menu, ev, boost::bind(&get_menu_position, &menu, _1, _2, _3));
- }
-
- void popup_menu(Gtk::Menu &menu, const GdkEventButton * ev,
- Gtk::Menu::SlotPositionCalc calc)
+ void popup_menu(Gtk::Menu &menu, const GdkEventButton * ev)
{
menu.signal_deactivate().connect(sigc::bind(&deactivate_menu, &menu));
- menu.popup(calc, (ev ? ev->button : 0),
- (ev ? ev->time : gtk_get_current_event_time()));
+ menu.popup(boost::bind(&get_menu_position, &menu, _1, _2, _3),
+ (ev ? ev->button : 0),
+ (ev ? ev->time : gtk_get_current_event_time()));
if(menu.get_attach_widget()) {
menu.get_attach_widget()->set_state(Gtk::STATE_SELECTED);
}
diff --git a/src/utils.hpp b/src/utils.hpp
index 2f232eb..fc8dd59 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -50,7 +50,6 @@ namespace gnote {
void popup_menu(Gtk::Menu &menu, const GdkEventButton *);
- void popup_menu(Gtk::Menu &menu, const GdkEventButton *, Gtk::Menu::SlotPositionCalc calc);
void show_help(const std::string & filename, const std::string & link_id,
GdkScreen *screen, Gtk::Window *parent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]