gtranslator r3546 - in trunk: . src



Author: psanxiao
Date: Mon Mar 31 22:15:47 2008
New Revision: 3546
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3546&view=rev

Log:
profile.{h.c}:
Added these files that implement the profile class


Added:
   trunk/src/profile.c
   trunk/src/profile.h
Modified:
   trunk/ChangeLog
   trunk/src/ChangeLog
   trunk/src/Makefile.am

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Mon Mar 31 22:15:47 2008
@@ -58,6 +58,7 @@
 	msg.h \
 	notebook.h \
 	po.h \
+	profile.h \
 	statusbar.h \
 	tab.h \
 	utils.h \
@@ -82,6 +83,7 @@
 	view.c \
 	window.c \
 	po.c \
+	profile.c \
 	utils.c \
 	msg.c \
 	actions.h \

Added: trunk/src/profile.c
==============================================================================
--- (empty file)
+++ trunk/src/profile.c	Mon Mar 31 22:15:47 2008
@@ -0,0 +1,218 @@
+/*
+ * (C) 2008 	Pablo Sanxiao <psanxiao gmail com>
+ *			
+ * gtranslator 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.
+ *    
+ * gtranslator 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  02111-1307  USA
+ */
+ 
+#include "profile.h"
+#include "preferences-dialog.h"
+
+#include <glib.h>
+#include <glib-object.h>
+
+#define GTR_PROFILE_GET_PRIVATE(object)	(G_TYPE_INSTANCE_GET_PRIVATE ( \
+					 	(object),	\
+					 	GTR_TYPE_PROFILE,     \
+					 	GtranslatorProfilePrivate))
+
+G_DEFINE_TYPE(GtranslatorProfile, gtranslator_profile, G_TYPE_OBJECT)
+
+struct _GtranslatorProfilePrivate
+{
+	/* 
+	 * Identify the profile
+	 */
+	gchar *name;
+	
+	/*
+	 * Translator's information
+	 */
+	gchar *author_name;
+	gchar *author_email;
+
+	/*
+	 * Complete language name
+	 */
+	gchar *language_name;
+
+	/*
+	 * Language code. Example: "en" -> English
+	 */
+	gchar *language_code;
+
+	/*
+	 * Set of characters. Example: UTF-8
+	 */
+	gchar *charset;
+
+	/*
+	 * Encoding. Example: 8 bits
+	 */
+	gchar *encoding;
+
+	/*
+	 * Email of the group of translation
+	 */
+	gchar *group_email;
+
+	/*
+	 * Plural forms
+	 */
+	gchar *plurals;
+};	
+
+static void gtranslator_profile_init (GtranslatorProfile *profile)
+{
+	profile->priv = GTR_PROFILE_GET_PRIVATE (profile);
+}
+
+static void gtranslator_profile_finalize (GObject *object)
+{
+	GtranslatorProfile *profile = GTR_PROFILE(object);
+	
+	g_free (profile->priv->name);
+	
+	G_OBJECT_CLASS (gtranslator_profile_parent_class)->finalize (object);
+}
+
+static void gtranslator_profile_class_init (GtranslatorProfileClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	g_type_class_add_private (klass, sizeof (GtranslatorProfilePrivate));
+
+	object_class->finalize = gtranslator_profile_finalize;
+}
+
+/*
+ * Public methods
+ */
+
+GtranslatorProfile *gtranslator_profile_new (void)
+{
+	GtranslatorProfile *profile;
+	
+	profile = g_object_new (GTR_TYPE_PROFILE, NULL);
+	
+	return profile;
+}
+
+gchar *gtranslator_profile_get_name (GtranslatorProfile *profile)
+{
+	return profile->priv->name;
+}
+
+void gtranslator_profile_set_name (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->name)
+		g_free (profile->priv->name);
+	profile->priv->name = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_author_name (GtranslatorProfile *profile)
+{
+	return profile->priv->author_name;
+}
+
+void gtranslator_profile_set_author_name (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->author_name)
+		g_free (profile->priv->author_name);
+	profile->priv->author_name = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_author_email (GtranslatorProfile *profile)
+{
+	return profile->priv->author_email;
+}
+
+void gtranslator_profile_set_author_email (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->author_email)
+		g_free (profile->priv->author_email);
+	profile->priv->author_email = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_language_name (GtranslatorProfile *profile)
+{
+	return profile->priv->language_name;
+}
+
+void gtranslator_profile_set_language_name (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->language_name)
+		g_free (profile->priv->language_name);
+	profile->priv->language_name = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_language_code (GtranslatorProfile *profile)
+{
+	return profile->priv->language_code;
+}
+
+void gtranslator_profile_set_language_code (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->language_code)
+		g_free (profile->priv->language_code);
+	profile->priv->language_code = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_charset (GtranslatorProfile *profile)
+{
+	return profile->priv->charset;
+}
+
+void gtranslator_profile_set_charset (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->charset)
+		g_free (profile->priv->charset);
+	profile->priv->charset = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_encoding (GtranslatorProfile *profile)
+{
+	return profile->priv->encoding;
+}
+
+void gtranslator_profile_set_encoding (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->encoding)
+		g_free (profile->priv->encoding);
+	profile->priv->encoding = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_group_email (GtranslatorProfile *profile)
+{
+	return profile->priv->group_email;
+}
+
+void gtranslator_profile_set_group_email (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->group_email)
+		g_free (profile->priv->group_email);
+	profile->priv->group_email = g_strdup (data);
+}
+
+gchar *gtranslator_profile_get_plurals (GtranslatorProfile *profile)
+{
+	return profile->priv->plurals;
+}
+
+void gtranslator_profile_set_plurals (GtranslatorProfile *profile, gchar *data)
+{
+	if (profile->priv->plurals)
+		g_free (profile->priv->plurals);
+	profile->priv->plurals = g_strdup (data);
+}

