Control: tags -1 + patch

On Tue, Oct 16, 2018 at 12:16:05PM -0400, Jeremy Bicha wrote:
> I'm reopening this bug because alltray's gconf handling is wrong. It
> tries to use gconf to look up the GNOME theme, but the GNOME theme is
> set in gsettings.

Right.

> The previous fix was also incomplete. You need to patch src/main.c to
> not "exit 0" when run in metacity or compiz when built without gconf.

Agreed as well.

Attached is hopefully a proper fix, tested on MATE with the native
window manager (marco) and metacity configured to use a "metacity"
theme type.  I couldn't make it work under gnome-shell/mutter; I guess
the program doesn't support its tray anyway.
diff -Nru alltray-0.71b/debian/control alltray-0.71b/debian/control
--- alltray-0.71b/debian/control	2018-09-11 17:21:34.000000000 +0300
+++ alltray-0.71b/debian/control	2018-09-11 17:21:34.000000000 +0300
@@ -2,7 +2,7 @@
 Section: x11
 Priority: optional
 Maintainer: Ignace Mouzannar <[email protected]>
-Build-Depends: debhelper (>= 7.0.50~), autotools-dev, libgtk2.0-dev, libgconf2-dev, bash-completion
+Build-Depends: debhelper (>= 7.0.50~), autotools-dev, libgtk2.0-dev, bash-completion
 Vcs-Svn: svn://svn.debian.org/collab-maint/ext-maint/alltray/trunk/
 Vcs-Browser: http://svn.debian.org/viewsvn/collab-maint/ext-maint/alltray/trunk/
 Homepage: http://alltray.trausch.us/
