[metacity] util: replace meta_warning with g_warning



commit f0853bc53b4dd0e5993a9af2804a27c219c65553
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Mar 10 13:54:47 2017 +0200

    util: replace meta_warning with g_warning

 src/core/boxes.c        |   15 ++++++---
 src/core/constraints.c  |    9 +----
 src/core/core.c         |    2 +-
 src/core/delete.c       |    3 +-
 src/core/display.c      |   74 +++++++++++++++++++++++++---------------------
 src/core/effects.c      |    2 +-
 src/core/keybindings.c  |    9 ++++-
 src/core/main.c         |   10 ++++--
 src/core/place.c        |    2 +-
 src/core/prefs.c        |   39 ++++++++++--------------
 src/core/screen.c       |   37 +++++++++++++----------
 src/core/session.c      |   23 +++++++-------
 src/core/stack.c        |    4 +-
 src/core/util.c         |   33 ++------------------
 src/core/window-props.c |   17 ++++++-----
 src/core/window.c       |   55 ++++++++++++++++++-----------------
 src/core/workspace.c    |   19 ++++++------
 src/core/xprops.c       |   29 +++++++++++-------
 src/include/util.h      |    2 -
 src/ui/frames.c         |    4 ++-
 src/ui/menu.c           |    4 ++-
 21 files changed, 193 insertions(+), 199 deletions(-)
---
diff --git a/src/core/boxes.c b/src/core/boxes.c
index 47ebf75..f306365 100644
--- a/src/core/boxes.c
+++ b/src/core/boxes.c
@@ -387,8 +387,9 @@ merge_spanning_rects_in_region (GList *region)
 
   if (region == NULL)
     {
-      meta_warning ("Region to merge was empty!  Either you have a some "
-                    "pathological STRUT list or there's a bug somewhere!\n");
+      g_warning ("Region to merge was empty!  Either you have a some "
+                 "pathological STRUT list or there's a bug somewhere!");
+
       return NULL;
     }
 
