[glib/wip/gapplication: 2/5] application: Clean up the header



commit c659ccaf1a5338aa7713838dd83706620c477b97
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Tue May 18 09:35:57 2010 +0100

    application: Clean up the header
    
    Also rename the DISABLE_SINGLE_INSTANCE flag to match the GLib
    conventions on enumeration names.

 gio/gapplication.c |    2 +-
 gio/gapplication.h |  171 ++++++++++++++++++++++++++++++----------------------
 2 files changed, 99 insertions(+), 74 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 80cfcd2..c7dbd32 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -218,7 +218,7 @@ g_application_try_new (GApplicationFlags   flags,
 
   g_type_init ();
   
-  if (!(flags & G_APPLICATION_FLAG_DISABLE_SINGLE_INSTANCE))
+  if (!(flags & G_APPLICATION_DISABLE_SINGLE_INSTANCE))
     {
       if (!_g_application_platform_acquire_single_instance (g_value_get_string (&parameters[0].value), NULL))
         {
diff --git a/gio/gapplication.h b/gio/gapplication.h
index aadee5a..bd7a98c 100644
--- a/gio/gapplication.h
+++ b/gio/gapplication.h
@@ -32,39 +32,88 @@
 
 G_BEGIN_DECLS
 
-#define G_TYPE_APPLICATION                              (g_application_get_type ())
-#define G_APPLICATION(inst)                             (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
-                                                             G_TYPE_APPLICATION, GApplication))
-#define G_APPLICATION_CLASS(class)                      (G_TYPE_CHECK_CLASS_CAST ((class),                       \
-                                                             G_TYPE_APPLICATION, GApplicationClass))
-#define G_IS_APPLICATION(inst)                          (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
-                                                             G_TYPE_APPLICATION))
-#define G_IS_APPLICATION_CLASS(class)                   (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
-                                                             G_TYPE_APPLICATION))
-#define G_APPLICATION_GET_CLASS(inst)                   (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
-                                                             G_TYPE_APPLICATION, GApplicationClass))
-
-typedef struct _GApplication                             GApplication;
-typedef struct _GApplicationPrivate                      GApplicationPrivate;
-typedef struct _GApplicationClass                        GApplicationClass;
+#define G_TYPE_APPLICATION              (g_application_get_type ())
+#define G_APPLICATION(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_APPLICATION, GApplication))
+#define G_APPLICATION_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_APPLICATION, GApplicationClass))
+#define G_IS_APPLICATION(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_APPLICATION))
+#define G_IS_APPLICATION_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_APPLICATION))
+#define G_APPLICATION_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_APPLICATION, GApplicationClass))
+
+typedef struct _GApplication            GApplication;
+typedef struct _GApplicationPrivate     GApplicationPrivate;
+typedef struct _GApplicationClass       GApplicationClass;
+
+/**
+ * GApplicationExistsCallback:
+ * @user_data: data passed to the callback
+ *
+ * Function called by g_application_try_new() if an existing instance of
+ * #GApplication with the same name already exists
+ *
+ * Since: 2.26
+ */
+typedef void (*GApplicationExistsCallback) (gpointer user_data);
+
+/**
+ * GApplicationFlags:
+ * @G_APPLICATION_DISABLE_SINGLE_INSTANCE: If specified, do not check in
+ *   construction for another running process
+ *
+ * Flags used when creating a #GApplication.
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+  G_APPLICATION_FLAGS_NONE = 0,
+
+  G_APPLICATION_DISABLE_SINGLE_INSTANCE = 1 << 0
+} GApplicationFlags;
+
+/**
+ * GApplication:
+ *
+ * The <structname>GApplication</structname> structure contains private
+ * data and should only be accessed using the provided API
+ *
+ * Since: 2.26
+ */
+struct _GApplication
+{
+  /*< private >*/
+  GObject parent_instance;
+
+  GApplicationPrivate *priv;
+};
 
 /**
  * GApplicationClass:
- * @quit: virtual method called when a quit is requested
- **/
+ * @action: class handler for the #GApplication::action signal
+ * @quit: class handler for the #GApplication::quit signal
+ * @run: virtual function, called by g_application_run()
+ *
+ * The <structname>GApplicationClass</structname> structure contains
+ * private data only
+ *
+ * Since: 2.26
+ */
 struct _GApplicationClass
 {
+  /*< private >*/
   GObjectClass parent_class;
 
+  /*< public >*/
   /* signals */
-
-  void (* action)(GApplication *app, const char *name, guint timestamp);
-  gboolean (* quit) (GApplication *app, guint timestamp);
+  void     (* action) (GApplication *application,
+                       const gchar  *action_name,
+                       guint         timestamp);
+  gboolean (* quit)   (GApplication *application,
+                       guint         timestamp);
   
   /* vfuncs */
-  
-  void (*run) (GApplication *app);
+  void     (* run)    (GApplication *application);
 
+  /*< private >*/
   /* Padding for future expansion */
   void (*_g_reserved1) (void);
   void (*_g_reserved2) (void);
@@ -74,57 +123,33 @@ struct _GApplicationClass
   void (*_g_reserved6) (void);
 };
 
