metacity r3516 - in trunk: . src/core



Author: tthurman
Date: Sun Jan 13 02:53:25 2008
New Revision: 3516
URL: http://svn.gnome.org/viewvc/metacity?rev=3516&view=rev

Log:
2008-01-12  Thomas Thurman  <tthurman gnome org>

        * src/core/main.c: Refactor repeated lines in main() to
       iterate instead.



Modified:
   trunk/ChangeLog
   trunk/src/core/main.c

Modified: trunk/src/core/main.c
==============================================================================
--- trunk/src/core/main.c	(original)
+++ trunk/src/core/main.c	Sun Jan 13 02:53:25 2008
@@ -304,6 +304,11 @@
   struct sigaction act;
   sigset_t empty_mask;
   MetaArguments meta_args;
+  const gchar *log_domains[] = {
+    NULL, G_LOG_DOMAIN, "Gtk", "Gdk", "GLib",
+    "Pango", "GLib-GObject", "GThread"
+  };
+  gint i;
   
   if (setlocale (LC_ALL, "") == NULL)
     meta_warning ("Locale not understood by C library, internationalization will not work\n");
@@ -366,30 +371,12 @@
 
 
 #if 1
-  g_log_set_handler (NULL,
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
-  g_log_set_handler (G_LOG_DOMAIN,
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
-  g_log_set_handler ("Gtk",
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
-  g_log_set_handler ("Gdk",
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
-  g_log_set_handler ("GLib",
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
-  g_log_set_handler ("Pango",
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
-  g_log_set_handler ("GLib-GObject",
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
-  g_log_set_handler ("GThread",
-                     G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
-                     log_handler, NULL);
+
+  for (i=0; i<G_N_ELEMENTS(log_domains); i++)
+    g_log_set_handler (log_domains[i],
+                       G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
+                       log_handler, NULL);
+
 #endif
 
   if (g_getenv ("METACITY_G_FATAL_WARNINGS") != NULL)



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