gucharmap r1641 - trunk/gucharmap
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gucharmap r1641 - trunk/gucharmap
- Date: Fri, 21 Mar 2008 10:48:43 +0000 (GMT)
Author: chpe
Date: Fri Mar 21 10:48:42 2008
New Revision: 1641
URL: http://svn.gnome.org/viewvc/gucharmap?rev=1641&view=rev
Log:
Add explicit init/shutdown functions, and remove the internal gettext init function.
Added:
trunk/gucharmap/gucharmap-init.c
- copied, changed from r1640, /trunk/gucharmap/gucharmap.h
trunk/gucharmap/gucharmap-init.h
Removed:
trunk/gucharmap/gucharmap-intl.c
Modified:
trunk/gucharmap/Makefile.am
trunk/gucharmap/gucharmap-block-chapters-model.c
trunk/gucharmap/gucharmap-charmap.c
trunk/gucharmap/gucharmap-mini-fontsel.c
trunk/gucharmap/gucharmap-script-chapters-model.c
trunk/gucharmap/gucharmap-script-codepoint-list.c
trunk/gucharmap/gucharmap-search-dialog.c
trunk/gucharmap/gucharmap-unicode-info.c
trunk/gucharmap/gucharmap-window.c
trunk/gucharmap/gucharmap.h
trunk/gucharmap/main.c
Modified: trunk/gucharmap/Makefile.am
==============================================================================
--- trunk/gucharmap/Makefile.am (original)
+++ trunk/gucharmap/Makefile.am Fri Mar 21 10:48:42 2008
@@ -33,7 +33,8 @@
gucharmap-chartable-cell-accessible.c gucharmap-chartable-cell-accessible.h \
gucharmap-chartable.c gucharmap-chartable.h gucharmap-chartable-private.h \
gucharmap-codepoint-list.c gucharmap-codepoint-list.h \
- gucharmap-intl.c gucharmap-intl.h \
+ gucharmap-intl.h \
+ gucharmap-init.c gucharmap-init.h \
gucharmap-marshal.c gucharmap-marshal.h \
gucharmap-mini-fontsel.c gucharmap-mini-fontsel.h \
gucharmap-script-chapters-model.c gucharmap-script-chapters-model.h \
@@ -73,13 +74,14 @@
libgucharmapincludedir = $(includedir)/gucharmap-2/gucharmap
libgucharmapinclude_HEADERS = \
- gucharmap.h \
gucharmap-block-chapters-model.h \
gucharmap-chapters-model.h \
gucharmap-chapters-view.h \
gucharmap-charmap.h \
gucharmap-chartable.h \
gucharmap-codepoint-list.h \
+ gucharmap.h \
+ gucharmap-init.h \
gucharmap-mini-fontsel.h \
gucharmap-script-chapters-model.h \
gucharmap-script-codepoint-list.h \
Modified: trunk/gucharmap/gucharmap-block-chapters-model.c
==============================================================================
--- trunk/gucharmap/gucharmap-block-chapters-model.c (original)
+++ trunk/gucharmap/gucharmap-block-chapters-model.c Fri Mar 21 10:48:42 2008
@@ -125,8 +125,6 @@
{
GucharmapChaptersModelClass *chapters_class = GUCHARMAP_CHAPTERS_MODEL_CLASS (clazz);
- _gucharmap_intl_ensure_initialized ();
-
chapters_class->title = _("Unicode Block");
chapters_class->character_to_iter = character_to_iter;
chapters_class->get_codepoint_list = get_codepoint_list;
Modified: trunk/gucharmap/gucharmap-charmap.c
==============================================================================
--- trunk/gucharmap/gucharmap-charmap.c (original)
+++ trunk/gucharmap/gucharmap-charmap.c Fri Mar 21 10:48:42 2008
@@ -118,8 +118,6 @@
{
GObjectClass *object_class = G_OBJECT_CLASS (clazz);
- _gucharmap_intl_ensure_initialized ();
-
object_class->set_property = gucharmap_charmap_set_property;
object_class->finalize = gucharmap_charmap_finalize;
Copied: trunk/gucharmap/gucharmap-init.c (from r1640, /trunk/gucharmap/gucharmap.h)
==============================================================================
--- /trunk/gucharmap/gucharmap.h (original)
+++ trunk/gucharmap/gucharmap-init.c Fri Mar 21 10:48:42 2008
@@ -1,6 +1,5 @@
-/* $Id$ */
/*
- * Copyright (c) 2004 Noah Levitt
+ * Copyright (C) 2007 Christian Persch
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -17,23 +16,38 @@
* 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
*/
-#ifndef GUCHARMAP_H
-#define GUCHARMAP_H
+#include <config.h>
-#define __GUCHARMAP_GUCHARMAP_H_INSIDE__
+#include <glib/gi18n-lib.h>
-#include <gucharmap/gucharmap-block-chapters-model.h>
-#include <gucharmap/gucharmap-chapters-model.h>
-#include <gucharmap/gucharmap-charmap.h>
-#include <gucharmap/gucharmap-chartable.h>
-#include <gucharmap/gucharmap-codepoint-list.h>
-#include <gucharmap/gucharmap-mini-fontsel.h>
-#include <gucharmap/gucharmap-script-chapters-model.h>
-#include <gucharmap/gucharmap-script-codepoint-list.h>
-#include <gucharmap/gucharmap-search-dialog.h>
-#include <gucharmap/gucharmap-unicode-info.h>
-#include <gucharmap/gucharmap-window.h>
+#include "gucharmap-init.h"
+#include "gucharmap-settings.h"
-#undef __GUCHARMAP_GUCHARMAP_H_INSIDE__
+static guint initialization_count;
-#endif /* #ifndef GUCHARMAP_H */
+void gucharmap_init (void)
+{
+ g_return_if_fail (initialization_count == 0);
+
+ if (initialization_count++ > 0)
+ return;
+
+#ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+#endif /* #ifdef ENABLE_NLS */
+
+ gucharmap_settings_initialize ();
+}
+
+void gucharmap_shutdown (void)
+{
+ g_return_if_fail (initialization_count > 0);
+
+ if (--initialization_count > 0)
+ return;
+
+ gucharmap_settings_shutdown ();
+}
Added: trunk/gucharmap/gucharmap-init.h
==============================================================================
--- (empty file)
+++ trunk/gucharmap/gucharmap-init.h Fri Mar 21 10:48:42 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007 Christian Persch
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
+ */
+
+
+#ifndef GUCHARMAP_INIT_H
+#define GUCHARMAP_INIT_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+void gucharmap_init (void);
+
+void gucharmap_shutdown (void);
+
+G_END_DECLS
+
+#endif /* !GUCHARMAP_INIT_H */
Modified: trunk/gucharmap/gucharmap-mini-fontsel.c
==============================================================================
--- trunk/gucharmap/gucharmap-mini-fontsel.c (original)
+++ trunk/gucharmap/gucharmap-mini-fontsel.c Fri Mar 21 10:48:42 2008
@@ -180,8 +180,6 @@
G_TYPE_NONE, 0);
G_OBJECT_CLASS (clazz)->finalize = mini_font_selection_finalize;
-
- _gucharmap_intl_ensure_initialized ();
}
Modified: trunk/gucharmap/gucharmap-script-chapters-model.c
==============================================================================
--- trunk/gucharmap/gucharmap-script-chapters-model.c (original)
+++ trunk/gucharmap/gucharmap-script-chapters-model.c Fri Mar 21 10:48:42 2008
@@ -125,8 +125,6 @@
{
GucharmapChaptersModelClass *chapters_class = GUCHARMAP_CHAPTERS_MODEL_CLASS (clazz);
- _gucharmap_intl_ensure_initialized ();
-
chapters_class->title = _("Script");
chapters_class->character_to_iter = character_to_iter;
chapters_class->get_codepoint_list = get_codepoint_list;
Modified: trunk/gucharmap/gucharmap-script-codepoint-list.c
==============================================================================
--- trunk/gucharmap/gucharmap-script-codepoint-list.c (original)
+++ trunk/gucharmap/gucharmap-script-codepoint-list.c Fri Mar 21 10:48:42 2008
@@ -255,8 +255,6 @@
codepoint_list_class->get_last_index = get_last_index;
gobject_class->finalize = finalize;
-
- _gucharmap_intl_ensure_initialized ();
}
static void
Modified: trunk/gucharmap/gucharmap-search-dialog.c
==============================================================================
--- trunk/gucharmap/gucharmap-search-dialog.c (original)
+++ trunk/gucharmap/gucharmap-search-dialog.c Fri Mar 21 10:48:42 2008
@@ -848,8 +848,6 @@
g_signal_new ("search-finish", gucharmap_search_dialog_get_type (), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GucharmapSearchDialogClass, search_finish), NULL, NULL,
g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
-
- _gucharmap_intl_ensure_initialized ();
}
G_DEFINE_TYPE (GucharmapSearchDialog, gucharmap_search_dialog, GTK_TYPE_DIALOG)
Modified: trunk/gucharmap/gucharmap-unicode-info.c
==============================================================================
--- trunk/gucharmap/gucharmap-unicode-info.c (original)
+++ trunk/gucharmap/gucharmap-unicode-info.c Fri Mar 21 10:48:42 2008
@@ -21,7 +21,6 @@
#include <gtk/gtk.h>
#include <string.h>
-#include "gucharmap-intl.h"
#include "gucharmap-unicode-info.h"
#include "unicode-names.h"
@@ -65,9 +64,7 @@
{
static gchar buf[32];
- _gucharmap_intl_ensure_initialized ();
-
- if ((wc >= 0x3400 && wc <= 0x4DB5)
+ if ((wc >= 0x3400 && wc <= 0x4DB5)
|| (wc >= 0x4e00 && wc <= 0x9fa5)
|| (wc >= 0x20000 && wc <= 0x2A6D6))
{
@@ -117,8 +114,6 @@
G_CONST_RETURN gchar *
gucharmap_get_unicode_category_name (gunichar wc)
{
- _gucharmap_intl_ensure_initialized ();
-
switch (gucharmap_unichar_type (wc))
{
case G_UNICODE_CONTROL: return _("Other, Control");
Modified: trunk/gucharmap/gucharmap-window.c
==============================================================================
--- trunk/gucharmap/gucharmap-window.c (original)
+++ trunk/gucharmap/gucharmap-window.c Fri Mar 21 10:48:42 2008
@@ -979,8 +979,6 @@
GTK_WIDGET_CLASS (clazz)->show_all = show_all;
G_OBJECT_CLASS (clazz)->finalize = window_finalize;
g_type_class_add_private (clazz, sizeof (GucharmapWindowPrivate));
-
- _gucharmap_intl_ensure_initialized ();
}
G_DEFINE_TYPE (GucharmapWindow, gucharmap_window, GTK_TYPE_WINDOW)
Modified: trunk/gucharmap/gucharmap.h
==============================================================================
--- trunk/gucharmap/gucharmap.h (original)
+++ trunk/gucharmap/gucharmap.h Fri Mar 21 10:48:42 2008
@@ -1,4 +1,3 @@
-/* $Id$ */
/*
* Copyright (c) 2004 Noah Levitt
*
@@ -27,6 +26,7 @@
#include <gucharmap/gucharmap-charmap.h>
#include <gucharmap/gucharmap-chartable.h>
#include <gucharmap/gucharmap-codepoint-list.h>
+#include <gucharmap/gucharmap-init.h>
#include <gucharmap/gucharmap-mini-fontsel.h>
#include <gucharmap/gucharmap-script-chapters-model.h>
#include <gucharmap/gucharmap-script-codepoint-list.h>
Modified: trunk/gucharmap/main.c
==============================================================================
--- trunk/gucharmap/main.c (original)
+++ trunk/gucharmap/main.c Fri Mar 21 10:48:42 2008
@@ -56,7 +56,7 @@
exit (1);
}
- gucharmap_settings_initialize ();
+ gucharmap_init ();
g_set_application_name (_("Gucharmap"));
gtk_window_set_default_icon_name ("gucharmap");
@@ -106,7 +106,7 @@
gtk_main ();
- gucharmap_settings_shutdown ();
+ gucharmap_shutdown ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]