Package: eog / 3.20.5-1

0002-Show-traditional-title-bar-in-unity.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
From fd12d0136bfd9abc8a121f47775c2200237e535f Mon Sep 17 00:00:00 2001
From: Lars Uebernickel <lars.uebernickel@canonical.com>
Date: Tue, 29 Sep 2015 12:25:29 +0200
Subject: [PATCH 2/2] Show traditional title bar in unity

Based on a patch by Iain Lane <iain@orangesquash.org.uk>
---
 src/eog-window.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 55 insertions(+), 11 deletions(-)

Index: b/src/eog-window.c
===================================================================
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -134,6 +134,7 @@
 	GtkWidget           *zoom_revealer;
 	GtkWidget           *zoom_scale;
 	GtkWidget           *properties_dlg;
+	GtkWidget           *headerbar;
 
 	GMenu               *open_with_menu;
 	GPtrArray           *appinfo;
@@ -4260,6 +4261,20 @@
 }
 
 static void
+on_action_state_changed (GActionGroup *action_group,
+			 gchar        *name,
+			 GVariant     *value,
+			 gpointer      user_data)
+{
+	EogWindow *window = user_data;
+	EogWindowPrivate *priv = window->priv;
+
+	gtk_widget_set_visible (GTK_WIDGET (priv->headerbar),
+				priv->mode != EOG_WINDOW_MODE_FULLSCREEN &&
+				priv->mode != EOG_WINDOW_MODE_SLIDESHOW);
+}
+
+static void
 eog_window_construct_ui (EogWindow *window)
 {
 	EogWindowPrivate *priv;
@@ -4270,7 +4285,6 @@
 
 	GtkWidget *popup_menu;
 	GtkWidget *hpaned;
-	GtkWidget *headerbar;
 	GtkWidget *zoom_button;
 	GtkWidget *zoom_image;
 	GtkWidget *menu_button;
@@ -4285,12 +4299,19 @@
 	gtk_container_add (GTK_CONTAINER (window), priv->box);
 	gtk_widget_show (priv->box);
 
-	headerbar = gtk_header_bar_new ();
-	gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (headerbar), TRUE);
-	gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
-				  g_get_application_name ());
-	gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
-	gtk_widget_show (headerbar);
+	priv->headerbar = gtk_header_bar_new ();
+	if (!in_desktop ("Unity")) {
+		gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (priv->headerbar), TRUE);
+		gtk_header_bar_set_title (GTK_HEADER_BAR (priv->headerbar), g_get_application_name ());
+		gtk_window_set_titlebar (GTK_WINDOW (window), priv->headerbar);
+	} else {
+		gtk_container_add (GTK_CONTAINER (priv->box), priv->headerbar);
+
+		/* Need to hide toolbar when fullscreen (slideshow or normal fullscreen) */
+		g_signal_connect (window, "action-state-changed",
+				  G_CALLBACK (on_action_state_changed), window);
+	}
+	gtk_widget_show (priv->headerbar);
 
 	zoom_button = gtk_toggle_button_new ();
 	zoom_image = gtk_image_new_from_icon_name ("zoom-in-symbolic",
@@ -4301,7 +4322,7 @@
 	g_signal_connect (zoom_button, "toggled",
 			  G_CALLBACK (eog_window_zoom_button_toggled_cb),
 			  window);
-	gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar), zoom_button);
+	gtk_header_bar_pack_start (GTK_HEADER_BAR (priv->headerbar), zoom_button);
 	/* disable zoom button if no image is loaded */
 	g_object_bind_property (g_action_map_lookup_action (G_ACTION_MAP(window),
 							    "zoom-normal"),
@@ -4312,7 +4333,7 @@
 	priv->zoom_revealer = gtk_revealer_new ();
 	gtk_revealer_set_transition_type (GTK_REVEALER (priv->zoom_revealer),
 					  GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
-	gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar),
+	gtk_header_bar_pack_start (GTK_HEADER_BAR (priv->headerbar),
 				   priv->zoom_revealer);
 	gtk_widget_show (priv->zoom_revealer);
 
@@ -4346,7 +4367,7 @@
 		gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menu_button),
 						G_MENU_MODEL (builder_object));
 
-		gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), menu_button);
+		gtk_header_bar_pack_end (GTK_HEADER_BAR (priv->headerbar), menu_button);
 		gtk_widget_show (menu_button);
 
 		builder_object = gtk_builder_get_object (builder, "open-with-menu");
@@ -4369,7 +4390,7 @@
 					"win.view-fullscreen");
 	gtk_widget_set_tooltip_text(fullscreen_button,
 				    _("Show the current image in fullscreen mode"));
-	gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), fullscreen_button);
+	gtk_header_bar_pack_end (GTK_HEADER_BAR (priv->headerbar), fullscreen_button);
 	gtk_widget_show (fullscreen_button);
 
 	priv->cbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);