-struct _GApplication
-{
-  GObject parent_instance;
-  GApplicationPrivate *priv;
-};
-
-/**
- * GApplicationFlags:
- * @G_APPLICATION_FLAG_DISABLE_SINGLE_INSTANCE: If specified, do not check in construction for another running process
- *
- * Flags used when creating a #GApplication.
- */
-typedef enum
-{
-    G_APPLICATION_FLAG_DISABLE_SINGLE_INSTANCE = 1 << 0
-} GApplicationFlags;
-
-typedef void (*GApplicationExistsCallback) (gpointer user_data);
-
-GType                   g_application_get_type                      (void) G_GNUC_CONST;
-
-GApplication *          g_application_new                           (const char         *appid,
-                                                                     GApplicationFlags   flags);
-                 
-GApplication *          g_application_try_new                       (GApplicationFlags   flags,
-                                                                     GType               class_type,
-                                                                     GApplicationExistsCallback on_other_process_exists,
-                                                                     gpointer            user_data,
-                                                                     guint               n_parameters,
-                                                                     GParameter         *parameters);
-
-GApplication *          g_application_get_instance                  (void);
-
-const char *            g_application_get_id                        (GApplication      *app);
-
-void                    g_application_add_action                    (GApplication      *app,
-                                                                     const char        *name,
-                                                                     const char        *description);
-
-void                    g_application_set_action_enabled            (GApplication      *app,
-                                                                     const char        *name,
-                                                                     gboolean           enabled);
-
-void                    g_application_invoke_action                 (GApplication      *app,
-                                                                     const char        *name,
-                                                                     guint              timestamp);
-
-GMainLoop *             g_application_get_mainloop                  (GApplication      *app);
-
-void                    g_application_run                           (GApplication      *app);             
-gboolean                g_application_quit                          (GApplication      *app, guint timestamp);
+GType                   g_application_get_type                  (void) G_GNUC_CONST;
+
+GApplication *          g_application_new                       (const char         *appid,
+                                                                 GApplicationFlags   flags);
+GApplication *          g_application_try_new                   (GApplicationFlags   flags,
+                                                                 GType               class_type,
+                                                                 GApplicationExistsCallback on_other_process_exists,
+                                                                 gpointer            user_data,
+                                                                 guint               n_parameters,
+                                                                 GParameter         *parameters);
+
+GApplication *          g_application_get_instance              (void);
+G_CONST_RETURN gchar *  g_application_get_id                    (GApplication      *app);
+
+void                    g_application_add_action                (GApplication      *app,
+                                                                 const char        *name,
+                                                                 const char        *description);
+void                    g_application_set_action_enabled        (GApplication      *app,
+                                                                 const char        *name,
+                                                                 gboolean           enabled);
+void                    g_application_invoke_action             (GApplication      *app,
+                                                                 const char        *name,
+                                                                 guint              timestamp);
+
+GMainLoop *             g_application_get_mainloop              (GApplication      *app);
+void                    g_application_run                       (GApplication      *app);             
+gboolean                g_application_quit                      (GApplication      *app, guint timestamp);
 
 G_END_DECLS
 



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