[gnome-software/wip/attente/clean-ubuntu-changes: 5/15] Use traditional window decorations in Unity



commit 7d85d1393e67940f48f4876ed719c5bbccb73a8d
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Mar 3 15:13:50 2016 +1300

    Use traditional window decorations in Unity

 src/gs-shell.c |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 8c80a6f..fb8a84b 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -674,6 +674,23 @@ gs_shell_monitor_permission (GsShell *shell)
                                  G_CALLBACK (on_permission_changed), shell);
 }
 
+static gboolean
+in_desktop (const gchar *name)
+{
+       const gchar *desktop_name_list;
+       g_auto(GStrv) names = NULL;
+       gint i;
+
+       desktop_name_list = g_getenv ("XDG_CURRENT_DESKTOP");
+       if (desktop_name_list == NULL)
+               return FALSE;
+
+       names = g_strsplit (desktop_name_list, ":", -1);
+       for (i = 0; names[i] && strcmp (names[i], name) != 0; i++);
+
+       return names[i] != NULL;
+}
+
 /**
  * gs_shell_setup:
  */
@@ -707,10 +724,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 (in_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",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]