[aisleriot] app: Rename



commit 534cee3e3907a60c6a80a8367f704ecd243647d5
Author: Christian Persch <chpe gnome org>
Date:   Mon Mar 4 20:52:59 2013 +0100

    app: Rename

 src/Makefile.am                         |    6 +-
 src/application.h                       |   52 ----------------
 src/{application.c => ar-application.c} |  101 +++++++++++++++++--------------
 src/ar-application.h                    |   42 +++++++++++++
 src/sol.c                               |    5 +-
 5 files changed, 103 insertions(+), 103 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 9e9f8de..7a62493 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,8 +8,8 @@ DOC_MODULE = aisleriot
 bin_PROGRAMS = sol
 
 sol_SOURCES = \
-       application.c \
-       application.h \
+       ar-application.c \
+       ar-application.h \
        ar-clock.c \
        ar-clock.h \
        ar-cursor.c     \
@@ -75,6 +75,8 @@ if HAVE_CLUTTER
 noinst_PROGRAMS = sol-clutter
 
 sol_clutter_SOURCES = \
+       ar-application.c \
+       ar-application.h \
        ar-clock.c      \
        ar-clock.h      \
        ar-clutter-embed.c \
diff --git a/src/application.c b/src/ar-application.c
similarity index 77%
rename from src/application.c
rename to src/ar-application.c
index b70d78f..582fd45 100644
--- a/src/application.c
+++ b/src/ar-application.c
@@ -20,6 +20,8 @@
 
 #include "config.h"
 
+#include "ar-application.h"
+
 #include <stdlib.h>
 
 #include <glib.h>
@@ -42,9 +44,18 @@
 #include "game.h"
 #include "util.h"
 
-#include "application.h"
+struct _ArApplicationClass {
+  GtkApplicationClass parent_class;
+};
+
+struct _ArApplication {
+  GtkApplication parent_instance;
+
+  /*< private >*/
+  ArApplicationPrivate *priv;
+};
 
-struct _AisleriotApplicationPrivate
+struct _ArApplicationPrivate
 {
   AisleriotWindow *window;
   char *variation;
@@ -52,10 +63,10 @@ struct _AisleriotApplicationPrivate
   gboolean freecell; /* unused */
 };
 
-G_DEFINE_TYPE (AisleriotApplication, aisleriot_application, GTK_TYPE_APPLICATION)
+G_DEFINE_TYPE (ArApplication, ar_application, GTK_TYPE_APPLICATION)
 
 static void
