bug-buddy r2746 - in trunk: . src



Author: cosimoc
Date: Thu Oct 16 14:49:16 2008
New Revision: 2746
URL: http://svn.gnome.org/viewvc/bug-buddy?rev=2746&view=rev

Log:
2008-10-16  Cosimo Cecchi  <cosimoc gnome org>

	* src/bug-buddy.c: (gconf_get_key_name_from_path),
	(fill_system_info):
	Include the loaded GTK+ modules in the report (#555037).


Modified:
   trunk/ChangeLog
   trunk/src/bug-buddy.c

Modified: trunk/src/bug-buddy.c
==============================================================================
--- trunk/src/bug-buddy.c	(original)
+++ trunk/src/bug-buddy.c	Thu Oct 16 14:49:16 2008
@@ -65,6 +65,7 @@
 #define ACCESSIBILITY_KEY "/desktop/gnome/interface/accessibility"
 #define GTK_THEME_KEY	"/desktop/gnome/interface/gtk_theme"
 #define ICON_THEME_KEY  "/desktop/gnome/interface/icon_theme"
+#define GTK_MODULES_KEY "/apps/gnome_settings_daemon/gtk-modules"
 #define DESKTOP_IS_HOME_DIR "/apps/nautilus/preferences/desktop_is_home_dir"
 #define MIN_REPORT_DETAILS_CHARS 10
 
@@ -1654,6 +1655,21 @@
 
 }
 
+/* copied from gconf-editor/gconf-util.c */
+
+static gchar *
+gconf_get_key_name_from_path (const gchar *path)
+{
+	const gchar *ptr;
+
+	ptr = path + strlen (path);
+
+	while (ptr[-1] != '/')
+		ptr--;
+
+	return g_strdup (ptr);
+}
+
 static void
 fill_system_info (GtkBuilder *ui)
 {
@@ -1661,7 +1677,8 @@
 	GtkTextView *text_view;
 	GtkTextIter end;
 	GtkTextBuffer *buffer;
-	GString *system_info;
+	GString *system_info, *modules;
+	GSList *entries;
 	struct utsname uts_buf;
 	char *str;
 	gboolean has_selinux, enforcing, a11y;
@@ -1669,6 +1686,7 @@
 	g_return_if_fail (ui != NULL);
 	
 	system_info = g_string_new ("");
+	modules = NULL;
 
 	if (uname (&uts_buf) == 0) {
 		g_string_append_printf (system_info, "System: %s %s %s %s\n", uts_buf.sysname, uts_buf.release, uts_buf.version, uts_buf.machine);
@@ -1706,6 +1724,62 @@
 	str = gconf_client_get_string (gconf_client, ICON_THEME_KEY, NULL);
 	g_string_append_printf (system_info, "Icon Theme: %s\n", str);
 	g_free (str);
+
+	/* add the GTK+ loaded modules. to do that, we look both in GConf and
+	 * inside the GTK_MODULES env var.
+	 */
+
+	entries = gconf_client_all_entries (gconf_client, GTK_MODULES_KEY, NULL);
+	if (entries) {
+		GSList *l;
+		GConfEntry *entry;
+		char *name;
+
+		modules = g_string_new ("GTK+ Modules: ");
+
+		for (l = entries; l != NULL; l = l->next)  {
+			entry = l->data;
+			name = gconf_get_key_name_from_path (gconf_entry_get_key (entry));
+
+			if (!g_strstr_len (modules->str, modules->len, name)) {
+				g_string_append_printf (modules, "%s, ", name);
+			}
+
+			g_free (name);
+			gconf_entry_free (entry);
+		}
+
+		g_slist_free (entries);
+	}
+
+	str = (char * ) g_getenv ("GTK_MODULES");
+	if (str) {
+		char **splitted;
+		int i;
+
+		if (!modules) {
+			modules = g_string_new ("GTK+ Modules: ");
+		}
+
+		/* modules are divided by G_SEARCHPATH_SEPARATOR */
+		splitted = pango_split_file_list (str);
+
+		for (i = 0; splitted[i]; i++) {
+			if (!g_strstr_len (modules->str, modules->len, splitted[i])) {
+				g_string_append_printf (modules, "%s, ", splitted[i]);
+			}
+		}
+
+		g_strfreev (splitted);
+	}
+
+	if (modules) {
+		/* discard the last ", " */
+		g_string_append_len (system_info, modules->str, (modules->len - 2));
+		g_string_append (system_info, "\n");
+		g_string_free (modules, TRUE);
+	}
+
 	g_object_unref (gconf_client);
 
 	g_string_append (system_info, "\n");



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