diff options
author | Alan Fitton <alan@eth0.org.uk> | 2012-08-03 18:30:23 +0100 |
---|---|---|
committer | Alan Fitton <alan@eth0.org.uk> | 2012-08-03 19:32:07 +0100 |
commit | 5cdd067dde50ed9083248a0f262167017b3742f5 (patch) | |
tree | 22a176232d5fdd0153845b96de712ad6966a0b4a /src/trg-main-window.c | |
parent | 3f4881bff67d41c0dfb175e50c81185b44b79cf0 (diff) |
issue 208 - escape URL for pango markup. issue 206 - minimize on tray click.
Diffstat (limited to 'src/trg-main-window.c')
-rw-r--r-- | src/trg-main-window.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/trg-main-window.c b/src/trg-main-window.c index 80de448..3020b3d 100644 --- a/src/trg-main-window.c +++ b/src/trg-main-window.c @@ -199,6 +199,7 @@ static gboolean torrent_tv_button_pressed_cb(GtkWidget * treeview, gpointer userdata); static gboolean torrent_tv_popup_menu_cb(GtkWidget * treeview, gpointer userdata); +static void trg_main_window_set_hidden_to_tray(TrgMainWindow *win, gboolean hidden); static gboolean is_ready_for_torrent_action(TrgMainWindow * win); static gboolean window_state_event(TrgMainWindow * win, GdkEventWindowState * event, @@ -247,6 +248,7 @@ struct _TrgMainWindowPrivate { GtkWidget *hpaned, *vpaned; GtkWidget *filterEntry; + gboolean hidden; gint width, height; guint timerId; guint sessionTimerId; @@ -1792,16 +1794,13 @@ status_icon_activated(GtkStatusIcon * icon G_GNUC_UNUSED, TrgMainWindow * win) { TrgMainWindowPrivate *priv = win->priv; + TrgPrefs *prefs = trg_client_get_prefs(priv->client); - gtk_window_deiconify(GTK_WINDOW(win)); - gtk_window_present(GTK_WINDOW(win)); - - if (priv->timerId > 0) { - g_source_remove(priv->timerId); - dispatch_async(priv->client, - torrent_get(TORRENT_GET_TAG_MODE_FULL), - on_torrent_get_update, win); - } + trg_main_window_set_hidden_to_tray(win, + !priv->hidden + && trg_prefs_get_bool(prefs, + TRG_PREFS_KEY_SYSTEM_TRAY_MINIMISE, + TRG_PREFS_GLOBAL)); } static gboolean @@ -2365,6 +2364,26 @@ torrent_tv_popup_menu_cb(GtkWidget * treeview, gpointer userdata) return TRUE; } +static void trg_main_window_set_hidden_to_tray(TrgMainWindow *win, gboolean hidden) { + + TrgMainWindowPrivate *priv = win->priv; + + if (hidden) { + gtk_widget_hide(GTK_WIDGET(win)); + } else { + gtk_window_deiconify(GTK_WINDOW(win) ); + gtk_window_present(GTK_WINDOW(win) ); + + if (priv->timerId > 0) { + g_source_remove(priv->timerId); + dispatch_async(priv->client, torrent_get(TORRENT_GET_TAG_MODE_FULL), + on_torrent_get_update, win); + } + } + + priv->hidden = hidden; +} + static gboolean window_state_event(TrgMainWindow * win, GdkEventWindowState * event, gpointer trayIcon) @@ -2377,7 +2396,7 @@ window_state_event(TrgMainWindow * win, && (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) && trg_prefs_get_bool(prefs, TRG_PREFS_KEY_SYSTEM_TRAY_MINIMISE, TRG_PREFS_GLOBAL)) { - gtk_widget_hide(GTK_WIDGET(win)); + trg_main_window_set_hidden_to_tray(win, TRUE); return TRUE; } @@ -2742,7 +2761,7 @@ static GObject *trg_main_window_constructor(GType type, gtk_paned_set_position(GTK_PANED(priv->hpaned), pos); if (tray && priv->min_on_start) - gtk_widget_hide(GTK_WIDGET(self)); + trg_main_window_set_hidden_to_tray(self, TRUE); /* Drag and Drop */ gtk_drag_dest_set(GTK_WIDGET(self), /* widget that will accept a drop */ |