-add_main_options (AisleriotApplication *self,
+add_main_options (ArApplication *self,
                   GOptionContext *context)
 {
   const GOptionEntry aisleriot_options[] = {
@@ -160,16 +171,16 @@ action_quit (GSimpleAction *simple,
              GVariant *parameter,
              gpointer user_data)
 {
-  AisleriotApplication *self = AISLERIOT_APPLICATION (user_data);
+  ArApplication *self = AR_APPLICATION (user_data);
 
   gtk_widget_destroy (GTK_WIDGET (self->priv->window));
 }
 
 static int
-aisleriot_application_command_line (GApplication *application,
-                                    GApplicationCommandLine *command_line)
+ar_application_command_line (GApplication *application,
+                             GApplicationCommandLine *command_line)
 {
-  AisleriotApplication *self = AISLERIOT_APPLICATION (application);
+  ArApplication *self = AR_APPLICATION (application);
   int argc;
   char **argv;
   int retval = 0;
@@ -235,31 +246,31 @@ aisleriot_application_command_line (GApplication *application,
 }
 
 static void
-aisleriot_application_activate (GApplication *application)
+ar_application_activate (GApplication *application)
 {
-  AisleriotApplication *self = AISLERIOT_APPLICATION (application);
+  ArApplication *self = AR_APPLICATION (application);
 
   gtk_window_present (GTK_WINDOW (self->priv->window));
 }
 
 static GActionEntry app_entries[] = {
-        { "new-game", action_new_game, NULL, NULL, NULL },
-        { "change-game", action_change_game, NULL, NULL, NULL },
-        { "statistics", action_statistics, NULL, NULL, NULL },
-        { "fullscreen", action_fullscreen, NULL, NULL, NULL },
-        { "about", action_about, NULL, NULL, NULL },
-        { "help", action_help, NULL, NULL, NULL },
-        { "quit", action_quit, NULL, NULL, NULL },
+  { "new-game", action_new_game, NULL, NULL, NULL },
+  { "change-game", action_change_game, NULL, NULL, NULL },
+  { "statistics", action_statistics, NULL, NULL, NULL },
+  { "fullscreen", action_fullscreen, NULL, NULL, NULL },
+  { "about", action_about, NULL, NULL, NULL },
+  { "help", action_help, NULL, NULL, NULL },
+  { "quit", action_quit, NULL, NULL, NULL },
 };
 
 static void
-aisleriot_application_startup (GApplication *application)
+ar_application_startup (GApplication *application)
 {
-  AisleriotApplication *self = AISLERIOT_APPLICATION (application);
+  ArApplication *self = AR_APPLICATION (application);
   GMenu *menu;
   GMenu *section;
 
-  G_APPLICATION_CLASS (aisleriot_application_parent_class)->startup (application);
+  G_APPLICATION_CLASS (ar_application_parent_class)->startup (application);
 
   aisleriot_conf_init ();
   ar_sound_enable (FALSE);
@@ -302,74 +313,72 @@ aisleriot_application_startup (GApplication *application)
 }
 
 static void
-aisleriot_application_shutdown (GApplication *application)
+ar_application_shutdown (GApplication *application)
 {
   g_settings_sync ();
 
-  G_APPLICATION_CLASS (aisleriot_application_parent_class)->shutdown (application);
+  G_APPLICATION_CLASS (ar_application_parent_class)->shutdown (application);
 }
 
 static GObject *
-aisleriot_application_constructor (GType type,
-                                   guint n_construct_params,
-                                   GObjectConstructParam *construct_params)
+ar_application_constructor (GType type,
+                            guint n_construct_params,
+                            GObjectConstructParam *construct_params)
 {
   static GObject *self = NULL;
 
   if (self == NULL)
     {
-      self = G_OBJECT_CLASS (aisleriot_application_parent_class)->constructor (type,
+      self = G_OBJECT_CLASS (ar_application_parent_class)->constructor (type,
                                                                         n_construct_params,
                                                                         construct_params);
       g_object_add_weak_pointer (self, (gpointer) &self);
       return self;
     }
-
+  
   return g_object_ref (self);
 }
 
-
 static void
-aisleriot_application_dispose (GObject *object)
+ar_application_dispose (GObject *object)
 {
-  AisleriotApplication *self = AISLERIOT_APPLICATION (object);
+  ArApplication *self = AR_APPLICATION (object);
 
-  G_OBJECT_CLASS (aisleriot_application_parent_class)->dispose (object);
+  G_OBJECT_CLASS (ar_application_parent_class)->dispose (object);
 
   g_free (self->priv->variation);
   self->priv->variation = NULL;
 }
 
-
 static void
-aisleriot_application_init (AisleriotApplication *self)
+ar_application_init (ArApplication *self)
 {
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-                                            AISLERIOT_TYPE_APPLICATION,
-                                            AisleriotApplicationPrivate);
+                                            AR_TYPE_APPLICATION,
+                                            ArApplicationPrivate);
 }
 
-
 static void
-aisleriot_application_class_init (AisleriotApplicationClass *class)
+ar_application_class_init (ArApplicationClass *class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GApplicationClass *application_class = G_APPLICATION_CLASS (class);
 
-  object_class->constructor = aisleriot_application_constructor;
-  object_class->dispose = aisleriot_application_dispose;
-  application_class->activate = aisleriot_application_activate;
-  application_class->startup = aisleriot_application_startup;
-  application_class->shutdown = aisleriot_application_shutdown;
-  application_class->command_line = aisleriot_application_command_line;
+  object_class->constructor = ar_application_constructor;
+  object_class->dispose = ar_application_dispose;
+
+  application_class->activate = ar_application_activate;
+  application_class->startup = ar_application_startup;
+  application_class->shutdown = ar_application_shutdown;
+  application_class->command_line = ar_application_command_line;
 
-  g_type_class_add_private (class, sizeof (AisleriotApplicationPrivate));
+  g_type_class_add_private (class, sizeof (ArApplicationPrivate));
 }
 
 GtkApplication *
-aisleriot_application_new (void)
+ar_application_new (void)
 {
-  return g_object_new (AISLERIOT_TYPE_APPLICATION,
+  return g_object_new (AR_TYPE_APPLICATION,
                        "application-id", "org.gnome.Aisleriot",
                        "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
                        NULL);
diff --git a/src/ar-application.h b/src/ar-application.h
new file mode 100644
index 0000000..0b8729c
--- /dev/null
+++ b/src/ar-application.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2013 William Jon McCann
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AR_APPLICATION_H
+#define AR_APPLICATION_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define AR_TYPE_APPLICATION               (ar_application_get_type ())
+#define AR_APPLICATION(o)                 (G_TYPE_CHECK_INSTANCE_CAST ((o), AR_TYPE_APPLICATION, 
ArApplication))
+#define AR_APPLICATION_CLASS(k)           (G_TYPE_CHECK_CLASS_CAST((k), AR_TYPE_APPLICATION, 
ArApplicationClass))
+#define AISLERIOT_IS_APPLICATION(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), AR_TYPE_APPLICATION))
+#define AISLERIOT_IS_APPLICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), AR_TYPE_APPLICATION))
+#define AR_APPLICATION_GET_CLASS(o)       (G_TYPE_INSTANCE_GET_CLASS ((o), AR_TYPE_APPLICATION, 
ArApplicationClass))
+
+typedef struct _ArApplication       ArApplication;
+typedef struct _ArApplicationPrivate ArApplicationPrivate;
+typedef struct _ArApplicationClass   ArApplicationClass;
+
+GType ar_application_get_type (void);
+
+GtkApplication *ar_application_new (void);
+
+G_END_DECLS
+
+#endif /* !AR_APPLICATION_H */
diff --git a/src/sol.c b/src/sol.c
index 62c69d6..18c4d24 100644
--- a/src/sol.c
+++ b/src/sol.c
@@ -25,8 +25,7 @@
 #include <glib/gi18n.h>
 
 #include "ar-runtime.h"
-
-#include "application.h"
+#include "ar-application.h"
 
 static void
 main_prog (void *closure, int argc, char *argv[])
@@ -34,7 +33,7 @@ main_prog (void *closure, int argc, char *argv[])
   GtkApplication *application;
   int status;
 
-  application = aisleriot_application_new ();
+  application = ar_application_new ();
   status = g_application_run (G_APPLICATION (application), argc, argv);
   g_object_unref (application);
 }


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