mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-13 11:15:12 +01:00
Patch from Havoc Pennington to add functions for setting and getting a
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com> * glib/gutils.[ch] (g_set/get_application_name): Patch from Havoc Pennington to add functions for setting and getting a human readable application name. * configure.in: Up to version 2.1.3, since we'll need to depend on last addition for GTK+.
This commit is contained in:
parent
6e00ee85b9
commit
10520a9228
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gutils.[ch] (g_set/get_application_name):
|
||||
Patch from Havoc Pennington to add functions for
|
||||
setting and getting a human readable application
|
||||
name.
|
||||
|
||||
* configure.in: Up to version 2.1.3, since we'll
|
||||
need to depend on last addition for GTK+.
|
||||
|
||||
2002-11-06 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/glib.def: Add g_main_thread_init.
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gutils.[ch] (g_set/get_application_name):
|
||||
Patch from Havoc Pennington to add functions for
|
||||
setting and getting a human readable application
|
||||
name.
|
||||
|
||||
* configure.in: Up to version 2.1.3, since we'll
|
||||
need to depend on last addition for GTK+.
|
||||
|
||||
2002-11-06 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/glib.def: Add g_main_thread_init.
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gutils.[ch] (g_set/get_application_name):
|
||||
Patch from Havoc Pennington to add functions for
|
||||
setting and getting a human readable application
|
||||
name.
|
||||
|
||||
* configure.in: Up to version 2.1.3, since we'll
|
||||
need to depend on last addition for GTK+.
|
||||
|
||||
2002-11-06 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/glib.def: Add g_main_thread_init.
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gutils.[ch] (g_set/get_application_name):
|
||||
Patch from Havoc Pennington to add functions for
|
||||
setting and getting a human readable application
|
||||
name.
|
||||
|
||||
* configure.in: Up to version 2.1.3, since we'll
|
||||
need to depend on last addition for GTK+.
|
||||
|
||||
2002-11-06 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/glib.def: Add g_main_thread_init.
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gutils.[ch] (g_set/get_application_name):
|
||||
Patch from Havoc Pennington to add functions for
|
||||
setting and getting a human readable application
|
||||
name.
|
||||
|
||||
* configure.in: Up to version 2.1.3, since we'll
|
||||
need to depend on last addition for GTK+.
|
||||
|
||||
2002-11-06 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/glib.def: Add g_main_thread_init.
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gutils.[ch] (g_set/get_application_name):
|
||||
Patch from Havoc Pennington to add functions for
|
||||
setting and getting a human readable application
|
||||
name.
|
||||
|
||||
* configure.in: Up to version 2.1.3, since we'll
|
||||
need to depend on last addition for GTK+.
|
||||
|
||||
2002-11-06 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/glib.def: Add g_main_thread_init.
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 7 19:32:26 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gutils.[ch] (g_set/get_application_name):
|
||||
Patch from Havoc Pennington to add functions for
|
||||
setting and getting a human readable application
|
||||
name.
|
||||
|
||||
* configure.in: Up to version 2.1.3, since we'll
|
||||
need to depend on last addition for GTK+.
|
||||
|
||||
2002-11-06 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/glib.def: Add g_main_thread_init.
|
||||
|
@ -33,7 +33,7 @@ GLIB_AC_DIVERT_BEFORE_HELP([
|
||||
#
|
||||
GLIB_MAJOR_VERSION=2
|
||||
GLIB_MINOR_VERSION=1
|
||||
GLIB_MICRO_VERSION=0
|
||||
GLIB_MICRO_VERSION=3
|
||||
GLIB_INTERFACE_AGE=0
|
||||
GLIB_BINARY_AGE=`expr 100 '*' $GLIB_MINOR_VERSION + $GLIB_MICRO_VERSION`
|
||||
GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
|
||||
|
@ -16,7 +16,8 @@ These are portable utility functions.
|
||||
|
||||
<!-- ##### FUNCTION g_get_prgname ##### -->
|
||||
<para>
|
||||
Gets the name of the program.
|
||||
Gets the name of the program. This name should NOT be localized,
|
||||
contrast with g_get_application_name().
|
||||
(If you are using GDK or GTK+ the program name is set in gdk_init(), which
|
||||
is called by gtk_init(). The program name is found by taking the last
|
||||
component of <literal>argv[0]</literal>.)
|
||||
@ -27,7 +28,9 @@ component of <literal>argv[0]</literal>.)
|
||||
|
||||
<!-- ##### FUNCTION g_set_prgname ##### -->
|
||||
<para>
|
||||
Sets the name of the program.
|
||||
Sets the name of the program. This name should NOT be localized,
|
||||
contrast with g_set_application_name(). Note that for thread-safety
|
||||
reasons this function can only be called once.
|
||||
</para>
|
||||
|
||||
@prgname: the name of the program.
|
||||
|
@ -997,6 +997,70 @@ g_set_prgname (const gchar *prgname)
|
||||
G_UNLOCK (g_prgname);
|
||||
}
|
||||
|
||||
G_LOCK_DEFINE (g_application_name);
|
||||
static gchar *g_application_name = NULL;
|
||||
|
||||
/**
|
||||
* g_get_application_name:
|
||||
*
|
||||
* Gets a human-readable name for the application, as set by
|
||||
* g_set_application_name(). This name should be localized if
|
||||
* possible, and is intended for display to the user. Contrast with
|
||||
* g_get_prgname(), which gets a non-localized name. If
|
||||
* g_set_application_name() has not been called, returns the result of
|
||||
* g_get_prgname() (which may be %NULL if g_set_prgname() has also not
|
||||
* been called).
|
||||
*
|
||||
* Return value: human-readable application name. may return %NULL
|
||||
**/
|
||||
G_CONST_RETURN gchar*
|
||||
g_get_application_name (void)
|
||||
{
|
||||
gchar* retval;
|
||||
|
||||
G_LOCK (g_application_name);
|
||||
retval = g_application_name;
|
||||
G_UNLOCK (g_application_name);
|
||||
|
||||
if (retval == NULL)
|
||||
return g_get_prgname ();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_set_application_name:
|
||||
* @application_name: localized name of the application
|
||||
*
|
||||
* Sets a human-readable name for the application. This name should be
|
||||
* localized if possible, and is intended for display to the user.
|
||||
* Contrast with g_set_prgname(), which sets a non-localized name.
|
||||
* g_set_prgname() will be called automatically by gtk_init(),
|
||||
* but g_set_application_name() will not.
|
||||
*
|
||||
* Note that for thread safety reasons, this function can only
|
||||
* be called once.
|
||||
*
|
||||
* The application name will be used in contexts such as error messages,
|
||||
* or when displaying an application's name in the task list.
|
||||
*
|
||||
**/
|
||||
void
|
||||
g_set_application_name (const gchar *application_name)
|
||||
{
|
||||
gboolean already_set = FALSE;
|
||||
|
||||
G_LOCK (g_application_name);
|
||||
if (g_application_name)
|
||||
already_set = TRUE;
|
||||
else
|
||||
g_application_name = g_strdup (application_name);
|
||||
G_UNLOCK (g_application_name);
|
||||
|
||||
if (already_set)
|
||||
g_warning ("g_set_application() name called multiple times");
|
||||
}
|
||||
|
||||
guint
|
||||
g_direct_hash (gconstpointer v)
|
||||
{
|
||||
|
@ -119,6 +119,8 @@ G_CONST_RETURN gchar* g_get_home_dir (void);
|
||||
G_CONST_RETURN gchar* g_get_tmp_dir (void);
|
||||
gchar* g_get_prgname (void);
|
||||
void g_set_prgname (const gchar *prgname);
|
||||
G_CONST_RETURN gchar* g_get_application_name (void);
|
||||
void g_set_application_name (const gchar *application_name);
|
||||
|
||||
|
||||
typedef struct _GDebugKey GDebugKey;
|
||||
|
Loading…
x
Reference in New Issue
Block a user