[gtranslator] Use g_application_get_default instead of reimplementing it
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Use g_application_get_default instead of reimplementing it
- Date: Wed, 2 May 2012 20:33:25 +0000 (UTC)
commit c8210034eb1a67343bd4d1faf021832952d75a78
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Wed May 2 22:33:27 2012 +0200
Use g_application_get_default instead of reimplementing it
src/gtr-application.c | 25 ++++---------------------
src/gtr-application.h | 26 ++++++--------------------
2 files changed, 10 insertions(+), 41 deletions(-)
---
diff --git a/src/gtr-application.c b/src/gtr-application.c
index bf7ce6c..41d581d 100644
--- a/src/gtr-application.c
+++ b/src/gtr-application.c
@@ -72,8 +72,6 @@ struct _GtrApplicationPrivate
guint first_run : 1;
};
-static GtrApplication *instance = NULL;
-
static gboolean
ensure_user_config_dir (void)
{
@@ -344,25 +342,10 @@ gtr_application_class_init (GtrApplicationClass *klass)
GtrApplication *
_gtr_application_new ()
{
- instance = GTR_APPLICATION (g_object_new (GTR_TYPE_APPLICATION,
- "application-id", "org.gnome.Gtranslator",
- "flags", G_APPLICATION_HANDLES_OPEN,
- NULL));
-
- return instance;
-}
-
-/**
- * gtr_application_get_default:
- *
- * Returns the default instance of the application.
- *
- * Returns: (transfer none): the default instance of the application.
- */
-GtrApplication *
-gtr_application_get_default (void)
-{
- return instance;
+ return GTR_APPLICATION (g_object_new (GTR_TYPE_APPLICATION,
+ "application-id", "org.gnome.Gtranslator",
+ "flags", G_APPLICATION_HANDLES_OPEN,
+ NULL));
}
/**
diff --git a/src/gtr-application.h b/src/gtr-application.h
index d93156c..ee22fa4 100644
--- a/src/gtr-application.h
+++ b/src/gtr-application.h
@@ -30,23 +30,19 @@
#include "gtr-window.h"
G_BEGIN_DECLS
-/*
- * Type checking and casting macros
- */
+
#define GTR_TYPE_APPLICATION (gtr_application_get_type ())
#define GTR_APPLICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_APPLICATION, GtrApplication))
#define GTR_APPLICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_APPLICATION, GtrApplicationClass))
#define GTR_IS_APPLICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_APPLICATION))
#define GTR_IS_APPLICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_APPLICATION))
#define GTR_APPLICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_APPLIAPPLICATION, GtrApplicationClass))
-#define GTR_APP (gtr_application_get_default())
-/* Private structure type */
-typedef struct _GtrApplicationPrivate GtrApplicationPrivate;
-/*
- * Main object structure
- */
-typedef struct _GtrApplication GtrApplication;
+#define GTR_APP (GTR_APPLICATION (g_application_get_default()))
+
+typedef struct _GtrApplication GtrApplication;
+typedef struct _GtrApplicationClass GtrApplicationClass;
+typedef struct _GtrApplicationPrivate GtrApplicationPrivate;
struct _GtrApplication
{
@@ -56,25 +52,15 @@ struct _GtrApplication
GtrApplicationPrivate *priv;
};
-/*
- * Class definition
- */
-typedef struct _GtrApplicationClass GtrApplicationClass;
-
struct _GtrApplicationClass
{
GtkApplicationClass parent_class;
};
-/*
- * Public methods
- */
GType gtr_application_get_type (void)G_GNUC_CONST;
GtrApplication *_gtr_application_new (void);
-GtrApplication *gtr_application_get_default (void);
-
GList * gtr_application_get_views (GtrApplication *app,
gboolean original,
gboolean translated);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]