updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / liferea-unity / fix_systray_behavior
blob37716a09d2cf46f7e806d07c4d3f3bea78040074
1 ---
2  src/ui/liferea_shell.c |   14 ++++++++++++--
3  src/ui/ui_tray.c       |    5 ++++-
4  2 files changed, 16 insertions(+), 3 deletions(-)
6 Index: liferea-1.6.0~rc6/src/ui/ui_tray.c
7 ===================================================================
8 --- liferea-1.6.0~rc6.orig/src/ui/ui_tray.c
9 +++ liferea-1.6.0~rc6/src/ui/ui_tray.c
10 @@ -205,17 +205,20 @@
11         g_free (tmp);
12         g_free (msg);
13  }
15  /* a click on the systray icon should show the program window
16     if invisible or hide it if visible */
17  static void
18  tray_icon_pressed (GtkWidget *button, GdkEventButton *event, EggTrayIcon *icon)
19 -{      
21 +       if ((event->type == GDK_2BUTTON_PRESS) || (event->type == GDK_3BUTTON_PRESS))
22 +               return;  /* ignore double and triple clicks */
24         switch (event->button) {
25                 case 1:
26                         liferea_shell_toggle_visibility ();
27                         break;
28                 case 3:
29                         ui_popup_systray_menu (event->button, event->time);
30                         break;
31         }
32 Index: liferea-1.6.0~rc6/src/ui/liferea_shell.c
33 ===================================================================
34 --- liferea-1.6.0~rc6.orig/src/ui/liferea_shell.c
35 +++ liferea-1.6.0~rc6/src/ui/liferea_shell.c
36 @@ -1348,18 +1348,28 @@
37         gtk_window_present (shell->priv->window);
38  }
40  void
41  liferea_shell_toggle_visibility (void)
42  {
43         GtkWidget *mainwindow = GTK_WIDGET (shell->priv->window);
44         
45 -       if ((gdk_window_get_state (mainwindow->window) & GDK_WINDOW_STATE_ICONIFIED) ||
46 -           !GTK_WIDGET_VISIBLE (mainwindow)) {
47 +       if(gdk_window_get_state(GTK_WIDGET(mainwindow)->window) & GDK_WINDOW_STATE_ICONIFIED) {
48 +               /* The window is either iconified, or on another workspace */
49 +               /* Raise it in one click */
50 +               if (GTK_WIDGET_VISIBLE(mainwindow)) {
51 +                       liferea_shell_save_position ();
52 +                       gtk_widget_hide(mainwindow);
53 +               }
54 +               liferea_shell_restore_position();
55 +               gtk_window_present(GTK_WINDOW(mainwindow));
56 +       }
57 +       else if(!GTK_WIDGET_VISIBLE(mainwindow)) {
58 +               /* The window is neither iconified nor on another workspace, but is not visible */
59                 liferea_shell_restore_position ();
60                 gtk_window_present (shell->priv->window);
61         } else {
62                 liferea_shell_save_position ();
63                 gtk_widget_hide (mainwindow);
64         }
65  }