summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid King <amigadave@amigadave.com>2014-08-07 15:08:15 +0100
committerDavid King <amigadave@amigadave.com>2014-08-07 15:10:29 +0100
commit2ecb01c2d5f00cea15184e02ba8abd1897d05304 (patch)
tree219468b7c3cecda468a1b7edeebe1f6b6025f410 /src
parente87e0b792eaf0a7d4abae9ff9e9925f87b8a4102 (diff)
Refactor thumb view popup menu handling
Popup the thumb view context menu in response to the popup-menu signal on GtkWidget. https://bugzilla.gnome.org/show_bug.cgi?id=724905
Diffstat (limited to 'src')
-rw-r--r--src/cheese-window.vala31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 90ad2554..9e0b7331 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -162,6 +162,20 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
return false;
}
+ private void do_thumb_view_popup_menu (Gtk.Widget widget,
+ uint button,
+ uint time)
+ {
+ thumbnail_popup.popup (null, widget, null, button, time);
+ }
+
+ private bool on_thumb_view_popup_menu (Gtk.Widget thumbview)
+ {
+ do_thumb_view_popup_menu (thumbview, 0, 0);
+
+ return true;
+ }
+
/**
* Popup a context menu when right-clicking on a thumbnail.
*
@@ -190,18 +204,18 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
if (event.type == Gdk.EventType.BUTTON_PRESS)
{
- Gdk.Event* button_press = (Gdk.Event*)(&event);
+ Gdk.Event* button_press = (Gdk.Event*)(event);
if (button_press->triggers_context_menu ())
{
- thumbnail_popup.popup (null, thumb_view, null, event.button,
- event.time);
- }
- else if (event.type == Gdk.EventType.2BUTTON_PRESS)
- {
- on_file_open ();
+ do_thumb_view_popup_menu (thumb_view, event.button,
+ event.time);
+ return true;
}
-
+ }
+ else if (event.type == Gdk.EventType.2BUTTON_PRESS)
+ {
+ on_file_open ();
return true;
}
@@ -1272,6 +1286,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
thumb_view = new Cheese.ThumbView ();
thumb_nav = new Eog.ThumbNav (thumb_view, false);
thumbnail_popup.attach_to_widget (thumb_view, null);
+ thumb_view.popup_menu.connect (on_thumb_view_popup_menu);
Gtk.CssProvider css;
try