Commit f0853bc5 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

util: replace meta_warning with g_warning

parent f69dac6e
......@@ -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
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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));
}
}
......
......@@ -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;
}
......
......@@ -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. */
}
......
......@@ -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 */
}
......
......@@ -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 ();
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -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
......@@ -312,30 +311,6 @@ meta_bug (const char *format, ...)
abort ();
}
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, ...)
{
......@@ -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);
}
......
......@@ -222,8 +222,8 @@ complain_about_broken_client (MetaWindow *window,
MetaPropValue *value,
gboolean initial)