Blob Blame History Raw
From 6e7a67c80bdaf6d2379dbe3273321ebd10ab11e4 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 14 Aug 2015 14:05:15 +0200
Subject: Add minimize button to the fullscreen toolbar

Add button which when pressed iconifies Vinagre window.

https://bugzilla.gnome.org/show_bug.cgi?id=753626
---
 vinagre/vinagre-tab.c    | 16 ++++++++++++++++
 vinagre/vinagre-window.c |  6 ++++++
 vinagre/vinagre-window.h |  2 ++
 3 files changed, 24 insertions(+)

diff --git a/vinagre/vinagre-tab.c b/vinagre/vinagre-tab.c
index 8828fb3..f19bfe5 100644
--- a/vinagre/vinagre-tab.c
+++ b/vinagre/vinagre-tab.c
@@ -331,6 +331,13 @@ close_button_clicked (GtkToolButton *button,
 }
 
 static void
+minimize_button_clicked (GtkToolButton *button,
+                         VinagreTab    *tab)
+{
+  vinagre_window_minimize (tab->priv->window);
+}
+
+static void
 fullscreen_button_clicked (GtkToolButton *button,
 			   VinagreTab    *tab)
 {
@@ -356,6 +363,15 @@ setup_layout (VinagreTab *tab)
   gtk_toolbar_insert (GTK_TOOLBAR (tab->priv->toolbar), GTK_TOOL_ITEM (button), 0);
   g_signal_connect (button, "clicked", G_CALLBACK (close_button_clicked), tab);
 
+  /* Minimize window */
+  button = GTK_WIDGET (gtk_tool_button_new (NULL, NULL));
+  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), "window-minimize-symbolic");
+  /* Translators: Pressing this button will minimize Vinagre */
+  gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (button), _("Minimize window"));
+  gtk_widget_show (button);
+  gtk_toolbar_insert (GTK_TOOLBAR (tab->priv->toolbar), GTK_TOOL_ITEM (button), 0);
+  g_signal_connect (button, "clicked", G_CALLBACK (minimize_button_clicked), tab);
+
   /* Connection name/menu */
   str = vinagre_connection_get_best_name (tab->priv->conn);
   button = GTK_WIDGET (gtk_tool_button_new (NULL, str));
diff --git a/vinagre/vinagre-window.c b/vinagre/vinagre-window.c
index c6d7cc9..09b4812 100644
--- a/vinagre/vinagre-window.c
+++ b/vinagre/vinagre-window.c
@@ -934,6 +934,12 @@ vinagre_window_toggle_fullscreen (VinagreWindow *window)
     gtk_window_fullscreen (GTK_WINDOW (window));
 }
 
+void
+vinagre_window_minimize (VinagreWindow *window)
+{
+  gtk_window_iconify (GTK_WINDOW (window));
+}
+
 /**
  * vinagre_window_get_statusbar:
  * @window: A window
diff --git a/vinagre/vinagre-window.h b/vinagre/vinagre-window.h
index 100681f..de273e7 100644
--- a/vinagre/vinagre-window.h
+++ b/vinagre/vinagre-window.h
@@ -85,6 +85,8 @@ gboolean	vinagre_window_is_fullscreen		(VinagreWindow         *window);
 
 void		vinagre_window_toggle_fullscreen	(VinagreWindow *window);
 
+void		vinagre_window_minimize			(VinagreWindow *window);
+
 void		vinagre_window_merge_tab_ui (VinagreWindow	*window);
 
 GList 		*vinagre_window_get_connections		(VinagreWindow *window);
-- 
cgit v0.12