g_set_prgname()



Sat Dec  8 16:12:10 2001  Christopher Blizzard  <blizzard redhat com>

        * gdk/gdk.c (gdk_init_check): Fallback to setting the prgname to
        "<unknown>" if someone doesn't pass in a valid argc.  (Patch from
        Fabrice Bellet <fabrice gnu org>, #54127).

this is a bad idea, you'd need to at least check g_get_prgname()
before hand, since:

  g_set_prgname (argv[0]);
  gtk_init (NULL, NULL);
  g_print ("%s\n", g_get_prgname ());
==>"<unknown>"

but even then, if g_get_prgname() was supposed to yield a program
name, even if none was set, this change should go into GLib, not Gdk
(or Gtk or GNOME or some other random module).
but g_get_prgname() is actually supposed to return NULL if no program
name was set, so code can do special casing when it doesn't know a
program name, e.g. so you don't end up with multiple senseless
window titles, upon doing something like:
if (g_get_prgname ())
  gtk_window_set_title (window, g_get_prgname ());

---
ciaoTJ




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