diff -Nru alltray-0.71b/debian/patches/no-gconf.patch alltray-0.71b/debian/patches/no-gconf.patch
--- alltray-0.71b/debian/patches/no-gconf.patch	1970-01-01 02:00:00.000000000 +0200
+++ alltray-0.71b/debian/patches/no-gconf.patch	2018-09-11 17:21:34.000000000 +0300
@@ -0,0 +1,134 @@
+Description: Move away from GConf.
+Author: Yavor Doganov <[email protected]>
+Bug-Debian: https://bugs.debian.org/885818
+Forwarded: no
+Last-Update: 2019-10-31
+---
+
+--- alltray-0.71b.orig/src/main.c
++++ alltray-0.71b/src/main.c
+@@ -170,25 +170,13 @@
+ 
+   if (debug) printf ("window manager: %s\n", win->window_manager);
+ 
+-  if ((!strcmp(win->window_manager, "Metacity"))) {
+-    
+-    #ifndef GCONF_NOT_DISABLED
+-          printf ("\n\nAlltray: To use Alltray under Gnome, Gconf support should not be disabled.\n"
+-                  "         But it is.\n\n");
+-          exit (0);
+-    #endif
+-
++  if (!strcmp(win->window_manager, "Metacity")
++      || !strcmp(win->window_manager, "Metacity (Marco)")) {
+     win->gnome=TRUE;
+     win->no_reparent=TRUE;
+   }
+ 
+   if (!strcmp(win->window_manager, "compiz")) {
+-    #ifndef GCONF_NOT_DISABLED
+-          printf ("\n\nAlltray: To use Alltray with Compiz, Gconf support should not be disabled.\n"
+-                  "         But it is.\n\n");
+-          exit (0);
+-    #endif 
+-
+      win->compiz = TRUE;
+   }
+ 
+@@ -198,8 +186,6 @@
+      win->kde_close_button_pos = kde_get_close_button_positon ();
+   }
+ 
+-  g_free (win->window_manager);
+-
+   if (argc==1 || (debug=(argc == 2 && !strcmp (argv[1], "-d")))) {
+ 
+     if (debug) printf ("click_mode\n");
+@@ -356,10 +342,6 @@
+ 
+   gtk_init (&argc, &argv);
+ 
+-  #ifdef GCONF_NOT_DISABLED
+-    gconf_init(argc, argv, NULL);
+-  #endif
+-
+   gdk_pixbuf_xlib_init (GDK_DISPLAY(), DefaultScreen (GDK_DISPLAY()));
+   gbr_init (NULL);
+   atom_init ();
+@@ -522,6 +504,8 @@
+       }
+     }
+ 
++    g_free (win->window_manager);
++
+     if (win->xmms) {
+        gdk_window_set_events(win->xmms_main_window_gdk, GDK_VISIBILITY_NOTIFY_MASK | GDK_STRUCTURE_MASK);
+        gdk_window_add_filter(win->xmms_main_window_gdk, event_filter, (gpointer) win);
+--- alltray-0.71b.orig/src/gnome_theme.c
++++ alltray-0.71b/src/gnome_theme.c
+@@ -41,8 +41,10 @@
+ 
+ #include "config.h" 
+ #include "common.h"
++#include <gio/gio.h>
+ 
+-#define GCONF_METACITY_THEME_PATH "/apps/metacity/general/theme"
++#define METACITY_SCHEMA "org.gnome.metacity.theme"
++#define MARCO_SCHEMA "org.mate.Marco.general"
+ #define THEME_FILENAME "metacity-theme-1.xml"
+ #define THEME_SUBDIR "metacity-1"
+  
+@@ -126,25 +128,30 @@
+ 
+ gchar *get_metacity_theme (win_struct *win) {
+ 
+-#ifdef GCONF_NOT_DISABLED
+-
+-  GConfClient *client;
++  GSettings *settings = NULL;
+   gchar *theme=NULL;
++  gchar *value;
+     
+-  client = gconf_client_get_default();
+-  theme= gconf_client_get_string(client, GCONF_METACITY_THEME_PATH, NULL);
++  if (!strcmp(win->window_manager, "Metacity")) {
++    settings = g_settings_new(METACITY_SCHEMA);
++    value = g_settings_get_string(settings, "type");
++
++    if (!strcmp(value, "metacity"))
++      theme = g_settings_get_string(settings, "name");
++    else
++      theme = g_strdup("");
++
++    g_free(value);
++  } else {
++    settings = g_settings_new(MARCO_SCHEMA);
++    theme = g_settings_get_string(settings, "theme");
++  }
+ 
+   if (debug) printf ("theme is: %s\n", theme);
+ 
+-  g_object_unref(client);
++  g_object_unref(settings);
+ 
+   return theme;
+-
+-#else
+- return NULL;
+-#endif
+- 
+-
+ }
+ 
+ gboolean parse_theme (win_struct *win) {
+@@ -162,6 +169,10 @@
+   if (metacity_theme == NULL) {
+      printf ("\n\nAlltray: ups...\n");
+   }
++  if (!strlen(metacity_theme)) {
++    g_free(metacity_theme);
++    return TRUE;
++  }
+   g_assert (metacity_theme);
+   
+   if (debug) printf ("theme name: %s\n", metacity_theme);
diff -Nru alltray-0.71b/debian/patches/series alltray-0.71b/debian/patches/series
--- alltray-0.71b/debian/patches/series	1970-01-01 02:00:00.000000000 +0200
+++ alltray-0.71b/debian/patches/series	2018-09-11 17:21:34.000000000 +0300
@@ -0,0 +1 @@
+no-gconf.patch
diff -Nru alltray-0.71b/debian/rules alltray-0.71b/debian/rules
--- alltray-0.71b/debian/rules	2018-09-11 17:21:34.000000000 +0300
+++ alltray-0.71b/debian/rules	2018-09-11 17:21:34.000000000 +0300
@@ -10,4 +10,4 @@
 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 	cp -f /usr/share/misc/config.guess config.guess
 endif
-	dh_auto_configure
+	dh_auto_configure -- --disable-gconf

Reply via email to