[gnome-software/wip/rancell/ubuntu-3-20-rebase: 6/28] Do not use the header bar on Unity
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/ubuntu-3-20-rebase: 6/28] Do not use the header bar on Unity
- Date: Sat, 17 Jun 2017 04:54:21 +0000 (UTC)
commit 0f92d7331f95e635f3ba778681b72bc1044b8b62
Author: Richard Hughes <richard hughsie com>
Date: Thu Apr 7 15:22:11 2016 +0100
Do not use the header bar on Unity
Based on a patch by Robert Ancell, many thanks.
src/gs-shell.c | 12 ++++++++----
src/gs-utils.c | 15 +++++++++++++++
src/gs-utils.h | 2 ++
3 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index bd2deb0..24e900e 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -717,10 +717,14 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
/* fix up the header bar */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header"));
- g_object_ref (widget);
- gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget);
- gtk_window_set_titlebar (GTK_WINDOW (priv->main_window), widget);
- g_object_unref (widget);
+ if (gs_utils_is_current_desktop ("Unity")) {
+ gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (widget), "");
+ } else {
+ g_object_ref (widget);
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget);
+ gtk_window_set_titlebar (GTK_WINDOW (priv->main_window), widget);
+ g_object_unref (widget);
+ }
/* global keynav */
g_signal_connect_after (priv->main_window, "key_press_event",
diff --git a/src/gs-utils.c b/src/gs-utils.c
index 4cd1799..2c783f2 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -517,4 +517,19 @@ gs_utils_get_content_type (const gchar *filename,
return g_strdup (tmp);
}
+/**
+ * gs_utils_is_current_desktop:
+ */
+gboolean
+gs_utils_is_current_desktop (const gchar *name)
+{
+ const gchar *tmp;
+ g_auto(GStrv) names = NULL;
+ tmp = g_getenv ("XDG_CURRENT_DESKTOP");
+ if (tmp == NULL)
+ return FALSE;
+ names = g_strsplit (tmp, ":", -1);
+ return g_strv_contains ((const gchar * const *) names, name);
+}
+
/* vim: set noexpandtab: */
diff --git a/src/gs-utils.h b/src/gs-utils.h
index 561054c..aa2925e 100644
--- a/src/gs-utils.h
+++ b/src/gs-utils.h
@@ -65,6 +65,8 @@ gchar *gs_utils_get_cachedir (const gchar *kind,
gchar *gs_utils_get_user_hash (GError **error);
GPermission *gs_utils_get_permission (const gchar *id);
+gboolean gs_utils_is_current_desktop (const gchar *name);
+
G_END_DECLS
#endif /* __GS_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]