Added: trunk/src/profile.h
==============================================================================
--- (empty file)
+++ trunk/src/profile.h	Mon Mar 31 22:15:47 2008
@@ -0,0 +1,97 @@
+/*
+ * (C) 2008 	Pablo Sanxiao <psanxiao gmail com>
+ *			
+ * gtranslator 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 3 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * gtranslator 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  02111-1307  USA
+ */
+ 
+ #ifndef __PROFILE_H__
+#define __PROFILE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+/*
+ * Utility Macros
+ */
+
+#define GTR_TYPE_PROFILE		(gtranslator_profile_get_type ())
+#define GTR_PROFILE(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_PROFILE, GtranslatorProfile))
+#define GTR_PROFILE_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_PROFILE, GtranslatorProfileClass))
+#define GTR_IS_PROFILE(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_PROFILE))
+#define GTR_IS_PROFILE_CLASS(k)		(G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_PROFILE))
+#define GTR_PROFILE_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_PROFILE, GtranslatorProfileClass))
+
+/* Private structure type */
+typedef struct _GtranslatorProfilePrivate	GtranslatorProfilePrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _GtranslatorProfile	GtranslatorProfile;
+
+struct _GtranslatorProfile
+{
+	GObject parent_instance;
+	/*< private > */
+	GtranslatorProfilePrivate *priv;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _GtranslatorProfileClass	GtranslatorProfileClass;
+
+struct _GtranslatorProfileClass
+{
+	GObjectClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType		gtranslator_profile_get_type		(void) G_GNUC_CONST;
+
+GType		gtranslator_profile_register_type	(GTypeModule * module);
+
+GtranslatorProfile	
+		*gtranslator_profile_new		(void);
+
+gchar 		*gtranslator_profile_get_name 		(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_name 		(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_author_name 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_author_name 	(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_author_email 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_author_email 	(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_language_name 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_language_name 	(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_language_code 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_language_code 	(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_charset 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_charset 	(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_encoding 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_encoding 	(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_group_email 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_group_email 	(GtranslatorProfile *profile, gchar *data);
+
+gchar 		*gtranslator_profile_get_plurals 	(GtranslatorProfile *profile);
+void 		 gtranslator_profile_set_plurals 	(GtranslatorProfile *profile, gchar *data);
+#endif /* __PROFILE_H__ */



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