@@ -879,7 +880,7 @@ meta_rectangle_clamp_to_fit_into_region (const GList         *spanning_rects,
   /* Clamp rect appropriately */
   if (best_rect == NULL)
     {
-      meta_warning ("No rect whose size to clamp to found!\n");
+      g_warning ("No rect whose size to clamp to found!");
 
       /* If it doesn't fit, at least make it no bigger than it has to be */
       if (!(fixed_directions & FIXED_DIRECTION_X))
@@ -946,7 +947,9 @@ meta_rectangle_clip_to_region (const GList         *spanning_rects,
 
   /* Clip rect appropriately */
   if (best_rect == NULL)
-    meta_warning ("No rect to clip to found!\n");
+    {
+      g_warning ("No rect to clip to found!");
+    }
   else
     {
       /* Extra precaution with checking fixed direction shouldn't be needed
@@ -1042,7 +1045,9 @@ meta_rectangle_shove_into_region (const GList         *spanning_rects,
 
   /* Shove rect appropriately */
   if (best_rect == NULL)
-    meta_warning ("No rect to shove into found!\n");
+    {
+      g_warning ("No rect to shove into found!");
+    }
   else
     {
       /* Extra precaution with checking fixed direction shouldn't be needed
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 0e80422..729d350 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -479,13 +479,8 @@ setup_constraint_info (ConstraintInfo      *info,
       window->has_fullscreen_func &&
       !window->fullscreen)
     {
-      /*
-      meta_topic (META_DEBUG_GEOMETRY,
-      */
-      meta_warning (
-                  "Treating resize request of legacy application %s as a "
-                  "fullscreen request\n",
-                  window->desc);
+      g_warning ("Treating resize request of legacy application %s as a "
+                 "fullscreen request", window->desc);
       meta_window_make_fullscreen_internal (window);
     }
 
diff --git a/src/core/core.c b/src/core/core.c
index 73c3ac0..407a4e1 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -158,7 +158,7 @@ meta_core_get (Display *xdisplay,
         break;
 
       default:
-        meta_warning(_("Unknown window information request: %d"), request);
+        g_warning ("Unknown window information request: %d", request);
         break;
     }
 
diff --git a/src/core/delete.c b/src/core/delete.c
index 6f6ef71..4931b36 100644
--- a/src/core/delete.c
+++ b/src/core/delete.c
@@ -203,8 +203,7 @@ meta_window_kill (MetaWindow *window)
         }
       else
         {
-          meta_warning (_("Failed to get hostname: %s\n"),
-                        strerror (errno));
+          g_warning ("Failed to get hostname: %s", strerror (errno));
         }
     }
 
diff --git a/src/core/display.c b/src/core/display.c
index 5cbadc4..aaf8ca3 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -309,8 +309,9 @@ meta_display_open (void)
 
   if (xdisplay == NULL)
     {
-      meta_warning (_("Failed to open X Window System display '%s'\n"),
-                    XDisplayName (NULL));
+      g_warning ("Failed to open X Window System display '%s'",
+                 XDisplayName (NULL));
+
       return FALSE;
     }
 
@@ -963,8 +964,8 @@ meta_display_for_x_display (Display *xdisplay)
   if (the_display->xdisplay == xdisplay)
     return the_display;
 
-  meta_warning ("Could not find display for X display %p, probably going to crash\n",
-                xdisplay);
+  g_warning ("Could not find display for X display %p, probably going to crash",
+             xdisplay);
 
   return NULL;
 }
@@ -1848,7 +1849,7 @@ event_callback (XEvent   *event,
               if (window->frame)
                 {
                   window->frame->need_reapply_frame_shape = TRUE;
-                  meta_warning ("from event callback\n");
+                  g_warning ("from event callback");
                   meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
                 }
             }
@@ -1871,9 +1872,9 @@ event_callback (XEvent   *event,
            * nor do we want to use them to sanity check other timestamps.
            * See bug 313490 for more details.
            */
-          meta_warning ("Event has no timestamp! You may be using a broken "
-                        "program such as xse.  Please ask the authors of that "
-                        "program to fix it.\n");
+          g_warning ("Event has no timestamp! You may be using a broken "
+                     "program such as xse.  Please ask the authors of that "
+                     "program to fix it.");
         }
       else
         {
@@ -2245,8 +2246,10 @@ event_callback (XEvent   *event,
 
           if (frame_was_receiver)
             {
-              meta_warning ("Unexpected destruction of frame 0x%lx, not sure if this should silently fail or 
be considered a bug\n",
-                            window->frame->xwindow);
+              g_warning ("Unexpected destruction of frame 0x%lx, not sure if "
+                         "this should silently fail or be considered a bug",
+                         window->frame->xwindow);
+
               meta_error_trap_push (display);
               meta_window_destroy_frame (window->frame->window);
               meta_error_trap_pop (display);
@@ -2321,7 +2324,7 @@ event_callback (XEvent   *event,
         }
       else if (frame_was_receiver)
         {
-          meta_warning ("Map requests on the frame window are unexpected\n");
+          g_warning ("Map requests on the frame window are unexpected");
           break;
         }
 
@@ -2510,9 +2513,9 @@ event_callback (XEvent   *event,
                   /* Handle clients using the older version of the spec... */
                   if (time == 0 && workspace)
                     {
-                      meta_warning ("Received a NET_CURRENT_DESKTOP message "
-                                    "from a broken (outdated) client who sent "
-                                    "a 0 timestamp\n");
+                      g_warning ("Received a NET_CURRENT_DESKTOP message from "
+                                 "a broken (outdated) client who sent a 0 timestamp");
+
                       time = meta_display_get_current_time_roundtrip (display);
                     }
 
@@ -3552,9 +3555,11 @@ meta_display_begin_grab_op (MetaDisplay *display,
   if (display->grab_op != META_GRAB_OP_NONE)
     {
       if (window)
-        meta_warning ("Attempt to perform window operation %u on window %s when operation %u on %s already 
in effect\n",
-                      op, window->desc, display->grab_op,
-                      display->grab_window ? display->grab_window->desc : "none");
+        g_warning ("Attempt to perform window operation %u on window %s when "
+                   "operation %u on %s already in effect",
+                   op, window->desc, display->grab_op,
+                   display->grab_window ? display->grab_window->desc : "none");
+
       return FALSE;
     }
 
@@ -4363,7 +4368,7 @@ meta_display_ping_window (MetaDisplay        *display,
 
   if (timestamp == CurrentTime)
     {
-      meta_warning ("Tried to ping a window with CurrentTime! Not allowed.\n");
+      g_warning ("Tried to ping a window with CurrentTime! Not allowed.");
       return;
     }
 
@@ -4423,9 +4428,10 @@ process_request_frame_extents (MetaDisplay    *display,
                                                 event->xclient.window);
       if (screen == NULL)
         {
-          meta_warning ("Received request to set _NET_FRAME_EXTENTS "
-                        "on 0x%lx which is on a screen we are not managing\n",
-                        event->xclient.window);
+          g_warning ("Received request to set _NET_FRAME_EXTENTS "
+                     "on 0x%lx which is on a screen we are not managing",
+                     event->xclient.window);
+
           meta_XFree (hints);
           return;
         }
@@ -5237,11 +5243,11 @@ sanity_check_timestamps (MetaDisplay *display,
 {
   if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_focus_time))
     {
-      meta_warning ("last_focus_time (%u) is greater than comparison "
-                    "timestamp (%u).  This most likely represents a buggy "
-                    "client sending inaccurate timestamps in messages such as "
-                    "_NET_ACTIVE_WINDOW.  Trying to work around...\n",
-                    display->last_focus_time, timestamp);
+      g_warning ("last_focus_time (%u) is greater than comparison "
+                 "timestamp (%u). This most likely represents a buggy "
+                 "client sending inaccurate timestamps in messages such as "
+                 "_NET_ACTIVE_WINDOW. Trying to work around...",
+                 display->last_focus_time, timestamp);
       display->last_focus_time = timestamp;
     }
   if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_user_time))
@@ -5249,11 +5255,11 @@ sanity_check_timestamps (MetaDisplay *display,
       GSList *windows;
       GSList *tmp;
 
-      meta_warning ("last_user_time (%u) is greater than comparison "
-                    "timestamp (%u).  This most likely represents a buggy "
-                    "client sending inaccurate timestamps in messages such as "
-                    "_NET_ACTIVE_WINDOW.  Trying to work around...\n",
-                    display->last_user_time, timestamp);
+      g_warning ("last_user_time (%u) is greater than comparison "
+                 "timestamp (%u). This most likely represents a buggy "
+                 "client sending inaccurate timestamps in messages such as "
+                 "_NET_ACTIVE_WINDOW. Trying to work around...",
+                 display->last_user_time, timestamp);
       display->last_user_time = timestamp;
 
       windows = meta_display_list_windows (display, META_LIST_DEFAULT);
@@ -5264,9 +5270,9 @@ sanity_check_timestamps (MetaDisplay *display,
 
           if (XSERVER_TIME_IS_BEFORE (timestamp, window->net_wm_user_time))
             {
-              meta_warning ("%s appears to be one of the offending windows "
-                            "with a timestamp of %u.  Working around...\n",
-                            window->desc, window->net_wm_user_time);
+              g_warning ("%s appears to be one of the offending windows "
+                         "with a timestamp of %u. Working around...",
+                         window->desc, window->net_wm_user_time);
               window->net_wm_user_time = timestamp;
             }
 
diff --git a/src/core/effects.c b/src/core/effects.c
index 2ec1aec..da42a11 100644
--- a/src/core/effects.c
+++ b/src/core/effects.c
@@ -173,7 +173,7 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context)
   if (elapsed < 0)
     {
       /* Probably the system clock was set backwards? */
-      meta_warning ("System clock seemed to go backwards?\n");
+      g_warning ("System clock seemed to go backwards?");
       elapsed = G_MAXDOUBLE; /* definitely done. */
     }
 
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 9ede151..784c6ad 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -680,7 +680,11 @@ meta_change_keygrab (MetaDisplay *display,
           if (grab && result != Success)
             {
               if (result == BadAccess)
-                meta_warning (_("Some other program is already using the key %s with modifiers %x as a 
binding\n"), keysym_to_string (keysym), modmask | ignored_mask);
+                {
+                  g_warning ("Some other program is already using the key %s "
+                             "with modifiers %x as a binding",
+                             keysym_to_string (keysym), modmask | ignored_mask);
+                }
               else
                 meta_topic (META_DEBUG_KEYBINDINGS,
                             "Failed to grab key %s with modifiers %x\n",
@@ -2633,7 +2637,8 @@ process_workspace_switch_grab (MetaDisplay *display,
         }
 
       /* Workspace switching should have already occurred on KeyPress */
-      meta_warning ("target_workspace != active_workspace.  Some other event must have occurred.\n");
+      g_warning ("target_workspace != active_workspace. Some other "
+                 "event must have occurred.");
 
       return FALSE; /* end grab */
     }
diff --git a/src/core/main.c b/src/core/main.c
index 4d1c574..8fb5450 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -368,7 +368,8 @@ main (int argc, char **argv)
   GIOChannel *channel;
 
   if (setlocale (LC_ALL, "") == NULL)
-    meta_warning ("Locale not understood by C library, internationalization will not work\n");
+    g_warning ("Locale not understood by C library, internationalization "
+               "will not work");
 
   sigemptyset (&empty_mask);
   act.sa_handler = SIG_IGN;
@@ -404,9 +405,10 @@ main (int argc, char **argv)
     meta_set_debugging (TRUE);
 
   if (g_get_home_dir ())
-    if (chdir (g_get_home_dir ()) < 0)
-      meta_warning ("Could not change to home directory %s.\n",
-                    g_get_home_dir ());
+    {
+      if (chdir (g_get_home_dir ()) < 0)
+        g_warning ("Could not change to home directory %s.", g_get_home_dir ());
+    }
 
   meta_print_self_identity ();
 
diff --git a/src/core/place.c b/src/core/place.c
index 44453d5..8308f88 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -728,7 +728,7 @@ find_preferred_position (MetaWindow *window,
             break;
 
           default:
-            meta_warning ("Unknown window-placement option chosen.\n");
+            g_warning ("Unknown window-placement option chosen.");
             return FALSE;
             break;
         }
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 7d2559f..73c1f48 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1040,8 +1040,8 @@ maybe_give_disable_workarounds_warning (void)
     {
       first_disable = FALSE;
 
-      meta_warning (_("Workarounds for broken applications disabled. "
-                      "Some applications may not behave properly.\n"));
+      g_warning ("Workarounds for broken applications disabled. "
+                 "Some applications may not behave properly.");
     }
 }
 
@@ -1117,10 +1117,8 @@ titlebar_handler (GVariant *value,
 
   if (desc == NULL)
     {
-      meta_warning (_("Could not parse font description "
-                      "\"%s\" from GSettings key %s\n"),
-                    string_value ? string_value : "(null)",
-                    KEY_TITLEBAR_FONT);
+      g_warning ("Could not parse font description \"%s\" from GSettings key %s",
+                 string_value ? string_value : "(null)", KEY_TITLEBAR_FONT);
 
       return FALSE;
     }
@@ -1176,12 +1174,8 @@ mouse_button_mods_handler (GVariant *value,
 
   if (!string_value || !meta_ui_parse_modifier (string_value, &mods))
     {
-      meta_topic (META_DEBUG_KEYBINDINGS,
-                  "Failed to parse new GSettings value\n");
-
-      meta_warning (_("\"%s\" found in configuration database is "
-                      "not a valid value for mouse button modifier\n"),
-                    string_value);
+      g_warning ("\"%s\" found in configuration database is not a valid value "
+                 "for mouse button modifier", string_value);
 
       return FALSE;
     }
@@ -1427,8 +1421,8 @@ update_binding (MetaKeyPref *binding,
         {
           meta_topic (META_DEBUG_KEYBINDINGS,
                       "Failed to parse new GSettings value\n");
-          meta_warning (_("\"%s\" found in configuration database is not a valid value for keybinding 
\"%s\"\n"),
-                        strokes[i], binding->name);
+          g_warning ("\"%s\" found in configuration database is not a valid "
+                     "value for keybinding \"%s\"", strokes[i], binding->name);
 
           /* Value is kept and will thus be removed next time we save the key.
            * Changing the key in response to a modification could lead to cyclic calls. */
@@ -1443,10 +1437,8 @@ update_binding (MetaKeyPref *binding,
           0 != keysym &&
           (META_VIRTUAL_SHIFT_MASK == mods || 0 == mods))
         {
-          meta_warning ("Cannot bind \"%s\" to %s: it needs a modifier "
-                        "such as Ctrl or Alt.\n",
-                        binding->name,
-                        strokes[i]);
+          g_warning ("Cannot bind \"%s\" to %s: it needs a modifier "
+                     "such as Ctrl or Alt.", binding->name, strokes[i]);
 
           /* Value is kept and will thus be removed next time we save the key.
            * Changing the key in response to a modification could lead to cyclic calls. */
@@ -1625,7 +1617,7 @@ meta_prefs_add_keybinding (const char           *name,
 
   if (g_hash_table_lookup (key_bindings, name))
     {
-      meta_warning ("Trying to re-add keybinding \"%s\".\n", name);
+      g_warning ("Trying to re-add keybinding \"%s\".", name);
       return FALSE;
     }
 
@@ -1786,10 +1778,11 @@ meta_prefs_get_compositing_manager (void)
     {
       if (!warned)
         {
-          meta_warning (_("Missing %s extension required for compositing\n"),
-                        !META_DISPLAY_HAS_COMPOSITE (display) ? "composite" :
-                        !META_DISPLAY_HAS_DAMAGE (display) ? "damage" :
-                        !META_DISPLAY_HAS_XFIXES (display) ? "xfixes" : "render");
+          g_warning ("Missing %s extension required for compositing",
+                     !META_DISPLAY_HAS_COMPOSITE (display) ? "composite" :
+                     !META_DISPLAY_HAS_DAMAGE (display) ? "damage" :
+                     !META_DISPLAY_HAS_XFIXES (display) ? "xfixes" : "render");
+
           warned = TRUE;
         }
 
diff --git a/src/core/screen.c b/src/core/screen.c
index fd59893..b384ec7 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -362,8 +362,7 @@ meta_screen_new (MetaDisplay *display,
    */
   if (xroot == None)
     {
-      meta_warning (_("Screen %d on display '%s' is invalid\n"),
-                    number, display->name);
+      g_warning ("Screen %d on display '%s' is invalid", number, display->name);
       return NULL;
     }
 
@@ -378,8 +377,9 @@ meta_screen_new (MetaDisplay *display,
 
       if (!replace_current_wm)
         {
-          meta_warning (_("Screen %d on display \"%s\" already has a window manager; try using the --replace 
option to replace the current window manager.\n"),
-                        number, display->name);
+          g_warning ("Screen %d on display \"%s\" already has a window "
+                     "manager; try using the --replace option to replace the "
+                     "current window manager.", number, display->name);
 
           return NULL;
         }
@@ -405,8 +405,8 @@ meta_screen_new (MetaDisplay *display,
 
   if (XGetSelectionOwner (xdisplay, wm_sn_atom) != new_wm_sn_owner)
     {
-      meta_warning (_("Could not acquire window manager selection on screen %d display \"%s\"\n"),
-                    number, display->name);
+      g_warning ("Could not acquire window manager selection on "
+                 "screen %d display \"%s\"", number, display->name);
 
       XDestroyWindow (xdisplay, new_wm_sn_owner);
 
@@ -461,8 +461,8 @@ meta_screen_new (MetaDisplay *display,
                 attr.your_event_mask);
   if (meta_error_trap_pop_with_return (display) != Success)
     {
-      meta_warning (_("Screen %d on display \"%s\" already has a window manager\n"),
-                    number, display->name);
+      g_warning ("Screen %d on display \"%s\" already has a window manager",
+                 number, display->name);
 
       XDestroyWindow (xdisplay, new_wm_sn_owner);
 
@@ -523,7 +523,9 @@ meta_screen_new (MetaDisplay *display,
         XFreeFontInfo (NULL, font_info, 1);
       }
     else
-      meta_warning ("xserver doesn't have 'fixed' font.\n");
+      {
+        g_warning ("xserver doesn't have 'fixed' font.");
+      }
 
     screen->root_xor_gc = XCreateGC (screen->display->xdisplay,
                                      screen->xroot,
@@ -661,8 +663,10 @@ meta_screen_free (MetaScreen *screen,
   meta_error_trap_push (screen->display);
   XSelectInput (screen->display->xdisplay, screen->xroot, 0);
   if (meta_error_trap_pop_with_return (screen->display) != Success)
-    meta_warning (_("Could not release screen %d on display \"%s\"\n"),
-                  screen->number, screen->display->name);
+    {
+      g_warning ("Could not release screen %d on display \"%s\"",
+                 screen->number, screen->display->name);
+    }
 
   unset_wm_check_hint (screen);
 
@@ -1734,7 +1738,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
               screen->vertical_workspaces = TRUE;
               break;
             default:
-              meta_warning ("Someone set a weird orientation in _NET_DESKTOP_LAYOUT\n");
+              g_warning ("Someone set a weird orientation in _NET_DESKTOP_LAYOUT");
               break;
             }
 
@@ -1743,7 +1747,8 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
 
           if (rows <= 0 && cols <= 0)
             {
-              meta_warning ("Columns = %d rows = %d in _NET_DESKTOP_LAYOUT makes no sense\n", rows, cols);
+              g_warning ("Columns = %d rows = %d in _NET_DESKTOP_LAYOUT makes no sense",
+                         rows, cols);
             }
           else
             {
@@ -1775,7 +1780,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
                     screen->starting_corner = META_SCREEN_BOTTOMLEFT;
                     break;
                   default:
-                    meta_warning ("Someone set a weird starting corner in _NET_DESKTOP_LAYOUT\n");
+                    g_warning ("Someone set a weird starting corner in _NET_DESKTOP_LAYOUT");
                     break;
                 }
             }
@@ -1784,8 +1789,8 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
         }
       else
         {
-          meta_warning ("Someone set _NET_DESKTOP_LAYOUT to %d integers instead of 4 "
-                        "(3 is accepted for backwards compat)\n", n_items);
+          g_warning ("Someone set _NET_DESKTOP_LAYOUT to %d integers instead of 4 "
+                     "(3 is accepted for backwards compat)", n_items);
         }
 
       meta_XFree (list);
diff --git a/src/core/session.c b/src/core/session.c
index cd35bd5..5c23bbb 100644
--- a/src/core/session.c
+++ b/src/core/session.c
@@ -867,15 +867,15 @@ save_state (void)
   if (mkdir (metacity_dir, 0700) < 0 &&
       errno != EEXIST)
     {
-      meta_warning (_("Could not create directory '%s': %s\n"),
-                    metacity_dir, g_strerror (errno));
+      g_warning ("Could not create directory '%s': %s",
+                 metacity_dir, g_strerror (errno));
     }
 
   if (mkdir (session_dir, 0700) < 0 &&
       errno != EEXIST)
     {
-      meta_warning (_("Could not create directory '%s': %s\n"),
-                    session_dir, g_strerror (errno));
+      g_warning ("Could not create directory '%s': %s",
+                 session_dir, g_strerror (errno));
     }
 
   meta_topic (META_DEBUG_SM, "Saving session to '%s'\n", full_save_file ());
@@ -884,8 +884,8 @@ save_state (void)
 
   if (outfile == NULL)
     {
-      meta_warning (_("Could not open session file '%s' for writing: %s\n"),
-                    full_save_file (), g_strerror (errno));
+      g_warning ("Could not open session file '%s' for writing: %s",
+                 full_save_file (), g_strerror (errno));
       goto out;
     }
 
@@ -1025,13 +1025,13 @@ save_state (void)
       /* FIXME need a dialog for this */
       if (ferror (outfile))
         {
-          meta_warning (_("Error writing session file '%s': %s\n"),
-                        full_save_file (), g_strerror (errno));
+          g_warning ("Error writing session file '%s': %s",
+                     full_save_file (), g_strerror (errno));
         }
       if (fclose (outfile))
         {
-          meta_warning (_("Error closing session file '%s': %s\n"),
-                        full_save_file (), g_strerror (errno));
+          g_warning ("Error closing session file '%s': %s",
+                     full_save_file (), g_strerror (errno));
         }
     }
 
@@ -1160,8 +1160,7 @@ load_state (const char *previous_save_file)
 
  error:
 
-  meta_warning (_("Failed to parse saved session file: %s\n"),
-                error->message);
+  g_warning ("Failed to parse saved session file: %s", error->message);
   g_error_free (error);
 
   if (parse_data.info)
diff --git a/src/core/stack.c b/src/core/stack.c
index 481995a..18ef333 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -1591,8 +1591,8 @@ meta_stack_set_positions (MetaStack *stack,
 
   if (!lists_contain_same_windows (windows, stack->sorted))
     {
-      meta_warning ("This list of windows has somehow changed; not resetting "
-                    "positions of the windows.\n");
+      g_warning ("This list of windows has somehow changed; not resetting "
+                 "positions of the windows.");
       return;
     }
 
diff --git a/src/core/util.c b/src/core/util.c
index 65d3ade..1b28d33 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -63,8 +63,7 @@ ensure_logfile (void)
 
       if (err != NULL)
         {
-          meta_warning (_("Failed to open debug log: %s\n"),
-                        err->message);
+          g_warning ("Failed to open debug log: %s", err->message);
           g_error_free (err);
           return;
         }
@@ -73,8 +72,8 @@ ensure_logfile (void)
 
       if (logfile == NULL)
         {
-          meta_warning (_("Failed to fdopen() log file %s: %s\n"),
-                        filename, strerror (errno));
+          g_warning ("Failed to fdopen() log file %s: %s",
+                     filename, strerror (errno));
           close (fd);
         }
       else
@@ -313,30 +312,6 @@ meta_bug (const char *format, ...)
 }
 
 void
-meta_warning (const char *format, ...)
-{
-  va_list args;
-  gchar *str;
-  FILE *out;
-
-  g_return_if_fail (format != NULL);
-
-  va_start (args, format);
-  str = g_strdup_vprintf (format, args);
-  va_end (args);
-
-  out = logfile ? logfile : stderr;
-
-  if (no_prefix == 0)
-    utf8_fputs (_("Window manager warning: "), out);
-  utf8_fputs (str, out);
-
-  fflush (out);
-
-  g_free (str);
-}
-
-void
 meta_fatal (const char *format, ...)
 {
   va_list args;
@@ -534,7 +509,7 @@ meta_show_dialog (const char *type,
 
   if (error)
     {
-      meta_warning ("%s\n", error->message);
+      g_warning ("%s", error->message);
       g_error_free (error);
     }
 
diff --git a/src/core/window-props.c b/src/core/window-props.c
index ca7cd06..c835431 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -222,8 +222,8 @@ complain_about_broken_client (MetaWindow    *window,
                               MetaPropValue *value,
                               gboolean       initial)
 {
-  meta_warning ("Broken client! Window %s changed client leader window or SM client ID\n",
-                window->desc);
+  g_warning ("Broken client! Window %s changed client leader window "
+             "or SM client ID", window->desc);
 }
 
 static void
@@ -405,8 +405,9 @@ reload_net_wm_pid (MetaWindow    *window,
       gulong cardinal = (int) value->v.cardinal;
 
       if (cardinal <= 0)
-        meta_warning (_("Application set a bogus _NET_WM_PID %lu\n"),
-                      cardinal);
+        {
+          g_warning ("Application set a bogus _NET_WM_PID %lu", cardinal);
+        }
       else
         {
           window->net_wm_pid = cardinal;
@@ -1617,8 +1618,8 @@ reload_transient_for (MetaWindow    *window,
       parent = meta_display_lookup_x_window (window->display, transient_for);
       if (!parent)
         {
-          meta_warning ("Invalid WM_TRANSIENT_FOR window 0x%lx specified for %s.\n",
-                        transient_for, window->desc);
+          g_warning ("Invalid WM_TRANSIENT_FOR window 0x%lx specified for %s.",
+                     transient_for, window->desc);
           transient_for = None;
         }
 
@@ -1627,8 +1628,8 @@ reload_transient_for (MetaWindow    *window,
         {
           if (parent == window)
             {
-              meta_warning ("WM_TRANSIENT_FOR window 0x%lx for %s would create loop.\n",
-                            transient_for, window->desc);
+              g_warning ("WM_TRANSIENT_FOR window 0x%lx for %s would create loop.",
+                         transient_for, window->desc);
               transient_for = None;
               break;
             }
diff --git a/src/core/window.c b/src/core/window.c
index 5eda0a3..e2a2d36 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3212,8 +3212,8 @@ window_activate (MetaWindow     *window,
   /* For those stupid pagers, get a valid timestamp and show a warning */
   if (timestamp == 0)
     {
-      meta_warning ("meta_window_activate called by a pager with a 0 timestamp; "
-                    "the pager needs to be fixed.\n");
+      g_warning ("meta_window_activate called by a pager with a 0 timestamp; "
+                 "the pager needs to be fixed.");
       timestamp = meta_display_get_current_time_roundtrip (window->display);
     }
 
@@ -4189,7 +4189,9 @@ meta_window_configure_notify (MetaWindow      *window,
   window->rect.height = event->height;
 
   if (!event->override_redirect && !event->send_event)
-    meta_warning ("Unhandled change of windows override redirect status\n");
+    {
+      g_warning ("Unhandled change of windows override redirect status");
+    }
 }
 
 void
@@ -4965,11 +4967,10 @@ meta_window_raise (MetaWindow  *window)
     meta_stack_raise (window->screen->stack, ancestor);
   else
     {
-      meta_warning (
-                    "Either stacks aren't per screen or some window has a weird "
-                    "transient_for hint; window->screen->stack != "
-                    "ancestor->screen->stack.  window = %s, ancestor = %s.\n",
-                    window->desc, ancestor->desc);
+      g_warning ("Either stacks aren't per screen or some window has a weird "
+                 "transient_for hint; window->screen->stack != "
+                 "ancestor->screen->stack.  window = %s, ancestor = %s.",
+                  window->desc, ancestor->desc);
       /* We could raise the window here, but don't want to do that twice and
        * so we let the case below handle that.
        */
@@ -5395,10 +5396,9 @@ meta_window_client_message (MetaWindow *window,
         timestamp = event->xclient.data.l[0];
       else
         {
-          meta_warning ("Receiving a NET_CLOSE_WINDOW message for %s without "
-                        "a timestamp!  This means some buggy (outdated) "
-                        "application is on the loose!\n",
-                        window->desc);
+          g_warning ("Receiving a NET_CLOSE_WINDOW message for %s without "
+                     "a timestamp!  This means some buggy (outdated) "
+                     "application is on the loose!", window->desc);
           timestamp = meta_display_get_current_time (window->display);
         }
 
@@ -5822,9 +5822,8 @@ meta_window_client_message (MetaWindow *window,
       if (timestamp == 0)
         {
           /* Client using older EWMH _NET_ACTIVE_WINDOW without a timestamp */
-          meta_warning ("Buggy client sent a _NET_ACTIVE_WINDOW message with a "
-                        "timestamp of 0 for %s\n",
-                        window->desc);
+          g_warning ("Buggy client sent a _NET_ACTIVE_WINDOW message with a "
+                     "timestamp of 0 for %s", window->desc);
           timestamp = meta_display_get_current_time (display);
         }
 
@@ -6205,8 +6204,11 @@ update_sm_hints (MetaWindow *window)
                                            &str))
             {
               if (window->sm_client_id == NULL) /* first time through */
-                meta_warning (_("Window %s sets SM_CLIENT_ID on itself, instead of on the WM_CLIENT_LEADER 
window as specified in the ICCCM.\n"),
-                              window->desc);
+                {
+                  g_warning ("Window %s sets SM_CLIENT_ID on itself, instead "
+                             "of on the WM_CLIENT_LEADER window as specified "
+                             "in the ICCCM.", window->desc);
+                }
 
               window->sm_client_id = g_strdup (str);
               meta_XFree (str);
@@ -6567,8 +6569,8 @@ recalc_window_type (MetaWindow *window)
           atom_name = XGetAtomName (window->display->xdisplay, window->type_atom);
           meta_error_trap_pop (window->display);
 
-          meta_warning ("Unrecognized type atom [%s] set for %s \n",
-                        atom_name ? atom_name : "unknown", window->desc);
+          g_warning ("Unrecognized type atom [%s] set for %s",
+                     atom_name ? atom_name : "unknown", window->desc);
 
           if (atom_name)
             XFree (atom_name);
@@ -6775,12 +6777,11 @@ recalc_window_features (MetaWindow *window)
        * about these apps but make them work.
        */
 
-      meta_warning (_("Window %s sets an MWM hint indicating it isn't resizable, but sets min size %d x %d 
and max size %d x %d; this doesn't make much sense.\n"),
-                    window->desc,
-                    window->size_hints.min_width,
-                    window->size_hints.min_height,
-                    window->size_hints.max_width,
-                    window->size_hints.max_height);
+      g_warning ("Window %s sets an MWM hint indicating it isn't resizable, "
+                 "but sets min size %d x %d and max size %d x %d; this "
+                 "doesn't make much sense.", window->desc,
+                 window->size_hints.min_width, window->size_hints.min_height,
+                 window->size_hints.max_width, window->size_hints.max_height);
     }
 
   window->has_shade_func = TRUE;
@@ -7070,7 +7071,7 @@ menu_callback (MetaWindowMenu *menu,
           break;
 
         default:
-          meta_warning (G_STRLOC": Unknown window op\n");
+          g_warning (G_STRLOC": Unknown window op");
           break;
         }
 
@@ -8278,7 +8279,7 @@ meta_window_get_current_tile_area (MetaWindow *window,
   tile_monitor_number = window->tile_monitor_number;
   if (tile_monitor_number < 0)
     {
-      meta_warning ("%s called with an invalid monitor number; using 0 instead\n", G_STRFUNC);
+      g_warning ("%s called with an invalid monitor number; using 0 instead", G_STRFUNC);
       tile_monitor_number = 0;
     }
 
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 6a456c4..3e150f2 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -653,9 +653,10 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
 #define MIN_SANE_AREA 100
   if (work_area.width < MIN_SANE_AREA)
     {
-      meta_warning ("struts occupy an unusually large percentage of the screen; "
-                    "available remaining width = %d < %d",
-                    work_area.width, MIN_SANE_AREA);
+      g_warning ("struts occupy an unusually large percentage of the screen; "
+                 "available remaining width = %d < %d",
+                 work_area.width, MIN_SANE_AREA);
+
       if (work_area.width < 1)
         {
           work_area.x = (workspace->screen->rect.width - MIN_SANE_AREA)/2;
@@ -670,9 +671,10 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
     }
   if (work_area.height < MIN_SANE_AREA)
     {
-      meta_warning ("struts occupy an unusually large percentage of the screen; "
-                    "available remaining height = %d < %d",
-                    work_area.height, MIN_SANE_AREA);
+      g_warning ("struts occupy an unusually large percentage of the screen; "
+                 "available remaining height = %d < %d",
+                  work_area.height, MIN_SANE_AREA);
+
       if (work_area.height < 1)
         {
           work_area.y = (workspace->screen->rect.height - MIN_SANE_AREA)/2;
@@ -887,11 +889,10 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
 {
   if (timestamp == CurrentTime)
     {
-      meta_warning ("CurrentTime used to choose focus window; "
-                    "focus window may not be correct.\n");
+      g_warning ("CurrentTime used to choose focus window; "
+                 "focus window may not be correct.");
     }
 
-
   if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
       !workspace->screen->display->mouse_mode)
     focus_ancestor_or_top_window (workspace, not_this_one, timestamp);
diff --git a/src/core/xprops.c b/src/core/xprops.c
index ae45f5f..428b51f 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -150,14 +150,17 @@ validate_or_free_results (GetPropertyResults *results,
   if (res_name == NULL)
     res_name = "unknown";
 
-  meta_warning (_("Window 0x%lx has property %s\nthat was expected to have type %s format %d\nand actually 
has type %s format %d n_items %d.\nThis is most likely an application bug, not a window manager bug.\nThe 
window has title=\"%s\" class=\"%s\" name=\"%s\"\n"),
-                results->xwindow,
-                prop_name ? prop_name : "(bad atom)",
-                expected_name ? expected_name : "(bad atom)",
-                expected_format,
-                type_name ? type_name : "(bad atom)",
-                results->format, (int) results->n_items,
-                title, res_class, res_name);
+  g_warning ("Window 0x%lx has property %s\nthat was expected to have type "
+             "%s format %d\nand actually has type %s format %d n_items %d.\n"
+             "This is most likely an application bug, not a window manager "
+             "bug.\nThe window has title=\"%s\" class=\"%s\" name=\"%s\"",
+             results->xwindow,
+             prop_name ? prop_name : "(bad atom)",
+             expected_name ? expected_name : "(bad atom)",
+             expected_format,
+             type_name ? type_name : "(bad atom)",
+             results->format, (int) results->n_items,
+             title, res_class, res_name);
 
   if (type_name)
     XFree (type_name);
@@ -406,8 +409,8 @@ utf8_string_from_results (GetPropertyResults *results,
       char *name;
 
       name = XGetAtomName (results->display->xdisplay, results->xatom);
-      meta_warning (_("Property %s on window 0x%lx contained invalid UTF-8\n"),
-                    name, results->xwindow);
+      g_warning ("Property %s on window 0x%lx contained invalid UTF-8",
+                 name, results->xwindow);
       meta_XFree (name);
       XFree (results->prop);
       results->prop = NULL;
@@ -489,8 +492,10 @@ utf8_list_from_results (GetPropertyResults *results,
           meta_error_trap_push (results->display);
           name = XGetAtomName (results->display->xdisplay, results->xatom);
           meta_error_trap_pop (results->display);
-          meta_warning (_("Property %s on window 0x%lx contained invalid UTF-8 for item %d in the list\n"),
-                        name, results->xwindow, i);
+
+          g_warning ("Property %s on window 0x%lx contained invalid UTF-8 "
+                     "for item %d in the list", name, results->xwindow, i);
+
           meta_XFree (name);
           meta_XFree (results->prop);
           results->prop = NULL;
diff --git a/src/include/util.h b/src/include/util.h
index a5efe74..436043c 100644
--- a/src/include/util.h
+++ b/src/include/util.h
@@ -40,8 +40,6 @@ void meta_verbose (const char *format,
 
 void meta_bug        (const char *format,
                       ...) G_GNUC_PRINTF (1, 2);
-void meta_warning    (const char *format,
-                      ...) G_GNUC_PRINTF (1, 2);
 void meta_fatal      (const char *format,
                       ...) G_GNUC_PRINTF (1, 2);
 
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 5ec8df4..116f99d 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -833,7 +833,9 @@ meta_frames_unmanage_window (MetaFrames *frames,
       g_free (frame);
     }
   else
-    meta_warning ("Frame 0x%lx not managed, can't unmanage\n", xwindow);
+    {
+      g_warning ("Frame 0x%lx not managed, can't unmanage", xwindow);
+    }
 }
 
 static MetaUIFrame*
diff --git a/src/ui/menu.c b/src/ui/menu.c
index e1bc016..cda6043 100644
--- a/src/ui/menu.c
+++ b/src/ui/menu.c
@@ -466,7 +466,9 @@ meta_window_menu_popup (MetaWindowMenu     *menu,
                           event);
 
   if (!gtk_widget_get_visible (menu->menu))
-    meta_warning ("GtkMenu failed to grab the pointer\n");
+    {
+      g_warning ("GtkMenu failed to grab the pointer");
+    }
 }
 
 void



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